error acquiring z-stack without "f" axis
Closed this issue · 0 comments
Bug Description
We are using an ASI MS2000 xyz stage without defining an "f" or "theta" axis. The single acquisition and continuous scan acquisition modes both worked without issues. However, when attempting to acquire a z-stack, we encountered a traceback indicating that there were no active channels selected when programming the DAQ ao waveform. The model debug log further indicated a KeyError related to the microscope configuration.
Steps to Reproduce
- Set up microscope configuration without an "f" axis mapping.
- Select at least 1 channel and set at least 2 z positions.
- Start z-stack acquisition.
- Observe error.
Expected Behavior
The error should be handled gracefully if no "f" axis exists in the microscope configuration.
**Traceback**
Traceback (most recent call last):
File "C:\Users\qi2lab\Documents\github\asi_navigate\navigate\src\navigate\model\devices\lasers\laser_ni.py", line 147, in set_power
self.laser_ao_task.write(scaled_laser_voltage, auto_start=True)
File "C:\Users\qi2lab\miniconda3\envs\ASInavigate\lib\site-packages\nidaqmx\task.py", line 1169, in write
channels_to_write = self.channels
File "C:\Users\qi2lab\miniconda3\envs\ASInavigate\lib\site-packages\nidaqmx\task.py", line 167, in channels
return Channel._factory(
File "C:\Users\qi2lab\miniconda3\envs\ASInavigate\lib\site-packages\nidaqmx\_task_modules\channels\channel.py", line 118, in _factory
check_for_error(error_code)
File "C:\Users\qi2lab\miniconda3\envs\ASInavigate\lib\site-packages\nidaqmx\errors.py", line 127, in check_for_error
raise DaqError(error_buffer.value.decode("utf-8"), error_code)
nidaqmx.errors.DaqError: Specified operation cannot be performed when there are no channels in the task.
Task Name: _unnamedTask<4>
Status Code: -200478
Logs and Configurations
model_error.log
model_info.log
model_performance.log
performance.log
view_controller_debug.log
view_controller_info.log
model_debug.log
Microscope configuration (cannot drag and drop)
microscopes:
Nanoscale:
daq:
hardware:
name: Dev2
type: NI
sample_rate: 100000
sweep_time: 0.2
# triggers
master_trigger_out_line: Dev2/port0/line8
camera_trigger_out_line: /Dev2/ctr0 # PFI12
trigger_source: /Dev2/PFI5
# Digital Laser Outputs
# TODO We have not added the lasers yet
laser_port_switcher: Dev2/port0/line0
laser_switch_state: False
camera:
hardware:
name: camera
type: Photometrics
serial_number: A17K631096
x_pixels: 5056.0
y_pixels: 2960.0
pixel_size_in_microns: 4.25
subsampling: [1, 2, 4]
sensor_mode: Normal
readout_direction: Bottom-to-Top
lightsheet_rolling_shutter_width: 608
defect_correct_mode: 2.0
binning: 1x1
readout_speed: 0x7FFFFFFF
readout_port: 0
gain: 1
speed_table_index: 0
trigger_active: 1.0
trigger_mode: 1.0
trigger_polarity: 2.0
trigger_source: 2.0
exposure_time: 20
delay_percent: 25
pulse_percent: 1
line_interval: 0.000075
display_acquisition_subsampling: 4
average_frame_rate: 4.969
frames_to_average: 1
exposure_time_range:
min: 1
max: 1000
step: 1
unitforlinedelay: 10.26
remote_focus_device:
hardware:
name: daq
type: NI
channel: Dev2/ao2
min: 0
max: 5
# FIXME: What is this?
# Optotune EL-16-40-TC-VIS-5D-1-C
delay_percent: 0 #1.5 #7.5
ramp_rising_percent: 85
ramp_falling_percent: 1.5 #2.5
amplitude: 0.7
offset: 2.3
galvo:
-
hardware:
name: daq
type: NI
channel: Dev2/ao0
min: 0
max: 5
frequency: 200
amplitude: 1.5
offset: 0
duty_cycle: 50
phase: 1.57079 # pi/2
filter_wheel:
hardware:
name: filter_wheel
type: NI #SyntheticFilterWheel
wheel_number: 1
filter_wheel_delay: 0.050 # in seconds
available_filters:
473nm: Dev2/port0/line1
561nm: Dev2/port0/line3
638nm: Dev2/port0/line5
Empty: Dev2/port0/line7
stage:
hardware:
-
name: stage
type: MS2000
serial_number: 1906420147517051597
axes: [x, y, z] # Software
axes_mapping: [X, Y, Z]
feedback_alignment: [90, 90, 90, 90]
-
name: synthetic
type: SyntheticStage
serial_number: 123
axes: [f, theta]
axes_mapping: [cucumber, xylophone]
volts_per_micron: None
axes_channels: None
max: None
min: None
startfocus: -16000
x_max: 10000 # Swapped from Z
x_min: -10000 # Swapped from Z
y_max: 10000
y_min: -10000
z_max: 10000 # Swapped from X
z_min: -10000 # Swapped from X
f_max: 0.0 #=m
f_min: -0.0 #=m
theta_max: 0
theta_min: 0
external_trigger: /Dev2/PFI0
# joystick_axes: [x, y, z, f]
x_rot_position: 0
y_rot_position: 0
z_rot_position: 0
x_step: 50
y_step: 50
z_step: 50
theta_step: 30
f_step: 50
position:
x_pos: 5 # Swapped from Z initial stage position
y_pos: 1
z_pos: 1 # Swapped from X
f_pos: 0
theta_pos: 0
velocity: 1000
x_offset: 0
y_offset: 0
z_offset: 0
f_offset: 0
theta_offset: 0
zoom:
hardware:
name: zoom
type: SyntheticZoom
servo_id: 1
position:
N/A: 0
pixel_size:
N/A: 0.168
shutter: # we can do this using the DAQ
hardware:
name: daq
type: NI
channel: Dev2/port0/line9 # 98 slot
min: 0
max: 5
lasers:
# Laser 473 wavelength
- wavelength: 473
onoff:
hardware:
name: daq
type: NI
channel: Dev2/port0/line0
min: 0
max: 5
power:
hardware:
name: daq
type: NI
channel: Dev2/ao1
min: 0
max: 5
type: LuxX
index: 0
delay_percent: 10
pulse_percent: 87
# Laser 561 wavelength
- wavelength: 561
onoff:
hardware:
name: daq
type: NI
channel: Dev2/port0/line4
min: 0
max: 5
power:
hardware:
name: daq
type: NI
channel: Dev2/port0/line13
min: 0
max: 5
type: Obis
index: 1
delay_percent: 10
pulse_percent: 87
# Laser 638 wavelength
- wavelength: 638
onoff:
hardware:
name: daq
type: NI
channel: Dev2/port0/line6
min: 0
max: 5
power:
hardware:
name: daq
type: NI
channel: Dev2/ao3
min: 0
max: 5
type: Obis
index: 1
delay_percent: 10
pulse_percent: 87
Resolution
Kevin helped us modified the stage configuration to include a synthetic stage with "f" and "theta" axis.