From 614fd8b9e96764f6ef35e892d82613b36561354d Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Tue, 11 Nov 2025 17:15:20 +0000 Subject: [PATCH] Apply suggestions from code review of branch recentre-with-rom-methods Co-authored-by: Richard Bowman --- src/openflexure_microscope_server/things/stage_measure.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/stage_measure.py b/src/openflexure_microscope_server/things/stage_measure.py index 2242e091..6b1837be 100644 --- a/src/openflexure_microscope_server/things/stage_measure.py +++ b/src/openflexure_microscope_server/things/stage_measure.py @@ -70,7 +70,12 @@ class RomDataTracker: return self.stage_coords[-1].copy() def fit_axis(self, axis: Literal["x", "y"]) -> np.poly1d: - """Quadratic fit stage coords along and axis (against z) and return poly1d of fit.""" + """Quadratic fit stage z against x or y and return poly1d of fit. + + Note that this considers only one of x and y, and ignores the other coordinate. If + this function is used on moves where both x and y are changing, it will give misleading + results. + """ lateral_positions = [i[axis] for i in self.stage_coords] z_positions = [i["z"] for i in self.stage_coords] fit_params = np.polyfit(lateral_positions, z_positions, 2)