The hal
module: hardware abstraction layer¶
Hardware abstraction layer (HAL) for MicroscoPy.
It defines abstract classes Actuator and Sensor for the scanning stages and acquisition devices
-
class
microscopy.hal.
Actuator
[source]¶ Abstract representation of a uniaxial actuator (eg translation stage).
The
scan
module requires at mimimum that sub-classes override the functionsmove_to()
andposition()
.-
move_to
(p, wait=True)[source]¶ Instructs the scanning stage to move to absolute position p.
This function MUST be overriden by child classes.
Parameters:
-
move_by
(p, wait=True)[source]¶ Instructs the scanning stage to move by a relative amount.
Unless overridden,
move_by
relies onmove_to()
.Parameters:
-
move
(dir)[source]¶ Move continuously.
Parameters: dir (float) – direction of motion (positive or negative)
-
approach
(*args)[source]¶ Stuff the scanning stage has to do before the scan can start.
E.g. backlash/hysteresis compensation. Does nothing unless overridden.
-
position
()[source]¶ Retrieve the scanning stage’s actual position.
This function MUST be overriden by child classes.
Returns: the position Return type: float
-
print_position
(string=None)[source]¶ Print the axis name and the position.
Parameters: string (string) – the string to print.
-
position_string
()[source]¶ Return a nicely formated string with position information.
This public function can be overriden; subclasses may then use
_format_position()
.
-
ready
¶ Check that the sensor is ready for use.
The default behaviour is to return True if the context manager has not been acquired, False if already in use.
-
-
class
microscopy.hal.
SmallStepsAccumulator
(actuator, min_motion=0)[source]¶ Accumulate steps that are too small, and start moving .
-
class
microscopy.hal.
Sensor
[source]¶ Abstract representation of a sensor (eg camera, analog input...).
The
microscope
module requires at mimimum that sub-classes override the functionssnap()
.update_display()
andsave_metadata()
are optional.-
snap
()[source]¶ Instructs the acquisition device to take a dataset and return the data.
This function MUST be overriden by child classes. A successful snap must set the attributes
status
to True andpaused
to False.Returns: the data, or None (in which case :py:class.`Scan1D` will ignore this snap).
-
snap_info
()[source]¶ Return a tuple of numeric or float parameters associated with a single call to
snap()
, or None.
-
update_display
()[source]¶ Specifies how to update the display
This function CAN be overriden by child classes but is optional.
-
save_metadata
(h5file, name)[source]¶ Saves sensor-specific metadata as HDF5 attributes.
Parameters: - h5file (
h5py.File
) – an open HDF5 file - name (string) – name of dataset within the file
- h5file (
-
initialise_acquisition
()[source]¶ Stuff to do before the scan can start (eg setting acq mode, exposure time...)
-
ready
¶ Check that the sensor is ready for use.
The default behaviour is to return True if the context manager has not been acquired, False if already in use.
-