diff --git a/src/openflexure_microscope_server/scan_planners.py b/src/openflexure_microscope_server/scan_planners.py index e032bf0f..fef03589 100644 --- a/src/openflexure_microscope_server/scan_planners.py +++ b/src/openflexure_microscope_server/scan_planners.py @@ -297,12 +297,11 @@ class ScanPlanner: """Flatten a 2D grid of coordinates into flat list of FutureScanLocation objects. :param grid: A 2D nested list of XY coordinates - """ - path = [] - for line in grid: - path += line - return [FutureScanLocation(location) for location in path] + :return: A flattened list of FutureScanLocations + """ + # Loop over each location in each line to flatten grid into single list. + return [FutureScanLocation(location) for line in grid for location in line] class SmartSpiral(ScanPlanner): @@ -672,7 +671,7 @@ def create_rectangular_scan_path( dx: int, dy: int, style: Literal["snake", "raster"], -) -> list: +) -> list[list[XYPos]]: """Generate a 2D grid of (x, y) coordinates representing a rectangular scan path. The grid is generated from starting_pos, and expanded in the diff --git a/src/openflexure_microscope_server/things/scan_workflows.py b/src/openflexure_microscope_server/things/scan_workflows.py index 0ec71ec0..01212304 100644 --- a/src/openflexure_microscope_server/things/scan_workflows.py +++ b/src/openflexure_microscope_server/things/scan_workflows.py @@ -143,6 +143,8 @@ class ScanWorkflow(Generic[SettingModelType], lt.Thing): that each image should overlap its nearest neighbour by 50%. :returns: (dx, dy) - the x and y displacements in steps + + :raises RuntimeError: If there is no camera stage mapper Thing available or if CMS isn't calibrated. """ csm = self._require_csm()