From 8d53cb15917555ac8e2d1a47f0fd09d9ccc4de95 Mon Sep 17 00:00:00 2001 From: David Perl Date: Wed, 25 Nov 2026 15:25:48 +0100 Subject: [PATCH] fix: pass timeout to smargon nudge --- mx_bec/devices/smargopolo_smargon.py | 9 +++++++-- tests/unit/test_smargon.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mx_bec/devices/smargopolo_smargon.py b/mx_bec/devices/smargopolo_smargon.py index 6360929..5772a02 100644 --- a/mx_bec/devices/smargopolo_smargon.py +++ b/mx_bec/devices/smargopolo_smargon.py @@ -54,7 +54,12 @@ class Smargon(HttpOphydDevice): chi = Cpt(HttpDeviceSignal, axis_identifier="CHI", tolerance=0.01) def nudge_in_lab_frame( - self, x_mm: float, y_mm: float, z_mm: float = 0.0, omega_deg: float = 0.0 + self, + x_mm: float, + y_mm: float, + z_mm: float = 0.0, + omega_deg: float = 0.0, + timeout_s: float | None = 2.0, ): """Apply a relative move in the lab frame (adjusted for the rotation angle, assuming that the frames are identical when omega = phi = chi = 0). `omega_deg` is the angle of the @@ -66,7 +71,7 @@ class Smargon(HttpOphydDevice): self.x.set(self.x.get() + x_mm) & self.y.set(self.y.get() + y_mm) & self.z.set(self.z.get() + z_mm) - ).wait() + ).wait(timeout=timeout_s) def _lab_frame_offset_to_smargon_nudge( self, x_mm: float, y_mm: float, z_mm: float = 0.0, omega_deg: float = 0.0 diff --git a/tests/unit/test_smargon.py b/tests/unit/test_smargon.py index d6c4dac..1157d7b 100644 --- a/tests/unit/test_smargon.py +++ b/tests/unit/test_smargon.py @@ -66,11 +66,11 @@ def test_set_sends_only_that_axis(smargon): def test_nudge_in_lab_frame_at_zero_angles(smargon): # With omega = phi = chi = 0 a lab-frame x offset is a smargon -z move, y -> -x, z -> -y - smargon.nudge_in_lab_frame(0.2, 0.0, 0.0).wait(timeout=2) + smargon.nudge_in_lab_frame(0.2, 0.0, 0.0) assert smargon.z.get() == pytest.approx(-0.2, abs=TOL) assert smargon.x.get() == pytest.approx(0.0, abs=TOL) assert smargon.y.get() == pytest.approx(0.0, abs=TOL) - smargon.nudge_in_lab_frame(0.0, 0.2, 0.0).wait(timeout=2) + smargon.nudge_in_lab_frame(0.0, 0.2, 0.0) assert smargon.x.get() == pytest.approx(-0.2, abs=TOL)