From 094cb94da8b875d5fd608e33b73f4455b50c13a4 Mon Sep 17 00:00:00 2001 From: Chish36 Date: Tue, 12 Aug 2025 16:25:31 +0100 Subject: [PATCH] Ruff formatting --- src/openflexure_microscope_server/things/stage_measure.py | 6 ++++-- tests/test_stage_measure.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/openflexure_microscope_server/things/stage_measure.py b/src/openflexure_microscope_server/things/stage_measure.py index 13761c52..93716c38 100644 --- a/src/openflexure_microscope_server/things/stage_measure.py +++ b/src/openflexure_microscope_server/things/stage_measure.py @@ -35,6 +35,7 @@ CSMDep = lt.deps.direct_thing_client_dependency( ) AutofocusDep = lt.deps.direct_thing_client_dependency(AutofocusThing, "/autofocus/") + class RomDataTracker: """Class for tracking range of motion data.""" @@ -59,6 +60,7 @@ class RomDataTracker: self.stage_coords.clear() self.cor_lat_steps.clear() + class ParasiticMotionError(Exception): """Custom exception raised when parasitic motion is detected. @@ -221,7 +223,7 @@ def _acquire_z_predict_points( data.measure(stage.position, offset) - parasitic_detect( + _parasitic_detect( delta=abs(data.delta[wrong_axis]), max_allowed_delta=abs(wrong_axis_max_medium[wrong_axis]), ) @@ -306,7 +308,7 @@ def _check_stage_operation( data.measure(stage.position, offset) - parasitic_detect( + _parasitic_detect( abs(data.delta[wrong_axis]), abs( _generate_move_dicts( diff --git a/tests/test_stage_measure.py b/tests/test_stage_measure.py index 79c48c43..0083bbf2 100644 --- a/tests/test_stage_measure.py +++ b/tests/test_stage_measure.py @@ -5,7 +5,7 @@ from openflexure_microscope_server.things.stage_measure import ( _generate_move_dicts, _predict_z, _parasitic_detect, - ParasiticMotionError + ParasiticMotionError, ) from .mock_things.mock_csm import MockCSMThing @@ -49,6 +49,7 @@ def test_predict_z(): expected_z_diff = 1343.1625053206606 assert mock_z_diff == expected_z_diff + def test_parasitic_detect(): """Check that the parasitic error is raised correctly.""" mock_delta = 100