class documentation

A base class for a scan planner.

This should never be used directly for a scan, it should be subclassed.

Each subclass should implement at least the methods with NotImplementedError set:

  • _parse() - to parse the planner_settings dictionary, saving values to class
    variables
  • _initial_location_list() - Sets the list of locations for the scan to follow

For a simple scan pattern this should be sufficient. For more complex ones that dynamically adjust the path it is suggested to override mark_location_visited() calling super().mark_location_visited() at the start of the method so that all locations are adjusted.

When subclassing be sure to use enforce_xy_tuple and enforce_xyz_tuple on any user data before running.

Method __init__ Set up lists for the path planning, and scan history.
Method closest_focus_site Return the xyz position of the closest site where focus was achieved.
Method get_next_location_and_z_estimate Return the next location to scan and its estimated z-position.
Method mark_location_visited Mark the location as visited.
Method position_planned Return True if input xy position is planned.
Method position_visited Return True if input xy position has been visited before.
Property focused_locations Property to access a copy of the focused_locations.
Property imaged_locations Property to access a copy of the imaged_locations.
Property path_history Property to access a copy of the path_history.
Property remaining_locations Property to access a copy of the remaining_locations.
Property scan_complete Return True if there are no locations left to scan.
Method _initial_location_list Set the initial list of locations for this scan planner.
Method _parse Parse any settings sent to this planner and store them if needed.
Instance Variable _focused_locations Undocumented
Instance Variable _imaged_locations Undocumented
Instance Variable _initial_position Undocumented
Instance Variable _path_history Undocumented
Instance Variable _remaining_locations Undocumented
def __init__(self, initial_position: XYPos, planner_settings: dict | None = None): (source)

Set up lists for the path planning, and scan history.

def closest_focus_site(self, xy_pos: XYPos) -> XYZPos | None: (source)

Return the xyz position of the closest site where focus was achieved.

The most recently taken image is returned in the case of a tie.

Returns None if there if no focussed locations are present

Parameters
xy_pos:XYPosThe xy_position which the returned position should be closest to.
Returns
XYZPos | NoneUndocumented
def get_next_location_and_z_estimate(self) -> tuple[XYPos, int | None]: (source)

Return the next location to scan and its estimated z-position.

Note z-position may be None! This indicates that the current z, position should be used.

def mark_location_visited(self, xyz_pos: XYZPos, imaged: bool, focused: bool): (source)

Mark the location as visited.

Args:
xyz_pos: the x_y_z position imaged: true if an image was taken, false if not (due to background detect) focused: true if autofocus completed successfully
def position_planned(self, position: XYPos) -> bool: (source)

Return True if input xy position is planned.

def position_visited(self, position: XYPos) -> bool: (source)

Return True if input xy position has been visited before.

@property
focused_locations: XYZPosList = (source)

Property to access a copy of the focused_locations.

@property
imaged_locations: XYZPosList = (source)

Property to access a copy of the imaged_locations.

@property
path_history: XYPosList = (source)

Property to access a copy of the path_history.

@property
remaining_locations: XYPosList = (source)

Property to access a copy of the remaining_locations.

@property
scan_complete: bool = (source)

Return True if there are no locations left to scan.

def _initial_location_list(self) -> XYPosList: (source)

Set the initial list of locations for this scan planner.

This is called on initialisation.

For a simple grid scan/snake scan this would be all locations to move to.

Note for implementation that this _must_ contain (x,y) tuples, not [x, y] lists or matching errors could occur.

def _parse(self, planner_settings: dict | None = None): (source)

Parse any settings sent to this planner and store them if needed.

_focused_locations: XYZPosList = (source)

Undocumented

_imaged_locations: XYZPosList = (source)

Undocumented

_initial_position = (source)

Undocumented

_path_history: XYPosList = (source)

Undocumented

_remaining_locations: XYPosList = (source)

Undocumented