class documentation

A scan planner that spirals outward from the centre, prioritising short moves.

This planner spirals out from the centre, but prioritises short moves over rigidly sticking to minimising radius from the centre of the scan.

Each time and image is taken the four neighbouring images are added to the list of positions to image (unless they are already listed or tried). However, if a location is not imaged due no sample being detected then neibouring positions are not imaged.

The next image taken is the closes to the centre (considering the largest of vertical or horizontal distance), ties are broken by the distance from the current position.

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. Adjust extra positions accordingly.
Method moves_between Return the larger of x moves or y moves between two xy positions.
Method select_nearby_focus_site Return the xyz position of the nearby site with the lowest z position.
Method _add_surrounding_positions Add the 4 surrounding positions to the list of remaining locations to visit.
Method _initial_location_list Set the initial list of locations for this scan planner.
Method _parse Parse SmartSpiral Settings dictionary.
Method _re_sort_remaining_locations Sort the remaining positions based on the current location.
Instance Variable _dx Undocumented
Instance Variable _dy Undocumented
Instance Variable _max_dist Undocumented

Inherited from ScanPlanner:

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 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.
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 get_next_location_and_z_estimate(self) -> tuple[XYPos, int | None]: (source)

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

This overrides the default behaviour of ScanPlanner to take the lowest value of nearest neighbours as this works best for smart stack.

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 = True, focused: bool = True): (source)

Mark the location as visited. Adjust extra positions accordingly.

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 moves_between(self, starting_pos: XYPos | np.ndarray, ending_pos: XYPos | np.ndarray) -> float: (source)

Return the larger of x moves or y moves between two xy positions.

Parameters
starting_pos:XYPos | np.ndarraythe position to measure from
ending_pos:XYPos | np.ndarraythe position to measure to
Returns
floatUndocumented
def select_nearby_focus_site(self, xy_pos: XYPos) -> XYZPos | None: (source)

Return the xyz position of the nearby site with the lowest z position.

Lowest position is best, as starting too high causes smart stacking to autofocus and restart. Starting too low just requires extra movements in +z. Nearby is defined as within NEIGHBOUR_CUTOFF times the distance to the closest neighbour.

Returns None if there if no focused locations are present

def _add_surrounding_positions(self, xy_pos: XYPos): (source)

Add the 4 surrounding positions to the list of remaining locations to visit.

This adds the surrounding positions (with 4 point connectivity) to the remaining locations list if they are not:

  • too far away
  • already planned
  • already visited
def _initial_location_list(self) -> XYPosList: (source)

Set the initial list of locations for this scan planner.

This is salled on initialisation.

For smart spiral this is just the first point

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

Parse SmartSpiral Settings dictionary.

  • dx - the movement size in x
  • dy - the movement size in y
  • max_dist - The maximum distance to a location can be from the centre.
def _re_sort_remaining_locations(self, current_pos: XYPos): (source)

Sort the remaining positions based on the current location.

_dx: int = (source)

Undocumented

_dy: int = (source)

Undocumented

_max_dist: int = (source)

Undocumented