fix: cleanup and bugfix in positioner; closes #84

This commit is contained in:
appel_c 2024-10-17 07:37:05 +02:00
parent fa32b4234b
commit 6a7c0745e3
3 changed files with 5 additions and 4 deletions

View File

@ -177,7 +177,8 @@ class SimPositioner(Device, PositionerBase):
st.set_exception(exc=exc)
finally:
self._set_sim_state(self.motor_is_moving.name, 0)
self._update_state(target)
if not self._stopped:
self._update_state(target)
def move(self, value: float, **kwargs) -> DeviceStatus:
"""Change the setpoint of the simulated device, and simultaneously initiate a motion."""

View File

@ -194,4 +194,4 @@ class SimWaveform(Device):
if __name__ == "__main__": # pragma: no cover
waveform = SimWaveform(name="waveform")
waveform.sim.sim_select_model("GaussianModel")
waveform.sim.select_model("GaussianModel")

View File

@ -608,7 +608,7 @@ def test_positioner_updated_timestamp(positioner):
def test_waveform(waveform):
"""Test the SimWaveform class"""
waveform.sim.sim_select_model("GaussianModel")
waveform.sim.select_model("GaussianModel")
waveform.sim.params = {"amplitude": 500, "center": 500, "sigma": 10}
data = waveform.waveform.get()
assert isinstance(data, np.ndarray)
@ -617,7 +617,7 @@ def test_waveform(waveform):
waveform.waveform_shape.put(50)
data = waveform.waveform.get()
for model in waveform.sim.get_all_sim_models():
waveform.sim.sim_select_model(model)
waveform.sim.select_model(model)
waveform.waveform.get()
# Now also test the async readback
mock_connector = waveform.connector = mock.MagicMock()