From ba8a4ca744ce8f9fe45d98b52998fb7a7cbdc5cd Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Fri, 24 Oct 2025 14:05:07 +0000 Subject: [PATCH] Apply suggestions from code review of branch rom_test_only Co-authored-by: Beth Probert --- src/openflexure_microscope_server/things/stage_measure.py | 7 ++++--- tests/test_stage_measure.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/openflexure_microscope_server/things/stage_measure.py b/src/openflexure_microscope_server/things/stage_measure.py index 9c8562b3..24aca185 100644 --- a/src/openflexure_microscope_server/things/stage_measure.py +++ b/src/openflexure_microscope_server/things/stage_measure.py @@ -158,7 +158,8 @@ class RangeofMotionThing(lt.Thing): ) logger.info( "Using the stage to measure the Range of Motion. " - "Please ensure you are using a big enough sample." + "Please ensure you are using a sample that covers the whole range of " + "motion. This should be approximately 12 x 12 mm." ) start_time = time.time() @@ -275,7 +276,7 @@ class RangeofMotionThing(lt.Thing): finally: rom_deps.stage.move_absolute(**starting_position, block_cancellation=True) - def _img_percentate_to_img_coords( + def _img_percentage_to_img_coords( self, fov_perc: int, axis: Literal["x", "y"] ) -> float: """For a given image percentage and axis return the distance in img coords. @@ -308,7 +309,7 @@ class RangeofMotionThing(lt.Thing): :return: The movement size in image coordinates """ - distance = self._img_percentate_to_img_coords(fov_perc=fov_perc, axis=axis) + distance = self._img_percentage_to_img_coords(fov_perc=fov_perc, axis=axis) if axis == "x": return {"x": distance * direction, "y": 0} return {"x": 0, "y": distance * direction} diff --git a/tests/test_stage_measure.py b/tests/test_stage_measure.py index 5f702a9a..69f6c1bd 100644 --- a/tests/test_stage_measure.py +++ b/tests/test_stage_measure.py @@ -18,7 +18,7 @@ LOGGER = logging.getLogger("mock-invocation_logger") # Useful generators def increasing_xy_dict_generator(*_args, **_kwargs): - """Generate x-y dictionaries of incremening sizes. + """Generate x-y dictionaries of incrementing sizes. These don't simulate expected effects, but allow checking sequential reads of a function/property were used. @@ -30,7 +30,7 @@ def increasing_xy_dict_generator(*_args, **_kwargs): def increasing_xyz_dict_generator(*_args, **_kwargs): - """Generate x-y-z dictionaries of incremening sizes. + """Generate x-y-z dictionaries of incrementing sizes. These don't simulate expected effects, but allow checking sequential reads of a function/property were used. @@ -135,7 +135,7 @@ def test_parasitic_detect(par_fraction, too_high): def test_error_if_no_stream_res_set_when_requesting_img_coords(): """Check a RuntimeError thrown when requesting image coordinates if resolution unset.""" with pytest.raises(RuntimeError, match="Stream resolution must be set"): - stage_measure.RangeofMotionThing()._img_percentate_to_img_coords(20, "x") + stage_measure.RangeofMotionThing()._img_percentage_to_img_coords(20, "x") @pytest.fixture