hardware_control¶
This module contains the base class, class BaseMicroscope(object), to control specific hardware. This class is then extended by hardware_control_3i and hardware_control_zeiss the workflow and sample components of the Microscope Automation Software. At this moment the following microscope classes are implemented:
These classes have a vendor independent API and connect through vendor
software specific connect modules to the specific hardware.
We strongly recommend to access hardware functionality always through
the API exposed by classes from the various hardware_control
modules.
The classes are build around a list of objects of class MicroscopeComponent(object). These objects are defined in module hardware_components. Most of these objects implement methods to control the hardware and store its state.
class BaseMicroscope(object)¶
Base class with minimum functionality. The following public methods are implemented:
-
class
microscope_automation.hardware.hardware_control.
BaseMicroscope
(name=None, control_software_object=None, experiments_folder=None, microscope_components=None)[source]¶ Minimum set of attributes and methods required by Automation Software
-
add_control_software
(control_software_object)[source]¶ Add object that connects this code to the vendor specific microscope control code to Microscope.
- Input:
controlSoftwareObject: single object connecting to vendor software
- Output:
none
-
add_microscope_object
(component_objects)[source]¶ Add component to microscope.
- Input:
component_objects: object of a component class (e.g. Stage, Camera) or list of component classes
- Output:
none
-
change_magnification
(objective_changer_id, magnification, sample_object, use_safe_position=True, verbose=True, load=True)[source]¶ Change to objective with given magnification.
- Input:
magnification: magnification of selected objective as float. Not well defined if multiple objectives with identical magnification exist.
sample_object: object that has safe coordinates attached. If use_safe_position == True than stage and focus drive will move to this position before magnification is changed to avoid collision between objective and stage.
use_safe_position: move stage and focus drive to safe position before switching magnification to minimize risk of collision (Default: True)
verbose: if True print debug information (Default = True)
load: if True, move objective to load position before switching (Default: True)
- Output:
objective_name: name of new objective
-
get_load_position
(focus_drive_id)[source]¶ Get load position of focus drive.
- Input:
focus_drive_id: id of focus drive to get load position of
- Output:
z_load: load position in mum
-
goto_load
(focus_drive_id)[source]¶ Set focus position to load position.
- Input:
focus_drive_id: id of focus drive to set load position on
- Output:
z_load: load position in mum
-
live_mode
(camera_id, experiment=None, live=True)[source]¶ Start/stop live mode of ZEN software.
- Input:
camera_id: string id for camera
experiment: name of ZEN experiment (default = None)
live: switch live mode on (True = default) or off (False)
- Output:
None
-
microscope_is_ready
(experiment, component_dict, focus_drive_id, objective_changer_id, safety_object_id, reference_object_id=None, load=True, make_ready=True, trials=3, verbose=True)[source]¶ Check if microscope is ready and setup up for data acquisition.
- Input:
experiment: string with name of experiment as defined in microscope software
compenent_dict: dictionary with component_id as key and list of actions
focus_drive_id: string id for focus drive
- objective_changer_id: string id for objective changer parfocality
and parcentricity has to be calibrated
safety_object_id: string id for safety area
reference_object_id: ID of object used to set parfocality and parcentricity
load: move objective into load position before moving stage
make_ready: if True, make attempt to ready microscope, e.g. setup autofocus (Default: True)
trials: maximum number of attempt to initialize microscope. Will allow user to make adjustments on microscope. (Default: 3)
verbose: print debug messages (Default: True)
- Output:
ready: True if microscope is ready for use, False if not
-
not_implemented
(method_name)[source]¶ Raise exception if method is not implemented.
- Input:
method_name: method that calls this method
-
recall_focus
(auto_focus_id, reference_object_id=None, pre_set_focus=True)[source]¶ Find difference between stored focus position and actual autofocus position. Recall focus will move the focus drive to it’s stored position.
- Input:
auto_focus_id: string id for camera
reference_object_id: name of ZEN experiment (default = None)
pre_set_focus: Move focus to previous auto-focus position. This makes definite focus more robust
- Output:
delta_z: difference between stored z position of focus drive and position after recall focus
-