Image intermediate locations between sample and background

This commit is contained in:
Julian Stirling 2025-10-19 21:29:11 +01:00
parent 39a04df5be
commit f781e6b674
6 changed files with 90 additions and 23 deletions

View file

@ -302,14 +302,6 @@ def test_example_smart_spiral():
expected_planner = (
scan_test_helpers.get_expected_result_for_example_smart_spiral(sample_name)
)
# Use hasattr to check if the saved test data is the old object where imaged
# locations were saved directly as a list of tuples rather than being generated
# from a history of VisitedScanLocation objects.
# This "if" section of this if-else block can be deleted once we are confident
# of the new format and the pickles are updated
if hasattr(expected_planner, "_imaged_locations"):
assert planner.path_history == expected_planner._path_history
assert planner.imaged_locations == expected_planner._imaged_locations
else:
assert planner.path_history == expected_planner.path_history
assert planner.imaged_locations == expected_planner.imaged_locations
assert planner.path_history == expected_planner.path_history
assert planner.imaged_locations == expected_planner.imaged_locations

View file

@ -62,6 +62,7 @@ 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)
# convert history to numpy array so can calculate quiver arrows
xh = np.array(xh)
@ -78,6 +79,7 @@ def visualise_scan(sample: FakeSample, planner: scan_planners.ScanPlanner) -> Fi
)
plt.plot(xh, yh, "r.")
plt.plot(xi, yi, "g*")
plt.plot(xs, ys, "o", mfc="none", mec="blue")
ax.axis("equal")
return fig