Stop scan planner plots erroring if there are no secondary locations
This commit is contained in:
parent
90be139575
commit
dfe7fb6c42
2 changed files with 5 additions and 2 deletions
|
|
@ -504,7 +504,7 @@ class SmartSpiral(ScanPlanner):
|
||||||
"""Sort the remaining positions based on the current location."""
|
"""Sort the remaining positions based on the current location."""
|
||||||
|
|
||||||
# Defined rather than use a lambda for readability
|
# 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 (
|
return (
|
||||||
self._is_primary_location(pos), # False sorts low
|
self._is_primary_location(pos), # False sorts low
|
||||||
self.moves_between(current_pos, pos),
|
self.moves_between(current_pos, pos),
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,10 @@ def visualise_scan(sample: FakeSample, planner: scan_planners.ScanPlanner) -> Fi
|
||||||
ax.add_artist(sample.patch)
|
ax.add_artist(sample.patch)
|
||||||
xh, yh = zip(*planner.path_history, strict=True)
|
xh, yh = zip(*planner.path_history, strict=True)
|
||||||
xi, yi, _zi = zip(*planner.imaged_locations, 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
|
# convert history to numpy array so can calculate quiver arrows
|
||||||
xh = np.array(xh)
|
xh = np.array(xh)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue