Fix assumption that CSM was a numpy array not a list

This commit is contained in:
Julian Stirling 2025-10-20 16:40:41 +01:00
parent b314ced4f7
commit 635375a012
2 changed files with 7 additions and 10 deletions

View file

@ -61,7 +61,7 @@ class RomDataTracker:
self.offsets: list[dict[str, float]] = [] self.offsets: list[dict[str, float]] = []
def record_movement( def record_movement(
self, current_pos: dict[str, int], offset: dict[str, int] self, current_pos: dict[str, int], offset: dict[str, float]
) -> None: ) -> None:
"""Record the current position and the measured offset of the last move.""" """Record the current position and the measured offset of the last move."""
self.stage_coords.append(current_pos) self.stage_coords.append(current_pos)
@ -76,7 +76,7 @@ class RomDataTracker:
self, self,
movement: dict[str, int], movement: dict[str, int],
stage_position: dict[str, int], stage_position: dict[str, int],
csm_matrix: np.ndarray, csm_matrix: list[list[int]],
) -> int: ) -> int:
"""Predict the z-displacement needed for a given movement. """Predict the z-displacement needed for a given movement.
@ -98,7 +98,6 @@ class RomDataTracker:
z_dest = quadratic( z_dest = quadratic(
stage_position[axis] + (movement[axis] / pixel_step[axis]), *fit_params stage_position[axis] + (movement[axis] / pixel_step[axis]), *fit_params
) )
return int(z_dest - stage_position["z"]) return int(z_dest - stage_position["z"])
@ -192,7 +191,7 @@ class RangeofMotionThing(lt.Thing):
return { return {
"Time": total_time, "Time": total_time,
"CSM Matrix": csm.image_to_stage_displacement_matrix.tolist(), "CSM Matrix": csm.image_to_stage_displacement_matrix,
"Step Range": step_range, "Step Range": step_range,
} }

View file

@ -44,12 +44,10 @@ def increasing_xyz_dict_generator(*_args, **_kwargs):
@pytest.fixture @pytest.fixture
def csm_matrix(): def csm_matrix():
"""Return an example CSM matrix.""" """Return an example CSM matrix."""
return np.array( return [
[ [0.03061156624485296, 1.8031242270940833],
[0.03061156624485296, 1.8031242270940833], [1.773236372778601, 0.006660431608601435],
[1.773236372778601, 0.006660431608601435], ]
]
)
@pytest.fixture @pytest.fixture