navigate.model.microscope.Microscope
- class navigate.model.microscope.Microscope(name, configuration, devices_dict, is_synthetic=False, is_virtual=False)
Bases:
object
Microscope Class - Used to control the microscope.
- __init__(name, configuration, devices_dict, is_synthetic=False, is_virtual=False)
Initialize the microscope.
- Parameters:
name (str) – Name of the microscope.
configuration (dict) – Configuration dictionary.
devices_dict (dict) – Dictionary of devices.
is_synthetic (bool, optional) – Is synthetic, by default False
is_virtual (bool, optional) – Is virtual, by default False
Methods
__init__
(name, configuration, devices_dict)Initialize the microscope.
assemble_device_config_lists
(device_name, ...)Assemble device config lists.
Calculate all the waveforms.
Calculate the exposure and sweep times for all channels.
End the acquisition.
Get the exposure and sweep times for all channels.
Get stage position.
load_and_start_devices
(device_name, is_list, ...)Load and start devices.
move_remote_focus
([offset])Move remote focus.
move_stage
(pos_dict[, wait_until_done, ...])Move stage to a position.
move_stage_offset
([former_microscope])Move the stage to the offset position.
Prepare the acquisition.
prepare_next_channel
([update_daq_task_flag])Prepare the next channel.
run_command
(command, *args)Stop stage.
Close hardware explicitly.
Turn off current laser.
Turn on the current laser.
update_data_buffer
(img_width, img_height, ...)Update the data buffer for the camera.
update_stage_limits
([limits_flag])Update stage limits.
Attributes
Name of the microscope.
Configuration dictionary.
Buffer for image data.
Dictionary of stages.
List of stages.
Ask stage for position.
Dictionary of lasers.
Dictionary of galvanometers.
Dictionary of filter_wheels
Dictionary of data acquisition devices.
Dictionary of microscope info.
Current channel.
Current laser index.
List of all channels.
List of available channels.
Number of images.
Central focus position.
Is a synthetic microscope.
Dictionary of laser configurations.
Dictionary of returned stage positions.
Dictionary of commands
Dictionary of plugin devices
- assemble_device_config_lists(device_name, device_name_dict)
Assemble device config lists.
- Parameters:
device_name (str) – Device name.
device_name_dict (dict) – Device name dictionary.
- Returns:
device_config_list (list) – Device configuration list.
device_name_list (list) – Device name list.
- calculate_all_waveform()
Calculate all the waveforms.
- Returns:
waveform – Dictionary of all the waveforms.
- Return type:
dict
- calculate_exposure_sweep_times()
Calculate the exposure and sweep times for all channels.
The calculate_exposure_sweep_times function calculates and returns exposure times and sweep times for all channels in a microscope configuration. It takes the camera’s readout time as an input parameter and considers various parameters such as camera exposure time, delay percentages, and smoothing to compute these times. The function iterates through the channels, performs calculations, and returns the results as dictionaries containing exposure times and sweep times for each channel.
- Returns:
exposure_times (dict) – Dictionary of exposure times.
sweep_times (dict) – Dictionary of sweep times.
- end_acquisition()
End the acquisition.
- get_exposure_sweep_times()
Get the exposure and sweep times for all channels.
- Returns:
exposure_times (dict) – Dictionary of exposure times.
sweep_times (dict) – Dictionary of sweep times.
- get_stage_position()
Get stage position.
- Returns:
stage_position – Dictionary of stage positions.
- Return type:
dict
- load_and_start_devices(device_name, is_list, device_name_list, device_ref_name, device_connection, name, i, plugin_devices)
Load and start devices.
- Parameters:
device_name (str) – Device name.
is_list (bool) – Is list.
device_name_list (list) – Device name list.
device_ref_name (str) – Device reference name.
device_connection (str) – Device connection.
name (str) – Name.
i (int) – Index.
plugin_devices (dict) – Plugin Devices
- move_remote_focus(offset=None)
Move remote focus.
- Parameters:
offset (float, optional) – Offset, by default None
- move_stage(pos_dict, wait_until_done=False, update_focus=True)
Move stage to a position.
- Parameters:
pos_dict (dict) – Dictionary of stage positions.
wait_until_done (bool, optional) – Wait until stage is done moving, by default False
update_focus (bool, optional) – Update the central focus
- Returns:
success – True if stage is successfully moved, False otherwise.
- Return type:
bool
- move_stage_offset(former_microscope=None)
Move the stage to the offset position.
- Parameters:
former_microscope (str) – Name of the former microscope.
- prepare_acquisition()
Prepare the acquisition.
- Returns:
waveform – Dictionary of all the waveforms.
- Return type:
dict
- prepare_next_channel(update_daq_task_flag=True)
Prepare the next channel.
This function, prepare_next_channel, is responsible for configuring various hardware components for the next imaging channel in an experimental setup. It sequentially selects the next available channel, sets the filter wheel, camera exposure time, laser power, and other parameters based on the selected channel’s configuration. Additionally, it stops data acquisition, prepares the data acquisition system for the new channel, and adjusts the focus position as necessary, ensuring the hardware is ready for imaging the selected channel.
- Parameters:
update_daq_task_flag (bool) – whether to override waveforms in the DAQ (create new tasks)
- stop_stage()
Stop stage.
- terminate()
Close hardware explicitly.
- turn_off_lasers()
Turn off current laser.
- turn_on_laser()
Turn on the current laser.
- update_data_buffer(img_width, img_height, data_buffer, number_of_frames)
Update the data buffer for the camera.
- Parameters:
img_width (int) – Width of the image.
img_height (int) – Height of the image.
data_buffer (numpy.ndarray) – Data buffer for the camera.
number_of_frames (int) – Number of frames to be acquired.
- update_stage_limits(limits_flag=True)
Update stage limits.
- Parameters:
limits_flag (bool, optional) – Limits flag, by default True
- ask_stage_for_position
Ask stage for position.
- Type:
bool
- available_channels
List of available channels.
- Type:
list
- central_focus
Central focus position.
- Type:
float
- channels
List of all channels.
- Type:
list
- commands
Dictionary of commands
- Type:
dict
- configuration
Configuration dictionary.
- Type:
dict
- current_channel
Current channel.
- Type:
int
- current_laser_index
Current laser index.
- Type:
int
- daq
Dictionary of data acquisition devices.
- Type:
dict
- data_buffer
Buffer for image data.
- Type:
- filter_wheel
Dictionary of filter_wheels
- Type:
dict
- galvo
Dictionary of galvanometers.
- Type:
dict
- info
Dictionary of microscope info.
- Type:
dict
- is_synthetic
Is a synthetic microscope.
- Type:
Bool
- laser_wavelength
Dictionary of laser configurations.
- Type:
dict
- lasers
Dictionary of lasers.
- Type:
dict
- microscope_name
Name of the microscope.
- Type:
str
- number_of_frames
Number of images.
- Type:
int
- plugin_devices
Dictionary of plugin devices
- Type:
dict
- ret_pos_dict
Dictionary of returned stage positions.
- Type:
dict
- stages
Dictionary of stages.
- Type:
dict
- stages_list
List of stages.
- Type:
list