Skip to content

Commit

Permalink
Acquisition engine fixes (#138)
Browse files Browse the repository at this point in the history
* expand o3 scan range

* add check for total number of sequenced events
  • Loading branch information
ieivanov committed May 15, 2024
1 parent 73f8625 commit 4099f0a
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions mantis/acquisition/acq_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ def __init__(
else:
logger.info(f'{self.type.capitalize()} acquisition is not enabled')

def _check_num_sequenced_events(self):
num_sequenced_events = 1
if self.slice_settings.use_sequencing:
num_sequenced_events *= self.slice_settings.num_slices
if self.channel_settings.use_sequencing:
num_sequenced_events *= self.channel_settings.num_channels
if num_sequenced_events > 1200:
raise ValueError(
f'The number of sequenced events: {num_sequenced_events} exceeds the maximum allowed limit of 1200. '
'Please reduce the number of slices and channels or disable channel sequencing. '
'This limitation can be overcome by increasing the length of hardware sequences supported by the '
'TriggerScope firmware (see NR_DAC_STATES and NR_DO_STATES).'
)

@property
def channel_settings(self):
return self._channel_settings
Expand All @@ -165,6 +179,7 @@ def channel_settings(self, settings: ChannelSettings):
f'{self.type.capitalize()} acquisition will have the following settings: {asdict(settings)}'
)
self._channel_settings = settings
self._check_num_sequenced_events()

@slice_settings.setter
def slice_settings(self, settings: SliceSettings):
Expand All @@ -173,6 +188,7 @@ def slice_settings(self, settings: SliceSettings):
f'{self.type.capitalize()} acquisition will have the following settings: {settings_dict}'
)
self._slice_settings = settings
self._check_num_sequenced_events()

@microscope_settings.setter
def microscope_settings(self, settings: MicroscopeSettings):
Expand Down Expand Up @@ -254,9 +270,10 @@ def reset(self):
)

# Reset z stage to initial position
microscope_operations.set_z_position(
self.mmc, self.slice_settings.z_stage_name, self._z0
)
if self._z0 is not None:
microscope_operations.set_z_position(
self.mmc, self.slice_settings.z_stage_name, self._z0
)


class MantisAcquisition(object):
Expand Down Expand Up @@ -782,8 +799,8 @@ def refocus_ls_path(self):
# Define O3 z range
# 1 step is approx 20 nm, 15 steps are 300 nm which is sub-Nyquist sampling
# The stack starts away from O2 and moves closer
o3_z_start = -105
o3_z_end = 105
o3_z_start = -165
o3_z_end = 165
o3_z_step = 15
o3_z_range = np.arange(o3_z_start, o3_z_end + o3_z_step, o3_z_step)

Expand Down

0 comments on commit 4099f0a

Please sign in to comment.