class ScanPlanner: (source)
Known subclasses: openflexure_microscope_server.scan_planners.RectGridPlanner
Constructor: ScanPlanner(initial_position, planner_settings)
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 | get |
Return the next location to scan and its estimated z-position. |
| Method | get |
Return the scan location from the history that matches the input position. |
| Method | mark |
Mark the location as visited. |
| Method | position |
Return True if input scan position position is planned. |
| Method | position |
Return True if input scan position has been visited before. |
| Method | select |
Return the focused site near xy_pos according to the tiebreak. |
| Property | completion |
A human readable explanation of why the scan has (or hasn't) finished. |
| Property | focused |
Property to access a copy of the focused_locations. |
| 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. |
| Method | _grid |
Flatten a 2D grid of coordinates into flat list of FutureScanLocation objects. |
| Method | _initial |
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 | _initial |
Undocumented |
| Instance Variable | _path |
Undocumented |
| Instance Variable | _remaining |
Undocumented |
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.
XYPos | XYZPos | FutureScanLocation) -> VisitedScanLocation:
(source)
¶
Return the scan location from the history that matches the input position.
openflexure_microscope_server.scan_planners.SmartSpiralMark 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 |
openflexure_microscope_server.scan_planners.SmartSpiralA human readable explanation of why the scan has (or hasn't) finished.
The base implementation only distinguishes "still going" from "ran out of planned locations". Subclasses that can stop for more than one reason (for example, hitting a range limit vs. running out of sample to follow) should override this to give a more specific explanation, as this is used for end-of-scan logging.
list[ list[ XYPos]]) -> list[ FutureScanLocation]:
(source)
¶
Flatten a 2D grid of coordinates into flat list of FutureScanLocation objects.
| Parameters | |
grid:list[ | A 2D nested list of XY coordinates |
| Returns | |
list[ | A flattened list of FutureScanLocations |
openflexure_microscope_server.scan_planners.RegularGridPlanner, openflexure_microscope_server.scan_planners.SmartSpiralSet 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.
| Returns | |
list[ | A list of FutureScanLocation objects with all planned locations. |