Skip to content

Commit 963fae0

Browse files
Merge pull request #908 from TheDeanLab/updated_ni_filter_wheel
Updated ni filter wheel
2 parents f77ffba + de93405 commit 963fae0

File tree

7 files changed

+1281
-1004
lines changed

7 files changed

+1281
-1004
lines changed

src/navigate/model/device_startup_functions.py

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ def start_camera(
257257
for start_function in plugin_devices["camera"]["start_device"]:
258258
try:
259259
return start_function(
260-
microscope_name, device_connection, configuration, is_synthetic,
261-
device_type="camera"
260+
microscope_name,
261+
device_connection,
262+
configuration,
263+
is_synthetic,
264+
device_type="camera",
262265
)
263266
except RuntimeError:
264267
continue
@@ -439,6 +442,19 @@ def load_stages(configuration, is_synthetic=False, plugin_devices={}):
439442
)
440443
)
441444

445+
elif stage_type == "KST101":
446+
from navigate.model.devices.stages.stage_tl_kcube_steppermotor import (
447+
build_TLKSTStage_connection,
448+
)
449+
450+
stage_devices.append(
451+
auto_redial(
452+
build_TLKSTStage_connection,
453+
(stage_config["serial_number"],),
454+
exception=Exception,
455+
)
456+
)
457+
442458
elif stage_type == "MCL" and platform.system() == "Windows":
443459
from navigate.model.devices.stages.stage_mcl import (
444460
build_MCLStage_connection,
@@ -633,12 +649,12 @@ def start_stage(
633649
from navigate.model.devices.stages.stage_tl_kcube_inertial import TLKIMStage
634650

635651
return TLKIMStage(microscope_name, device_connection, configuration, id)
636-
652+
637653
elif device_type == "KST101":
638654
from navigate.model.devices.stages.stage_tl_kcube_steppermotor import TLKSTStage
639655

640656
return TLKSTStage(microscope_name, device_connection, configuration, id)
641-
657+
642658
elif device_type == "MCL":
643659
from navigate.model.devices.stages.stage_mcl import MCLStage
644660

@@ -674,8 +690,12 @@ def start_stage(
674690
for start_function in plugin_devices["stage"]["start_device"]:
675691
try:
676692
return start_function(
677-
microscope_name, device_connection, configuration, is_synthetic,
678-
device_type="stage", id=id
693+
microscope_name,
694+
device_connection,
695+
configuration,
696+
is_synthetic,
697+
device_type="stage",
698+
id=id,
679699
)
680700
except RuntimeError:
681701
continue
@@ -801,8 +821,11 @@ def start_zoom(
801821
for start_zoom in plugin_devices["zoom"]["start_device"]:
802822
try:
803823
return start_zoom(
804-
microscope_name, device_connection, configuration, is_synthetic,
805-
device_type="zoom"
824+
microscope_name,
825+
device_connection,
826+
configuration,
827+
is_synthetic,
828+
device_type="zoom",
806829
)
807830
except RuntimeError:
808831
continue
@@ -872,6 +895,9 @@ def load_filter_wheel_connection(configuration, is_synthetic=False, plugin_devic
872895
)
873896
return tiger_controller
874897

898+
elif device_type == "NI":
899+
return DummyDeviceConnection()
900+
875901
elif (
876902
device_type.lower() == "syntheticfilterwheel"
877903
or device_type.lower() == "synthetic"
@@ -888,6 +914,7 @@ def load_filter_wheel_connection(configuration, is_synthetic=False, plugin_devic
888914
except RuntimeError:
889915
continue
890916
device_not_found("filter_wheel", device_type)
917+
891918
else:
892919
device_not_found("filter_wheel", device_type)
893920

@@ -956,6 +983,11 @@ def start_filter_wheel(
956983

957984
return ASIFilterWheel(microscope_name, device_connection, configuration)
958985

986+
elif device_type == "NI":
987+
from navigate.model.devices.filter_wheel.filter_wheel_daq import DAQFilterWheel
988+
989+
return DAQFilterWheel(microscope_name, device_connection, configuration)
990+
959991
elif (
960992
device_type.lower() == "syntheticfilterwheel"
961993
or device_type.lower() == "synthetic"
@@ -967,16 +999,19 @@ def start_filter_wheel(
967999
return SyntheticFilterWheel(microscope_name, device_connection, configuration)
9681000

9691001
elif "filter_wheel" in plugin_devices:
970-
9711002
for start_function in plugin_devices["filter_wheel"]["start_device"]:
9721003
try:
9731004
return start_function(
974-
microscope_name, device_connection, configuration, is_synthetic,
975-
device_type="filter_wheel"
1005+
microscope_name,
1006+
device_connection,
1007+
configuration,
1008+
is_synthetic,
1009+
device_type="filter_wheel",
9761010
)
9771011
except RuntimeError:
9781012
continue
9791013
device_not_found(microscope_name, "filter_wheel", device_type)
1014+
9801015
else:
9811016
device_not_found(microscope_name, "filter_wheel", device_type)
9821017

@@ -1089,8 +1124,11 @@ def start_shutter(
10891124
for start_function in plugin_devices["shutter"]["start_device"]:
10901125
try:
10911126
return start_function(
1092-
microscope_name, None, configuration, is_synthetic,
1093-
device_type="shutter"
1127+
microscope_name,
1128+
None,
1129+
configuration,
1130+
is_synthetic,
1131+
device_type="shutter",
10941132
)
10951133
except RuntimeError:
10961134
continue
@@ -1162,7 +1200,12 @@ def start_lasers(
11621200
for start_function in plugin_devices["lasers"]["start_device"]:
11631201
try:
11641202
return start_function(
1165-
microscope_name, device_connection, configuration, is_synthetic, device_type="lasers", id=id
1203+
microscope_name,
1204+
device_connection,
1205+
configuration,
1206+
is_synthetic,
1207+
device_type="lasers",
1208+
id=id,
11661209
)
11671210
except RuntimeError:
11681211
continue
@@ -1216,14 +1259,12 @@ def start_remote_focus_device(
12161259

12171260
if device_type == "NI":
12181261
from navigate.model.devices.remote_focus.remote_focus_ni import RemoteFocusNI
1219-
12201262
return RemoteFocusNI(microscope_name, device_connection, configuration)
12211263

12221264
elif device_type == "EquipmentSolutions":
12231265
from navigate.model.devices.remote_focus.remote_focus_equipment_solutions import (
12241266
RemoteFocusEquipmentSolutions,
12251267
)
1226-
12271268
return RemoteFocusEquipmentSolutions(
12281269
microscope_name, device_connection, configuration
12291270
)
@@ -1243,8 +1284,11 @@ def start_remote_focus_device(
12431284
for start_function in plugin_devices["remote_focus_device"]["start_device"]:
12441285
try:
12451286
return start_function(
1246-
microscope_name, device_connection, configuration, is_synthetic,
1247-
device_type="remote_focus_device"
1287+
microscope_name,
1288+
device_connection,
1289+
configuration,
1290+
is_synthetic,
1291+
device_type="remote_focus_device",
12481292
)
12491293
except RuntimeError:
12501294
continue
@@ -1311,8 +1355,12 @@ def start_galvo(
13111355
for start_function in plugin_devices["galvo"]["start_device"]:
13121356
try:
13131357
return start_function(
1314-
microscope_name, device_connection, configuration, is_synthetic,
1315-
device_type="galvo", id=id
1358+
microscope_name,
1359+
device_connection,
1360+
configuration,
1361+
is_synthetic,
1362+
device_type="galvo",
1363+
id=id,
13161364
)
13171365
except RuntimeError:
13181366
continue
@@ -1411,14 +1459,6 @@ def load_devices(configuration, is_synthetic=False, plugin_devices={}) -> dict:
14111459
device_ref_name = build_ref_name("_", device["type"])
14121460
devices["mirror"][device_ref_name] = load_mirror(configuration, is_synthetic)
14131461

1414-
# load filter wheel
1415-
if "filter_wheel" in configuration["configuration"]["hardware"].keys():
1416-
devices["filter_wheel"] = {}
1417-
device = configuration["configuration"]["hardware"]["filter_wheel"]
1418-
devices["filter_wheel"][device["type"]] = load_filter_wheel_connection(
1419-
configuration, is_synthetic, plugin_devices
1420-
)
1421-
14221462
# load zoom
14231463
if "zoom" in configuration["configuration"]["hardware"].keys():
14241464
devices["zoom"] = {}
@@ -1432,6 +1472,14 @@ def load_devices(configuration, is_synthetic=False, plugin_devices={}) -> dict:
14321472
if "daq" in configuration["configuration"]["hardware"].keys():
14331473
devices["daq"] = start_daq(configuration, is_synthetic)
14341474

1475+
# load filter wheel
1476+
if "filter_wheel" in configuration["configuration"]["hardware"].keys():
1477+
devices["filter_wheel"] = {}
1478+
device = configuration["configuration"]["hardware"]["filter_wheel"]
1479+
devices["filter_wheel"][device["type"]] = load_filter_wheel_connection(
1480+
configuration, is_synthetic, plugin_devices
1481+
)
1482+
14351483
# load stage
14361484
if "stage" in configuration["configuration"]["hardware"].keys():
14371485
device_config = configuration["configuration"]["hardware"]["stage"]

0 commit comments

Comments
 (0)