class documentation

A base stage class for OpenFlexure translation stages.

This can't be used directly but should reduce boilerplate code when implementing new stages.

Note that the coordinate system used for the microscope may need to have different axis direction as those used by the underlying stage controller.

A minimal working stage must implement _hardware_move_relative and _hardware_move_absolute actions, which update the _hardware_position attribute on completion, and also should implement set_zero_position.

Method __init__ Initialise the stage.
Method get_xyz_position Return a tuple containing (x, y, z) position.
Method invert_axis_direction Invert the direction setting of the given axis.
Method move_absolute Make an absolute move. Keyword arguments should be axis names.
Method move_relative Make a relative move. Keyword arguments should be axis names.
Method move_to_xyz_position Move to the location specified by an (x, y, z) tuple.
Method set_zero_position Make the current position zero in all axes.
Class Variable moving Whether the stage is in motion.
Instance Variable axis_inverted Used to convert coordinates between the program frame and the hardware frame.
Property axis_names The names of the stage's axes, in order.
Property position Current position of the stage.
Property thing_state Summary metadata describing the current state of the stage.
Method _apply_axis_direction Undocumented
Method _hardware_move_absolute Make a absolute move in the coordinate system used by the physical hardware.
Method _hardware_move_relative Make a relative move in the coordinate system used by the physical hardware.
Class Variable _axis_names Undocumented
Instance Variable _hardware_position Undocumented
def __init__(self): (source)

Initialise the stage.

Raises
RedefinedBaseMovementErrorif move_relative and/or move_absolute are overridden. It is recommended to override _hardware_move_relative and/or _hardware_move_absolute instead so that all code in the child class uses the hardware reference frame.
@lt.thing_action
def get_xyz_position(self) -> tuple[int, int, int]: (source)

Return a tuple containing (x, y, z) position.

This method provides the interface expected by the camera_stage_mapping.

Raises
KeyErrorif this stage does not have axes named "x", "y", and "z".
@lt.thing_action
def invert_axis_direction(self, axis: Literal['x', 'y', 'z']): (source)

Invert the direction setting of the given axis.

Parameters
axis:Literal['x', 'y', 'z']The axis name (x, y or z) to invert.
@lt.thing_action
def move_absolute(self, cancel: lt.deps.CancelHook, block_cancellation: bool = False, **kwargs: Mapping[str, int]): (source)

Make an absolute move. Keyword arguments should be axis names.

@lt.thing_action
def move_relative(self, cancel: lt.deps.CancelHook, block_cancellation: bool = False, **kwargs: Mapping[str, int]): (source)

Make a relative move. Keyword arguments should be axis names.

@lt.thing_action
def move_to_xyz_position(self, cancel: lt.deps.CancelHook, xyz_pos: tuple[int, int, int]): (source)

Move to the location specified by an (x, y, z) tuple.

This method provides the interface expected by the camera_stage_mapping.

Parameters
cancel:lt.deps.CancelHookA cancel hook for cancelling the move. This dependency should be injected automatically by LabThings-FastAPI
xyz_pos:tuple[int, int, int]The (x, y, z) position to move to.
Raises
KeyErrorif this stage does not have axes named "x", "y", and "z".
@lt.thing_action
def set_zero_position(self): (source)

Make the current position zero in all axes.

This action does not move the stage, but resets the position to zero. It is intended for use after manually or automatically recentring the stage.

axis_inverted = (source)

Used to convert coordinates between the program frame and the hardware frame.

@lt.thing_property
axis_names: Sequence[str] = (source)

The names of the stage's axes, in order.

@lt.thing_property
position: Mapping[str, int] = (source)

Current position of the stage.

@property
thing_state = (source)

Summary metadata describing the current state of the stage.

def _apply_axis_direction(self, position: list[int] | tuple[int] | Mapping[str, int]) -> list[int] | Mapping[str, int]: (source)

Undocumented

def _hardware_move_absolute(self, cancel: lt.deps.CancelHook, block_cancellation: bool = False, **kwargs: Mapping[str, int]): (source)

Make a absolute move in the coordinate system used by the physical hardware.

Make sure to use and update self._hardware_position not self.position.

def _hardware_move_relative(self, cancel: lt.deps.CancelHook, block_cancellation: bool = False, **kwargs: Mapping[str, int]): (source)

Make a relative move in the coordinate system used by the physical hardware.

Make sure to use and update self._hardware_position not self.position.

_axis_names: tuple[str, ...] = (source)

Undocumented