Skip to content

Commit 15d5060

Browse files
committed
clean temporary notebook answers
1 parent 8cfc7f8 commit 15d5060

2 files changed

Lines changed: 62 additions & 62 deletions

File tree

software/api/client/notebooks/interactive_control.ipynb

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@
6868
"try:\n",
6969
" client = RioClient(base_url=API_BASE_URL)\n",
7070
" health = client.health()\n",
71-
" print(f\"\u2705 Connected to Rio API at {API_BASE_URL}\")\n",
71+
" print(f\" Connected to Rio API at {API_BASE_URL}\")\n",
7272
" print(f\" Status: {health['status']}, Simulation: {health['simulation']}\")\n",
7373
"except Exception as e:\n",
74-
" print(f\"\u274c Failed to connect to API: {e}\")\n",
74+
" print(f\" Failed to connect to API: {e}\")\n",
7575
" print(f\" Make sure the API server is running at {API_BASE_URL}\")\n",
7676
" raise\n",
7777
"\n",
7878
"# Initialize pump API (lazy connection)\n",
7979
"try:\n",
8080
" pump_api = SyringePumpAPI(base_url=PUMP_API_URL)\n",
81-
" print(f\"\u2705 Pump API configured at {PUMP_API_URL}\")\n",
81+
" print(f\" Pump API configured at {PUMP_API_URL}\")\n",
8282
"except Exception as e:\n",
8383
" pump_api = None\n",
84-
" print(f\"\u26a0\ufe0f Pump API unavailable: {e}\")\n"
84+
" print(f\"⚠️ Pump API unavailable: {e}\")\n"
8585
]
8686
},
8787
{
@@ -134,7 +134,7 @@
134134
" except Exception as e:\n",
135135
" with flow_status:\n",
136136
" clear_output()\n",
137-
" print(f\"\u274c Error: {e}\")\n",
137+
" print(f\" Error: {e}\")\n",
138138
" \n",
139139
" def create_flow_handler(param_name, setter_func):\n",
140140
" \"\"\"Create parameter handler for flow/pressure (like internship pattern)\"\"\"\n",
@@ -146,12 +146,12 @@
146146
" getattr(client, setter_func)(channel, value)\n",
147147
" with flow_status:\n",
148148
" clear_output()\n",
149-
" print(f\"\u2705 Updated {param_name} for channel {channel} to {value}\")\n",
149+
" print(f\" Updated {param_name} for channel {channel} to {value}\")\n",
150150
" update_flow_state()\n",
151151
" except Exception as e:\n",
152152
" with flow_status:\n",
153153
" clear_output()\n",
154-
" print(f\"\u274c Error updating {param_name}: {e}\")\n",
154+
" print(f\" Error updating {param_name}: {e}\")\n",
155155
" return handler\n",
156156
" \n",
157157
" def on_channel_select(change):\n",
@@ -165,7 +165,7 @@
165165
" update_flow_state()\n",
166166
" except Exception as e:\n",
167167
" with flow_status:\n",
168-
" print(f\"\u274c Error loading channel {change['new']}: {e}\")\n",
168+
" print(f\" Error loading channel {change['new']}: {e}\")\n",
169169
" \n",
170170
" flow_channel.observe(on_channel_select, names='value')\n",
171171
" flow_rate.observe(create_flow_handler('flow', 'set_flow'), 'value')\n",
@@ -180,7 +180,7 @@
180180
" \n",
181181
" flow_status_box = widgets.VBox([\n",
182182
" widgets.HTML(\"<h3>Status</h3>\"),\n",
183-
" widgets.Button(description='\ud83d\udd04 Refresh', button_style='info'),\n",
183+
" widgets.Button(description='🔄 Refresh', button_style='info'),\n",
184184
" flow_status\n",
185185
" ], layout=widgets.Layout(min_width='350px', margin='0 0 0 20px'))\n",
186186
" \n",
@@ -190,7 +190,7 @@
190190
" # ===== HEATER TAB =====\n",
191191
" # Use Dropdown for heater selection\n",
192192
" heater_select = widgets.Dropdown(options=[0, 1, 2, 3], value=0, description='Heater:', style={'description_width': 'initial'})\n",
193-
" heater_temp = widgets.FloatSlider(value=25, min=0, max=100, step=0.1, description='Temp (\u00b0C):', style={'description_width': 'initial'})\n",
193+
" heater_temp = widgets.FloatSlider(value=25, min=0, max=100, step=0.1, description='Temp (°C):', style={'description_width': 'initial'})\n",
194194
" heater_pid = widgets.ToggleButton(value=False, description='PID Control', button_style='info')\n",
195195
" heater_stir = widgets.ToggleButton(value=False, description='Stirrer', button_style='info')\n",
196196
" heater_status = widgets.Output(layout=widgets.Layout(\n",
@@ -211,14 +211,14 @@
211211
" print(\"Current Heater States:\")\n",
212212
" for i, h in enumerate(state['heaters']):\n",
213213
" print(f\"\\n Heater {i}:\")\n",
214-
" print(f\" Temp: {h['temp_c_actual']:.1f}\u00b0C (target: {h['temp_c_target']:.1f}\u00b0C)\")\n",
214+
" print(f\" Temp: {h['temp_c_actual']:.1f}°C (target: {h['temp_c_target']:.1f}°C)\")\n",
215215
" print(f\" PID: {'ON' if h['pid_enabled'] else 'OFF'}\")\n",
216216
" print(f\" Stir: {'ON' if h['stir_enabled'] else 'OFF'}\")\n",
217217
" print(f\" Status: {h['status_text']}\")\n",
218218
" except Exception as e:\n",
219219
" with heater_status:\n",
220220
" clear_output()\n",
221-
" print(f\"\u274c Error: {e}\")\n",
221+
" print(f\" Error: {e}\")\n",
222222
" \n",
223223
" def create_heater_handler(param_name, setter_func):\n",
224224
" \"\"\"Create parameter handler for heater controls\"\"\"\n",
@@ -230,12 +230,12 @@
230230
" getattr(client, setter_func)(heater, value)\n",
231231
" with heater_status:\n",
232232
" clear_output()\n",
233-
" print(f\"\u2705 Updated {param_name} for heater {heater} to {value}\")\n",
233+
" print(f\" Updated {param_name} for heater {heater} to {value}\")\n",
234234
" update_heater_state()\n",
235235
" except Exception as e:\n",
236236
" with heater_status:\n",
237237
" clear_output()\n",
238-
" print(f\"\u274c Error updating {param_name}: {e}\")\n",
238+
" print(f\" Error updating {param_name}: {e}\")\n",
239239
" return handler\n",
240240
" \n",
241241
" def on_heater_select(change):\n",
@@ -251,7 +251,7 @@
251251
" update_heater_state()\n",
252252
" except Exception as e:\n",
253253
" with heater_status:\n",
254-
" print(f\"\u274c Error loading heater {change['new']}: {e}\")\n",
254+
" print(f\" Error loading heater {change['new']}: {e}\")\n",
255255
" \n",
256256
" heater_select.observe(on_heater_select, names='value')\n",
257257
" heater_temp.observe(create_heater_handler('temperature', 'set_heater_temp'), 'value')\n",
@@ -267,35 +267,35 @@
267267
" \n",
268268
" heater_status_box = widgets.VBox([\n",
269269
" widgets.HTML(\"<h3>Status</h3>\"),\n",
270-
" widgets.Button(description='\ud83d\udd04 Refresh', button_style='info'),\n",
270+
" widgets.Button(description='🔄 Refresh', button_style='info'),\n",
271271
" heater_status\n",
272272
" ], layout=widgets.Layout(min_width='350px', margin='0 0 0 20px'))\n",
273273
" \n",
274274
" heater_tab = widgets.HBox([heater_basic, heater_status_box])\n",
275275
" heater_tab.children[1].children[1].on_click(lambda b: update_heater_state())\n",
276276
" \n",
277277
" # ===== CAMERA/STROBE TAB =====\n",
278-
" stream_btn = widgets.ToggleButton(value=False, description='\u25b6 Start Camera', button_style='success')\n",
279-
" capture_btn = widgets.Button(description='\ud83d\udcf8 Capture Image', button_style='success')\n",
278+
" stream_btn = widgets.ToggleButton(value=False, description=' Start Camera', button_style='success')\n",
279+
" capture_btn = widgets.Button(description='📸 Capture Image', button_style='success')\n",
280280
" save_container = widgets.Output()\n",
281-
" enable_btn = widgets.ToggleButton(value=False, description='\u23fb Enable Strobe', button_style='success')\n",
282-
" period = widgets.FloatSlider(min=1, max=10000, step=1, value=50, description='Period (\u00b5s):', style={'description_width': 'initial'})\n",
283-
" width = widgets.FloatSlider(min=0.1, max=1000, step=0.1, value=0.1, description='Width (\u00b5s):', style={'description_width': 'initial'})\n",
284-
" hold_btn = widgets.ToggleButton(value=False, description='\ud83d\udd06 Hold Mode')\n",
281+
" enable_btn = widgets.ToggleButton(value=False, description=' Enable Strobe', button_style='success')\n",
282+
" period = widgets.FloatSlider(min=1, max=10000, step=1, value=50, description='Period (µs):', style={'description_width': 'initial'})\n",
283+
" width = widgets.FloatSlider(min=0.1, max=1000, step=0.1, value=0.1, description='Width (µs):', style={'description_width': 'initial'})\n",
284+
" hold_btn = widgets.ToggleButton(value=False, description='🔆 Hold Mode')\n",
285285
" stream_container = widgets.Output(layout=widgets.Layout(width='400px', height='300px'))\n",
286286
" captured_container = widgets.Output(layout=widgets.Layout(width='400px', height='300px'))\n",
287287
" \n",
288288
" def toggle_stream(change):\n",
289289
" if change['name'] == 'value':\n",
290290
" if change['new']:\n",
291-
" stream_btn.description = '\u23f9 Stop Camera'\n",
291+
" stream_btn.description = ' Stop Camera'\n",
292292
" stream_btn.button_style = 'danger'\n",
293293
" with stream_container:\n",
294294
" clear_output()\n",
295295
" # Note: MJPEG stream endpoint would go here if available\n",
296296
" display(HTML('<div style=\"width:400px; height:300px; border:2px solid #4CAF50; border-radius:4px; display:flex; align-items:center; justify-content:center;\">Camera Stream (MJPEG endpoint not yet available)</div>'))\n",
297297
" else:\n",
298-
" stream_btn.description = '\u25b6 Start Camera'\n",
298+
" stream_btn.description = ' Start Camera'\n",
299299
" stream_btn.button_style = 'success'\n",
300300
" with stream_container:\n",
301301
" clear_output()\n",
@@ -316,17 +316,17 @@
316316
" download=\"capture_{timestamp}.jpg\"\n",
317317
" style=\"padding: 6px 12px; background-color: #4CAF50; color: white; \n",
318318
" text-decoration: none; border-radius: 4px; display: inline-block;\">\n",
319-
" \ud83d\udcbe Save Image\n",
319+
" 💾 Save Image\n",
320320
" </a>\n",
321321
" \"\"\"))\n",
322322
" with status_output:\n",
323-
" print(\"\u2705 Image captured! Click 'Save Image' to download.\")\n",
323+
" print(\" Image captured! Click 'Save Image' to download.\")\n",
324324
" else:\n",
325325
" with status_output:\n",
326-
" print(\"\u274c No image data received\")\n",
326+
" print(\" No image data received\")\n",
327327
" except Exception as e:\n",
328328
" with status_output:\n",
329-
" print(f\"\u274c Error capturing image: {e}\")\n",
329+
" print(f\" Error capturing image: {e}\")\n",
330330
" \n",
331331
" def update_strobe(change=None):\n",
332332
" try:\n",
@@ -338,15 +338,15 @@
338338
" client.set_strobe_hold(hold_btn.value)\n",
339339
" except Exception as e:\n",
340340
" with status_output:\n",
341-
" print(f\"\u274c Error updating strobe: {e}\")\n",
341+
" print(f\" Error updating strobe: {e}\")\n",
342342
" \n",
343343
" def on_strobe_toggle(change):\n",
344344
" if change['name'] == 'value':\n",
345345
" if change['new']:\n",
346-
" enable_btn.description = '\u23f9 Disable Strobe'\n",
346+
" enable_btn.description = ' Disable Strobe'\n",
347347
" enable_btn.button_style = 'danger'\n",
348348
" else:\n",
349-
" enable_btn.description = '\u23fb Enable Strobe'\n",
349+
" enable_btn.description = ' Enable Strobe'\n",
350350
" enable_btn.button_style = 'success'\n",
351351
" update_strobe()\n",
352352
" \n",
@@ -408,7 +408,7 @@
408408
" )\n",
409409
" pump_state = widgets.ToggleButton(\n",
410410
" value=False,\n",
411-
" description=\"\u25b6 Run\",\n",
411+
" description=\" Run\",\n",
412412
" button_style=\"success\",\n",
413413
" )\n",
414414
" pump_unit = widgets.Dropdown(\n",
@@ -457,7 +457,7 @@
457457
" with pump_status:\n",
458458
" clear_output()\n",
459459
" if pump_api is None:\n",
460-
" print(\"\u26a0\ufe0f Pump API not configured\")\n",
460+
" print(\"⚠️ Pump API not configured\")\n",
461461
" return\n",
462462
" try:\n",
463463
" pump_refreshing[\"active\"] = True\n",
@@ -473,7 +473,7 @@
473473
" pump_direction.value = \"infuse\" if int(state[\"direction\"]) >= 0 else \"withdraw\"\n",
474474
" if state.get(\"state\") is not None:\n",
475475
" pump_state.value = bool(state[\"state\"])\n",
476-
" pump_state.description = \"\u23f9 Stop\" if pump_state.value else \"\u25b6 Run\"\n",
476+
" pump_state.description = \" Stop\" if pump_state.value else \" Run\"\n",
477477
" pump_state.button_style = \"danger\" if pump_state.value else \"success\"\n",
478478
" if state.get(\"unit\"):\n",
479479
" pump_unit.value = state[\"unit\"]\n",
@@ -488,7 +488,7 @@
488488
" pump_enable.description = \"Enabled\" if pump_enable.value else \"Disabled\"\n",
489489
" pump_enable.button_style = \"success\" if pump_enable.value else \"warning\"\n",
490490
" except Exception as e:\n",
491-
" print(f\"\u274c Pump state error: {e}\")\n",
491+
" print(f\" Pump state error: {e}\")\n",
492492
" finally:\n",
493493
" pump_refreshing[\"active\"] = False\n",
494494
"\n",
@@ -503,7 +503,7 @@
503503
" except Exception as e:\n",
504504
" with pump_status:\n",
505505
" clear_output()\n",
506-
" print(f\"\u274c Failed to set flow: {e}\")\n",
506+
" print(f\" Failed to set flow: {e}\")\n",
507507
"\n",
508508
" def on_pump_diameter(change):\n",
509509
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -516,7 +516,7 @@
516516
" except Exception as e:\n",
517517
" with pump_status:\n",
518518
" clear_output()\n",
519-
" print(f\"\u274c Failed to set diameter: {e}\")\n",
519+
" print(f\" Failed to set diameter: {e}\")\n",
520520
"\n",
521521
" def on_pump_direction(change):\n",
522522
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -529,12 +529,12 @@
529529
" except Exception as e:\n",
530530
" with pump_status:\n",
531531
" clear_output()\n",
532-
" print(f\"\u274c Failed to set direction: {e}\")\n",
532+
" print(f\" Failed to set direction: {e}\")\n",
533533
"\n",
534534
" def on_pump_state(change):\n",
535535
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
536536
" return\n",
537-
" pump_state.description = \"\u23f9 Stop\" if change[\"new\"] else \"\u25b6 Run\"\n",
537+
" pump_state.description = \" Stop\" if change[\"new\"] else \" Run\"\n",
538538
" pump_state.button_style = \"danger\" if change[\"new\"] else \"success\"\n",
539539
" if pump_api is None:\n",
540540
" return\n",
@@ -544,7 +544,7 @@
544544
" except Exception as e:\n",
545545
" with pump_status:\n",
546546
" clear_output()\n",
547-
" print(f\"\u274c Failed to set state: {e}\")\n",
547+
" print(f\" Failed to set state: {e}\")\n",
548548
"\n",
549549
" def on_pump_unit(change):\n",
550550
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -557,7 +557,7 @@
557557
" except Exception as e:\n",
558558
" with pump_status:\n",
559559
" clear_output()\n",
560-
" print(f\"\u274c Failed to set unit: {e}\")\n",
560+
" print(f\" Failed to set unit: {e}\")\n",
561561
"\n",
562562
" def on_pump_gearbox(change):\n",
563563
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -570,7 +570,7 @@
570570
" except Exception as e:\n",
571571
" with pump_status:\n",
572572
" clear_output()\n",
573-
" print(f\"\u274c Failed to set gearbox: {e}\")\n",
573+
" print(f\" Failed to set gearbox: {e}\")\n",
574574
"\n",
575575
" def on_pump_microstep(change):\n",
576576
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -583,7 +583,7 @@
583583
" except Exception as e:\n",
584584
" with pump_status:\n",
585585
" clear_output()\n",
586-
" print(f\"\u274c Failed to set microstep: {e}\")\n",
586+
" print(f\" Failed to set microstep: {e}\")\n",
587587
"\n",
588588
" def on_pump_threadrod(change):\n",
589589
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -596,7 +596,7 @@
596596
" except Exception as e:\n",
597597
" with pump_status:\n",
598598
" clear_output()\n",
599-
" print(f\"\u274c Failed to set thread rod: {e}\")\n",
599+
" print(f\" Failed to set thread rod: {e}\")\n",
600600
"\n",
601601
" def on_pump_enable(change):\n",
602602
" if change[\"name\"] != \"value\" or pump_refreshing[\"active\"]:\n",
@@ -611,7 +611,7 @@
611611
" except Exception as e:\n",
612612
" with pump_status:\n",
613613
" clear_output()\n",
614-
" print(f\"\u274c Failed to set enable: {e}\")\n",
614+
" print(f\" Failed to set enable: {e}\")\n",
615615
"\n",
616616
" pump_select.observe(lambda change: refresh_pump_state(), names=\"value\")\n",
617617
" pump_flow.observe(on_pump_flow, names=\"value\")\n",
@@ -638,7 +638,7 @@
638638
" pump_microstep,\n",
639639
" pump_threadrod,\n",
640640
" pump_enable,\n",
641-
" widgets.Button(description=\"\ud83d\udd04 Refresh\", button_style=\"info\"),\n",
641+
" widgets.Button(description=\"🔄 Refresh\", button_style=\"info\"),\n",
642642
" ]\n",
643643
" )\n",
644644
" pump_controls.children[-1].on_click(lambda b: refresh_pump_state())\n",
@@ -683,13 +683,13 @@
683683
" \n",
684684
" with emergency_status:\n",
685685
" clear_output()\n",
686-
" print(\"\ud83d\uded1 EMERGENCY STOP: All operations stopped\")\n",
686+
" print(\"🛑 EMERGENCY STOP: All operations stopped\")\n",
687687
" print(\" - All flow channels set to 0\")\n",
688688
" print(\" - All heaters disabled\")\n",
689689
" print(\" - Strobe disabled\")\n",
690690
" except Exception as e:\n",
691691
" with emergency_status:\n",
692-
" print(f\"\u274c Emergency stop error: {e}\")\n",
692+
" print(f\" Emergency stop error: {e}\")\n",
693693
" \n",
694694
" emergency_btn.on_click(emergency_stop)\n",
695695
" \n",

0 commit comments

Comments
 (0)