class SmartSpiral(ScanPlanner): (source)
Constructor: SmartSpiral(initial_position, planner_settings)
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 | __init__ |
Set up the lists inherited from ScanPlanner, plus a distance cutoff. |
| Method | get |
Return the next location to scan and its estimated z-position. |
| Method | mark |
Mark the location as visited. |
| Method | moves |
Return the larger of x moves or y moves between two xy positions. |
| Method | select |
Return the xyz position of the nearby site with the lowest z position. |
| Property | secondary |
A list of all secondary (intermediate) locations. |
| Method | _add |
Add intermediate points after locating a background location. |
| Method | _add |
Add the 4 surrounding positions to the list of remaining locations to visit. |
| Method | _adjacent |
Return 4 points +/-dx and +/-dy from the input location. |
| Method | _initial |
Set the initial list of locations for this scan planner. |
| Method | _intermediate |
Return an (x,y) position halfway between two input positions. |
| Method | _is |
Return True if input is a primary location not a secondary (intermediate) location. |
| Method | _parse |
Parse SmartSpiral Settings dictionary. |
| Method | _re |
Sort the remaining positions based on the current location. |
| Instance Variable | _distance |
Undocumented |
| Instance Variable | _dx |
Undocumented |
| Instance Variable | _dy |
Undocumented |
| Instance Variable | _max |
Undocumented |
Inherited from ScanPlanner:
| Method | closest |
Return the xyz position of the closest site where focus was achieved. |
| Method | get |
Return the scan location from the history that matches the input position. |
| Method | position |
Return True if input scan position position is planned. |
| Method | position |
Return True if input scan position has been visited before. |
| Property | focused |
Property to access a copy of the focused_locations. |
| Property | imaged |
Property to access a copy of the imaged_locations. |
| Property | path |
Property to access a copy of the path_history. |
| Property | remaining |
Property to access a copy of the remaining_locations. |
| Property | scan |
Return True if there are no locations left to scan. |
| Instance Variable | _initial |
Undocumented |
| Instance Variable | _path |
Undocumented |
| Instance Variable | _remaining |
Undocumented |
Set up the lists inherited from ScanPlanner, plus a distance cutoff.
Use the supplied _dx and _dy to set a distance cutoff for an image to be considered neighbouring another
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.
XYZPos, imaged: bool = True, focused: bool = True):
(source)
¶
Mark the location as visited.
| Parameters | |
xyzXYZPos | the x_y_z position |
imaged:bool | true if an image was taken, false if not (due to background detect) |
focused:bool | true if autofocus completed successfully |
XYPos | np.ndarray | FutureScanLocation, ending_pos: XYPos | np.ndarray | FutureScanLocation) -> float:
(source)
¶
Return the larger of x moves or y moves between two xy positions.
| Parameters | |
startingXYPos | np.ndarray | FutureScanLocation | the position to measure from |
endingXYPos | np.ndarray | FutureScanLocation | the position to measure to |
| Returns | |
float | Undocumented |
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
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().
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.
Set the initial list of locations for this scan planner.
This is salled on initialisation.
For smart spiral this is just the first point
FutureScanLocation | VisitedScanLocation) -> bool:
(source)
¶
Return True if input is a primary location not a secondary (intermediate) location.
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.