From 86436c59865628aba6afbf8947a901bf653b50ad Mon Sep 17 00:00:00 2001 From: appel_c Date: Mon, 1 Dec 2025 10:48:27 +0100 Subject: [PATCH] fix(shutter): Rename class, refactor is_open to be kind normal --- ophyd_devices/devices/optics_shutter.py | 8 ++++---- tests/test_shutter.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ophyd_devices/devices/optics_shutter.py b/ophyd_devices/devices/optics_shutter.py index 4026d59..8e33e06 100644 --- a/ophyd_devices/devices/optics_shutter.py +++ b/ophyd_devices/devices/optics_shutter.py @@ -4,7 +4,7 @@ Module for the optics shutter device at PSI beamlines. Example config: shutter: description: Optics Shutter A - deviceClass: ophyd_devices.optics_shutter.Shutter + deviceClass: ophyd_devices.optics_shutter.OpticsShutter deviceConfig: {prefix: 'X10SA-EH1-PSYS:SH-A-'} enabled: true onFailure: retry @@ -80,7 +80,7 @@ class ShutterOpenSignal(Signal): return CompareStatus(self.parent.epics_control.is_open, value) -class Shutter(Device): +class OpticsShutter(Device): """A shutter device with shutter open signal, and sub-device with full control PVs of the Epics implementation.""" set_open = Cpt( @@ -92,7 +92,7 @@ class Shutter(Device): is_open = Cpt( EpicsSignalRO, "OPEN", - kind=Kind.config, + kind=Kind.normal, auto_monitor=True, doc="Readback of the shutter open state. 0 (CLOSED) or 1 (OPEN).", ) @@ -102,6 +102,6 @@ class Shutter(Device): if __name__ == "__main__": prefix = "X10SA-EH1-PSYS:SH-A-" print(f"Testing shutter device with prefix {prefix}") - shutter = Shutter(name="shutter", prefix=prefix) + shutter = OpticsShutter(name="shutter", prefix=prefix) shutter.wait_for_connection() print(shutter.read()) diff --git a/tests/test_shutter.py b/tests/test_shutter.py index 016e31c..67e1d83 100644 --- a/tests/test_shutter.py +++ b/tests/test_shutter.py @@ -1,12 +1,12 @@ import pytest -from ophyd_devices.devices.optics_shutter import Shutter, ShutterEnabled, ShutterOpenState +from ophyd_devices.devices.optics_shutter import OpticsShutter, ShutterEnabled, ShutterOpenState from ophyd_devices.tests.utils import patched_device @pytest.fixture(scope="function") def mock_shutter(): - with patched_device(Shutter, name="shutter", prefix="X10SA-EH1-PSYS:SH-A-") as shutter: + with patched_device(OpticsShutter, name="shutter", prefix="X10SA-EH1-PSYS:SH-A-") as shutter: yield shutter