module documentation

Functionality for planning scan routes.

A scan route can be planned by a ScanPlanner. There is a base class ScanPlanner, and then a child class that is still generic called RectGridPlanner that helps planning anything where the movements are on a regtangular grid. RectGridPlanner has two usable child classes:

  • SmartSpiral - For spiralling around a samples but adjusting when background is
    detected
  • RegularGridPlanner - For Raster and Snake scanning.
Class DistanceMetric An enum for selecting distance metrics for grids.
Class FutureScanLocation Data for information on future locations to scan.
Class RectGridPlanner Base class for planners that operate on a rectangular grid.
Class RegularGridPlanner A scan planner that performs a snake or a raster scan.
Class ScanPlanner A base class for a scan planner.
Class SmartSpiral A scan planner that spirals outward from the centre, prioritising short moves.
Class VisitedScanLocation Data for information on locations already visited during a scan.
Function create_rectangular_scan_path Generate a 2D grid of (x, y) coordinates representing a rectangular scan path.
Function distance_between Calculate the distance between the two xy positions.
Function enforce_xy_tuple Check input is a tuple and is of length 2.
Function enforce_xyz_tuple Check input is a tuple and is of length 3.
Constant LOGGER Undocumented
Type Alias XYPos Undocumented
Type Alias XYPosList Undocumented
Type Alias XYZPos Undocumented
Type Alias XYZPosList Undocumented
def create_rectangular_scan_path(starting_pos: XYPos, x_count: int, y_count: int, dx: int, dy: int, style: Literal['snake', 'raster']) -> list[list[XYPos]]: (source)

Generate a 2D grid of (x, y) coordinates representing a rectangular scan path.

The grid is generated from starting_pos, and expanded in the positive x and y directions using the provided step sizes. The scan order can be either raster (left-to-right for every row) or snake (alternating left-to-right and right-to-left per row).

Parameters
starting_pos:XYPosStarting (x, y) position for the scan grid.
x_count:intNumber of points in the x-direction (columns).
y_count:intNumber of points in the y-direction (rows).
dx:intStep size between points in the x-direction.
dy:intStep size between points in the y-direction.
style:Literal['snake', 'raster']Scan pattern style. Either raster or snake.
Returns
list[list[XYPos]]Nested list of (x, y) coordinates arranged by row.
def distance_between(current_pos: XYPos | np.ndarray | FutureScanLocation, next_pos: XYPos | np.ndarray | FutureScanLocation) -> float: (source)

Calculate the distance between the two xy positions.

This was previously called distance_to_site

def enforce_xy_tuple(value: XYPos) -> XYPos: (source)

Check input is a tuple and is of length 2.

If possible it will coerce the value to a tuple.

Raises
ValueErrorif the input cannot be coerced to a tuple of length 2.
def enforce_xyz_tuple(value: XYZPos) -> XYZPos: (source)

Check input is a tuple and is of length 3.

If possible it will coerce the value to a tuple.

Raises
ValueErrorif the input cannot be coerced to a tuple of length 3.

Undocumented

Value
logging.getLogger(__name__)
XYPos: TypeAlias = (source)

Undocumented

Value
tuple[int, int]
XYPosList: TypeAlias = (source)

Undocumented

Value
list[XYPos]
XYZPos: TypeAlias = (source)

Undocumented

Value
tuple[int, int, int]
XYZPosList: TypeAlias = (source)

Undocumented

Value
list[XYZPos]