diff --git a/src/openflexure_microscope_server/scan_planners.py b/src/openflexure_microscope_server/scan_planners.py index 11ea5abf..3a215183 100644 --- a/src/openflexure_microscope_server/scan_planners.py +++ b/src/openflexure_microscope_server/scan_planners.py @@ -504,7 +504,7 @@ class SmartSpiral(ScanPlanner): """Sort the remaining positions based on the current location.""" # Defined rather than use a lambda for readability - def sort_key(pos: FutureScanLocation) -> tuple[float, float, float]: + def sort_key(pos: FutureScanLocation) -> tuple[bool, float, float, float]: return ( self._is_primary_location(pos), # False sorts low self.moves_between(current_pos, pos), diff --git a/tests/utilities/scan_test_helpers.py b/tests/utilities/scan_test_helpers.py index aa45f442..bf22876a 100755 --- a/tests/utilities/scan_test_helpers.py +++ b/tests/utilities/scan_test_helpers.py @@ -67,7 +67,10 @@ def visualise_scan(sample: FakeSample, planner: scan_planners.ScanPlanner) -> Fi ax.add_artist(sample.patch) xh, yh = zip(*planner.path_history, strict=True) xi, yi, _zi = zip(*planner.imaged_locations, strict=True) - xs, ys, _zs = zip(*planner.secondary_locations, strict=True) + if planner.secondary_locations: + xs, ys, _zs = zip(*planner.secondary_locations, strict=True) + else: + xs, ys, _zs = [], [], [] # convert history to numpy array so can calculate quiver arrows xh = np.array(xh)