From bb6bd111d08246d2083cadf883a1bfd968af3dee Mon Sep 17 00:00:00 2001 From: x12sa Date: Mon, 5 Oct 2026 22:39:01 +0200 Subject: [PATCH] fix(eiger): expose auto_reinitialize as a device attribute The device server applies deviceConfig entries via update_config, which rejects keys that are not attributes of the device ("Unknown config parameter"). A constructor argument alone is therefore not enough to set auto_reinitialize from the config. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01YAEkW1wjZszVKkhQrD8Ad5 --- csaxs_bec/devices/jungfraujoch/eiger.py | 12 ++++++++++++ tests/tests_devices/test_eiger.py | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/csaxs_bec/devices/jungfraujoch/eiger.py b/csaxs_bec/devices/jungfraujoch/eiger.py index bd31b2e9..d7b183ec 100644 --- a/csaxs_bec/devices/jungfraujoch/eiger.py +++ b/csaxs_bec/devices/jungfraujoch/eiger.py @@ -247,6 +247,18 @@ class Eiger(PSIDeviceBase): return self.preview_image.put(frame) + # NOTE The device server applies every deviceConfig entry through update_config, which only + # accepts keys that exist as attributes of the device. Hence this needs to be a property, + # a constructor argument alone is rejected with 'Unknown config parameter'. + # pylint: disable=missing-function-docstring + @property + def auto_reinitialize(self) -> bool: + return self._auto_reinitialize + + @auto_reinitialize.setter + def auto_reinitialize(self, value: bool) -> None: + self._auto_reinitialize = bool(value) + # pylint: disable=missing-function-docstring @property def detector_distance(self) -> float: diff --git a/tests/tests_devices/test_eiger.py b/tests/tests_devices/test_eiger.py index 2b966dc7..29dfeef3 100644 --- a/tests/tests_devices/test_eiger.py +++ b/tests/tests_devices/test_eiger.py @@ -903,3 +903,12 @@ def test_jfj_client_wait_for_idle_reports_broker_message(): with pytest.raises(JungfrauJochClientError, match="WrongDAQState"): client.wait_for_idle(timeout=1) assert client.wait_for_idle(timeout=1, raise_on_timeout=False) is False + + +def test_eiger_auto_reinitialize_is_a_config_attribute(eiger_1_5m): + """The device server rejects deviceConfig keys that are not attributes of the device.""" + eiger = eiger_1_5m + assert hasattr(eiger, "auto_reinitialize") + assert eiger.auto_reinitialize is False + eiger.auto_reinitialize = True + assert eiger._auto_reinitialize is True