Skip to content

Commit 0e7d16b

Browse files
committed
fixing tests
1 parent 992a4ba commit 0e7d16b

5 files changed

Lines changed: 137 additions & 21 deletions

File tree

asyncroscopy/Microscope.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def get_scanned_image(self) -> tuple[str, bytes]:
237237
"dtype": str(image.dtype),
238238
"dwell_time": dwell_time,
239239
"timestamp": time.time(),
240-
"fov": self._get_fov(),
241240
# TODO: add metadata from adorned_image.metadata when using real AutoScript
242241
}
243242

@@ -280,7 +279,6 @@ def get_camera_image(self) -> tuple[str, bytes]:
280279
"dtype": str(image.dtype),
281280
"exposure_time": exposure_time,
282281
"timestamp": time.time(),
283-
"fov": self._get_fov(),
284282
"readout_area": readout_area,
285283
# TODO: move this metadata packing into the _acquire_camera_image method
286284
# when usingreal AutoScript,to include metadata from adorned_image.metadata

notebooks/12_Scan_Blast.ipynb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
"savefile_path = '/Users/austin/Desktop/2026_04_21_scanBlast/'\n"
1717
]
1818
},
19-
{
20-
"cell_type": "code",
21-
"execution_count": null,
22-
"metadata": {},
23-
"outputs": [],
24-
"source": []
25-
},
2619
{
2720
"cell_type": "code",
2821
"execution_count": 1,

notebooks/2_Aberrations.ipynb

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
],
8080
"source": [
8181
"# ── Config ────────────────────────────────────────────────────────────────────\n",
82-
"DB_HOST = \"localhost\"\n",
83-
"DB_PORT = 11000\n",
82+
"DB_HOST = \"10.46.217.241\"\n",
83+
"DB_PORT = 9094\n",
8484
"server_list = [(\"corrector\", \"asyncroscopy.hardware.CORRECTOR\")]\n",
8585
"# ─────────────────────────────────────────────────────────────────────────────\n",
8686
"\n",
@@ -155,10 +155,62 @@
155155
{
156156
"cell_type": "code",
157157
"execution_count": null,
158+
"id": "d49340d0",
159+
"metadata": {},
160+
"outputs": [],
161+
"source": [
162+
"import tango\n",
163+
"\n",
164+
"db = tango.Database()\n",
165+
"print(db.get_server_list(\"CORRECTOR/*\"))\n",
166+
"d = tango.DeviceProxy(\"dserver/'CORRECTOR/corrector_instance'\")\n",
167+
"d.command_inout(\"Kill\")"
168+
]
169+
},
170+
{
171+
"cell_type": "code",
172+
"execution_count": 17,
158173
"id": "e7a1f3f0",
159174
"metadata": {},
175+
"outputs": [
176+
{
177+
"data": {
178+
"text/plain": [
179+
"DbDevFullInfo(class_name = 'CORRECTOR', ds_full_name = 'CORRECTOR/corrector_instance', exported = 1, host = 'stingray-zm68g.device.utk.edu', ior = 'IOR:010000001700000049444c3a54616e676f2f4465766963655f363a312e3000000100000000000000de000000010102000e0000003231362e39362e3137392e3232008bd40e000000fec769ea690000bd06000000000000000400000000000000080000000100000000545441010000001c000000010000000100010001000000010001050901010001000000090101000300000018000000010000000d00000031302e36352e31342e32313100008bd40254544152000000010000001e0000007374696e677261792d7a6d3638672e6465766963652e75746b2e656475000000260000002f746d702f6f6d6e692d61757374696e2f3030303034383339302d3137373639373031383300', name = 'test/corrector/1', pid = 48390, started_date = '23-04-2026 at 14:49:43', stopped_date = '', version = '6')"
180+
]
181+
},
182+
"execution_count": 17,
183+
"metadata": {},
184+
"output_type": "execute_result"
185+
}
186+
],
187+
"source": [
188+
"db = tango.Database()\n",
189+
"\n",
190+
"info = db.get_device_info(\"test/corrector/1\")\n",
191+
"info"
192+
]
193+
},
194+
{
195+
"cell_type": "code",
196+
"execution_count": null,
197+
"id": "021ade07",
198+
"metadata": {},
160199
"outputs": [],
161-
"source": []
200+
"source": [
201+
"db = tango.Database()\n",
202+
"active_servers = db.get_server_list(\"*\").value_string\n",
203+
"active_servers\n",
204+
"\n",
205+
"for server in active_servers:\n",
206+
" try:\n",
207+
" d = tango.DeviceProxy(f\"dserver/{server}\")\n",
208+
" d.ping()\n",
209+
" d.command_inout(\"Kill\")\n",
210+
" print(f'pinged {server}')\n",
211+
" except:\n",
212+
" pass\n"
213+
]
162214
},
163215
{
164216
"cell_type": "markdown",
@@ -170,7 +222,7 @@
170222
},
171223
{
172224
"cell_type": "code",
173-
"execution_count": 5,
225+
"execution_count": 18,
174226
"id": "0dfec932",
175227
"metadata": {},
176228
"outputs": [
@@ -261,14 +313,14 @@
261313
},
262314
{
263315
"cell_type": "code",
264-
"execution_count": 7,
316+
"execution_count": 14,
265317
"id": "a8e3fd71",
266318
"metadata": {},
267319
"outputs": [
268320
{
269321
"data": {
270322
"application/vnd.jupyter.widget-view+json": {
271-
"model_id": "b29a9bd0465149bb9c76ddde925c3d83",
323+
"model_id": "d477638d42884f9ba34af0c76e2515f9",
272324
"version_major": 2,
273325
"version_minor": 0
274326
},
@@ -282,7 +334,7 @@
282334
{
283335
"data": {
284336
"application/vnd.jupyter.widget-view+json": {
285-
"model_id": "34397457cfd2445ab42132f65264f0ee",
337+
"model_id": "1c4f2cbc34664eb4866772e25b608760",
286338
"version_major": 2,
287339
"version_minor": 0
288340
},

notebooks/3_Sample_map.ipynb

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 1,
21+
"execution_count": 2,
2222
"id": "efc9151c",
2323
"metadata": {},
2424
"outputs": [],
@@ -47,15 +47,19 @@
4747
"Starting Tango Database...\n",
4848
" Waiting for database.... ✅ ready\n",
4949
"Registering devices...\n",
50-
"Connected: stingray-zm68g.device.utk.edu:11000\n",
50+
"Connected: 216.96.179.201:9094\n",
5151
"\n",
5252
" registered: test/scan/1\n",
53+
" registered: test/camera/1\n",
5354
" registered: test/eds/1\n",
5455
" registered: test/stage/1\n",
56+
" registered: test/corrector/1\n",
5557
" registered: test/microscope/1\n",
5658
" property: scan_device_address = test/scan/1\n",
59+
" property: camera_device_address = test/camera/1\n",
5760
" property: eds_device_address = test/eds/1\n",
5861
" property: stage_device_address = test/stage/1\n",
62+
" property: corrector_device_address = test/corrector/1\n",
5963
"\n",
6064
"Done!\n",
6165
"Starting device servers...\n",
@@ -71,8 +75,8 @@
7175
],
7276
"source": [
7377
"# ── Config ────────────────────────────────────────────────────────────────────\n",
74-
"DB_HOST = \"localhost\"\n",
75-
"DB_PORT = 11000\n",
78+
"DB_HOST = \"10.46.217.241\"\n",
79+
"DB_PORT = 9094\n",
7680
"server_list = [(\"stage\", \"asyncroscopy.hardware.STAGE\"),\n",
7781
" (\"scan\", \"asyncroscopy.hardware.SCAN\"),\n",
7882
" (\"eds\", \"asyncroscopy.detectors.EDS\")]\n",
@@ -118,7 +122,7 @@
118122
"print(f\"Project dir: {PROJECT_DIR}\\nStarting Tango Database...\")\n",
119123
"processes[\"database\"] = popen([\"uv\", \"run\", \"python\", \"-m\", \"tango.databaseds.database\", \"2\"])\n",
120124
"print(\" Waiting for database...\", end=\"\", flush=True)\n",
121-
"for _ in range(30):\n",
125+
"for _ in range(60):\n",
122126
" try: tango.Database(DB_HOST, DB_PORT); print(\" ✅ ready\"); break\n",
123127
" except: print(\".\", end=\"\", flush=True); time.sleep(1)\n",
124128
"\n",
@@ -146,6 +150,75 @@
146150
"print(\"\\n✅ All servers ready!\")"
147151
]
148152
},
153+
{
154+
"cell_type": "code",
155+
"execution_count": 4,
156+
"id": "5a8bf3d9",
157+
"metadata": {},
158+
"outputs": [
159+
{
160+
"name": "stdout",
161+
"output_type": "stream",
162+
"text": [
163+
"['dserver/CAMERA/camera_instance', 'dserver/CORRECTOR/corrector_instance', 'dserver/DataBaseds/2', 'dserver/EDS/eds_instance', 'dserver/SCAN/scan_instance', 'dserver/STAGE/stage_instance', 'dserver/TangoAccessControl/1', 'dserver/TangoTest/test', 'dserver/ThermoMicroscope/microscope_instance', 'sys/access_control/1', 'sys/database/2', 'sys/tg_test/1', 'test/camera/1', 'test/corrector/1', 'test/eds/1', 'test/microscope/1', 'test/scan/1', 'test/stage/1']\n"
164+
]
165+
}
166+
],
167+
"source": [
168+
"DB_HOST = \"10.46.217.241\"\n",
169+
"DB_PORT = 9094\n",
170+
"\n",
171+
"PROJECT_DIR = os.path.dirname(os.getcwd())\n",
172+
"os.environ[\"TANGO_HOST\"] = f\"{DB_HOST}:{DB_PORT}\"\n",
173+
"env = {**os.environ, \"TANGO_HOST\": f\"{DB_HOST}:{DB_PORT}\"}\n",
174+
"\n",
175+
"db = tango.Database()\n",
176+
"devices = db.get_device_name(\"*\", \"*\").value_string\n",
177+
"print(devices)"
178+
]
179+
},
180+
{
181+
"cell_type": "code",
182+
"execution_count": null,
183+
"id": "58c7aa30",
184+
"metadata": {},
185+
"outputs": [],
186+
"source": []
187+
},
188+
{
189+
"cell_type": "code",
190+
"execution_count": null,
191+
"id": "a5cc655a",
192+
"metadata": {},
193+
"outputs": [],
194+
"source": [
195+
"\n",
196+
"server_list = [(\"stage\", \"asyncroscopy.hardware.STAGE\"),\n",
197+
" (\"scan\", \"asyncroscopy.hardware.SCAN\"),\n",
198+
" (\"eds\", \"asyncroscopy.detectors.EDS\")]\n",
199+
"# ─────────────────────────────────────────────────────────────────────────────\n",
200+
" \n",
201+
"print(\"deleting devices\")\n",
202+
"for dev in db.get_device_name(\"*\", \"*\").value_string:\n",
203+
" print(dev)\n",
204+
" db.delete_device(dev)\n",
205+
"\n",
206+
"print(\"deleting servers\")\n",
207+
"for srv in db.get_server_list(\"*\").value_string:\n",
208+
" print(srv)\n",
209+
" db.delete_server(srv)"
210+
]
211+
},
212+
{
213+
"cell_type": "code",
214+
"execution_count": null,
215+
"id": "1bc2cafd",
216+
"metadata": {},
217+
"outputs": [],
218+
"source": [
219+
"216.96.179.201"
220+
]
221+
},
149222
{
150223
"cell_type": "markdown",
151224
"id": "fa93c1d9",

tango_database.db

4 KB
Binary file not shown.

0 commit comments

Comments
 (0)