Apply suggestions from code review of branch rom_test_only

Co-authored-by: Beth Probert <beth_probert@outlook.com>
This commit is contained in:
Julian Stirling 2025-10-24 14:05:07 +00:00
parent 82f435256b
commit ba8a4ca744
2 changed files with 7 additions and 6 deletions

View file

@ -158,7 +158,8 @@ class RangeofMotionThing(lt.Thing):
) )
logger.info( logger.info(
"Using the stage to measure the Range of Motion. " "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() start_time = time.time()
@ -275,7 +276,7 @@ class RangeofMotionThing(lt.Thing):
finally: finally:
rom_deps.stage.move_absolute(**starting_position, block_cancellation=True) 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"] self, fov_perc: int, axis: Literal["x", "y"]
) -> float: ) -> float:
"""For a given image percentage and axis return the distance in img coords. """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 :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": if axis == "x":
return {"x": distance * direction, "y": 0} return {"x": distance * direction, "y": 0}
return {"x": 0, "y": distance * direction} return {"x": 0, "y": distance * direction}

View file

@ -18,7 +18,7 @@ LOGGER = logging.getLogger("mock-invocation_logger")
# Useful generators # Useful generators
def increasing_xy_dict_generator(*_args, **_kwargs): 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 These don't simulate expected effects, but allow checking sequential reads of a
function/property were used. function/property were used.
@ -30,7 +30,7 @@ def increasing_xy_dict_generator(*_args, **_kwargs):
def increasing_xyz_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 These don't simulate expected effects, but allow checking sequential reads of a
function/property were used. 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(): def test_error_if_no_stream_res_set_when_requesting_img_coords():
"""Check a RuntimeError thrown when requesting image coordinates if resolution unset.""" """Check a RuntimeError thrown when requesting image coordinates if resolution unset."""
with pytest.raises(RuntimeError, match="Stream resolution must be set"): 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 @pytest.fixture