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 neighbouring positions are not imaged.

The next image taken is the fewest scan sites (moves in dx and dy) from the current site, with ties broken by minimising the moves away from the start of the scan. Final tiebreak is the distance to each site, in motor steps rather than multiple of dx and dy.

Method mark_location_visited Mark the location as visited.
Method select_nearby_focus_site Return the xyz position of the nearby site with the lowest z position.
Property secondary_locations A list of all secondary (intermediate) locations.
Method _add_intermediate_positions Add intermediate points after locating a background location.
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 _is_primary_location Return True if input is a primary location not a secondary (intermediate) location.
Method _parse Parse any settings sent to this planner and store them if needed.
Method _re_sort_remaining_locations Sort the remaining positions based on the current location.
Instance Variable _max_dist Undocumented

Inherited from RectGridPlanner:

Method moves_between Return displacement in grid-move units as a numpy array [dx_moves, dy_moves].
Method _adjacent_positions Undocumented
Method _intermediate_position Return an (x,y) position halfway between two input positions.
Instance Variable _dx Undocumented
Instance Variable _dy Undocumented

Inherited from ScanPlanner (via RectGridPlanner):

Method __init__ Set up lists for the path planning, and scan history.
Method get_next_location_and_z_estimate Return the next location to scan and its estimated z-position.
Method get_visited_location Return the scan location from the history that matches the input position.
Method position_planned Return True if input scan position position is planned.
Method position_visited Return True if input scan position has been visited before.
Property focused_locations Property to access a copy of the focused_locations.
Property focused_locations_xyz 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 _grid_to_future_locations Flatten a 2D grid of coordinates into flat list of FutureScanLocation objects.
Instance Variable _initial_position Undocumented
Instance Variable _path_history Undocumented
Instance Variable _remaining_locations Undocumented
def mark_location_visited(self, xyz_pos: XYZPos, imaged: bool = True, focused: bool = True): (source)

Mark the location as visited.

Parameters
xyz_pos:XYZPosthe x_y_z position
imaged:booltrue if an image was taken, false if not (due to background detect)
focused:booltrue if autofocus completed successfully
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 1.1 times the larger of the x and y scan offsets.

If no focused sites are within this range, use the height of the nearest focused site.

Returns None if no focused locations are present

@property
secondary_locations: XYZPosList = (source)

A list of all secondary (intermediate) locations.

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

Add intermediate points after locating a background location.

This is called after an image is recorded that was background. Intermediate locations are added between any adjacent locations that were successfully imaged due to being labelled as containing sample.

Note that in the case that an imaged location has an adjacent background image then adding the intermediate image will be handled by _add_surrounding_positions().

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

If the already visited position was not imaged then an intermediate location is added. See also self._add_intermediate_positions() for adding intermediate locations after visiting a location that was not imaged.

def _initial_location_list(self) -> list[FutureScanLocation]: (source)

Set the initial list of locations for this scan planner.

This is called on initialisation.

For smart spiral this is just the first point

def _is_primary_location(self, location: FutureScanLocation | VisitedScanLocation) -> bool: (source)

Return True if input is a primary location not a secondary (intermediate) location.

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

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

def _re_sort_remaining_locations(self, current_pos: XYPos): (source)

Sort the remaining positions based on the current location.

_max_dist: int = (source)

Undocumented