Skip to content

Commit 2d3f97e

Browse files
Merge branch 'develop' into abstract-z-stack-acquisition
2 parents 2fa0cd7 + b5b2c61 commit 2d3f97e

File tree

7 files changed

+307
-133
lines changed

7 files changed

+307
-133
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,4 @@ test.xml
298298
*_log.txt
299299
/docs/source/05_reference/_autosummary
300300
/docs/source/05_reference/_autosummary
301+
codex.md

src/navigate/controller/sub_controllers/acquire_bar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,10 @@ def progress_bar(
160160
if microscope_state["is_multiposition"] is False:
161161
number_of_positions = 1
162162
else:
163+
# The first row is a header that describes stage axis designation.
163164
number_of_positions = len(
164165
self.parent_controller.configuration["multi_positions"]
165-
)
166+
) - 1
166167

167168
if mode == "single":
168169
number_of_slices = 1

src/navigate/model/device_startup_functions.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ def start_device(
325325
Index of device in the configuration dictionary. Default is 0.
326326
is_synthetic : bool
327327
Run synthetic version of hardware. Default is False.
328+
daq_connection: Optional[Any]
329+
Data acquisition connection. Default is None.
328330
plugin_devices : Optional[Dict]
329331
Dictionary of plugin devices. Default is None.
330332
@@ -371,26 +373,35 @@ def start_device(
371373
if is_synthetic or device_type.lower().startswith("synthetic"):
372374
device_type = "Synthetic"
373375
elif device_type.endswith(class_name_suffix):
374-
device_type = device_type[:-len(class_name_suffix)]
376+
device_type = device_type[: -len(class_name_suffix)]
375377

376378
# device type naming rules: manufacturer(file_name).device_model
377-
# if the device is currrently supported in Navigate, you can use device_model as device type.
379+
# if the device is currently supported in Navigate, you can use device_model as the
380+
# device type.
378381
if "." in device_type:
379382
device_manufacturer, device_type = device_type.split(".")[:2]
380383
elif device_type in temp_device_ref:
381384
device_manufacturer = temp_device_ref[device_type]
382385
else:
383386
device_manufacturer = None
384387

385-
if device_manufacturer is not None and importlib.util.find_spec(f"navigate.model.devices.{device_category}.{device_manufacturer}"):
388+
if device_manufacturer is not None and importlib.util.find_spec(
389+
f"navigate.model.devices.{device_category}.{device_manufacturer}"
390+
):
386391
module = importlib.import_module(
387392
f"navigate.model.devices.{device_category}.{device_manufacturer}"
388393
)
389394
try:
390395
_class = getattr(module, device_type + class_name_suffix)
391396
except (KeyError, AttributeError):
392-
logger.error(f"There is no device class {device_type + class_name_suffix} in the file: {device_manufacturer}.py")
393-
return device_not_found(microscope_name, device_category, device_type, device_id)
397+
logger.error(
398+
f"There is no device class {device_type + class_name_suffix} in the file: {device_manufacturer}.py"
399+
)
400+
return device_not_found(
401+
microscope_name, device_category, device_type, device_id
402+
)
403+
404+
# Load serial devices via the SerialDevice factory.
394405
if issubclass(_class, SerialDevice):
395406
device_connection = SerialConnectionFactory.build_connection(
396407
_class.connect,
@@ -401,6 +412,8 @@ def start_device(
401412
),
402413
exception=Exception,
403414
)
415+
416+
# Load integrated devices via the IntegratedDevice factory.
404417
elif issubclass(_class, IntegratedDevice):
405418
# get connection parameters
406419
connection_params = []
@@ -459,25 +472,31 @@ def start_device(
459472
elif device_category in plugin_devices:
460473
# device_category in ["stage", "shutter", "filter_wheel", "remote_focus", "camera", "galvo", "zoom", "laser"]
461474
if device_category == "stage":
462-
hardware_configuration = configuration["configuration"]["microscopes"][microscope_name][
463-
device_category]["hardware"][device_id]
475+
hardware_configuration = configuration["configuration"]["microscopes"][
476+
microscope_name
477+
][device_category]["hardware"][device_id]
464478
else:
465-
hardware_configuration = configuration["configuration"]["microscopes"][microscope_name][
466-
device_category][device_id]["hardware"]
479+
hardware_configuration = configuration["configuration"]["microscopes"][
480+
microscope_name
481+
][device_category][device_id]["hardware"]
467482
# find the device in plugins
468483
if device_type + class_name_suffix in plugin_devices[device_category]:
469484
device_type += class_name_suffix
470485
elif device_type not in plugin_devices[device_category]:
471486
device_not_found(microscope_name, device_category, device_type, device_id)
472-
487+
473488
try:
474-
475-
device_connection = plugin_devices[device_category][device_type]["load_device"](
489+
490+
device_connection = plugin_devices[device_category][device_type][
491+
"load_device"
492+
](
476493
hardware_configuration,
477494
is_synthetic,
478-
device_type = device_category,
495+
device_type=device_category,
479496
)
480-
start_function = plugin_devices[device_category][device_type]["start_device"]
497+
start_function = plugin_devices[device_category][device_type][
498+
"start_device"
499+
]
481500
return start_function(
482501
microscope_name,
483502
device_connection,
@@ -487,8 +506,10 @@ def start_device(
487506
device_type=device_category,
488507
)
489508
except RuntimeError:
490-
print(f"{device_category}:{device_type} can't be loaded correctly, "
491-
f"make sure you have specify SUPPORTED_DEVICE_TYPES in your plugin!")
509+
print(
510+
f"{device_category}:{device_type} can't be loaded correctly, "
511+
f"make sure you have specify SUPPORTED_DEVICE_TYPES in your plugin!"
512+
)
492513
device_not_found(microscope_name, device_category, device_type, device_id)
493514

494515

src/navigate/model/devices/laser/ni.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,16 @@ def set_power(self, laser_intensity: float) -> None:
211211

212212
def turn_on(self) -> None:
213213
"""Turns on the laser."""
214+
215+
# Set analog modulation.
214216
self.set_power(self._current_intensity)
215217

218+
# If analog only modulation.
216219
if self.laser_do_task is None:
217220
return
221+
222+
# Set digital modulation. Can be analog or digital output type.
223+
# E.g., AO port can be analog or digital. DO can only be digital.
218224
try:
219225
if self.digital_port_type == "digital":
220226
self.laser_do_task.write(True, auto_start=True)

0 commit comments

Comments
 (0)