mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-02-07 15:48:40 +01:00
fix(shutter): Rename class, refactor is_open to be kind normal
This commit is contained in:
@@ -4,7 +4,7 @@ Module for the optics shutter device at PSI beamlines.
|
|||||||
Example config:
|
Example config:
|
||||||
shutter:
|
shutter:
|
||||||
description: Optics Shutter A
|
description: Optics Shutter A
|
||||||
deviceClass: ophyd_devices.optics_shutter.Shutter
|
deviceClass: ophyd_devices.optics_shutter.OpticsShutter
|
||||||
deviceConfig: {prefix: 'X10SA-EH1-PSYS:SH-A-'}
|
deviceConfig: {prefix: 'X10SA-EH1-PSYS:SH-A-'}
|
||||||
enabled: true
|
enabled: true
|
||||||
onFailure: retry
|
onFailure: retry
|
||||||
@@ -80,7 +80,7 @@ class ShutterOpenSignal(Signal):
|
|||||||
return CompareStatus(self.parent.epics_control.is_open, value)
|
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."""
|
"""A shutter device with shutter open signal, and sub-device with full control PVs of the Epics implementation."""
|
||||||
|
|
||||||
set_open = Cpt(
|
set_open = Cpt(
|
||||||
@@ -92,7 +92,7 @@ class Shutter(Device):
|
|||||||
is_open = Cpt(
|
is_open = Cpt(
|
||||||
EpicsSignalRO,
|
EpicsSignalRO,
|
||||||
"OPEN",
|
"OPEN",
|
||||||
kind=Kind.config,
|
kind=Kind.normal,
|
||||||
auto_monitor=True,
|
auto_monitor=True,
|
||||||
doc="Readback of the shutter open state. 0 (CLOSED) or 1 (OPEN).",
|
doc="Readback of the shutter open state. 0 (CLOSED) or 1 (OPEN).",
|
||||||
)
|
)
|
||||||
@@ -102,6 +102,6 @@ class Shutter(Device):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
prefix = "X10SA-EH1-PSYS:SH-A-"
|
prefix = "X10SA-EH1-PSYS:SH-A-"
|
||||||
print(f"Testing shutter device with prefix {prefix}")
|
print(f"Testing shutter device with prefix {prefix}")
|
||||||
shutter = Shutter(name="shutter", prefix=prefix)
|
shutter = OpticsShutter(name="shutter", prefix=prefix)
|
||||||
shutter.wait_for_connection()
|
shutter.wait_for_connection()
|
||||||
print(shutter.read())
|
print(shutter.read())
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import pytest
|
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
|
from ophyd_devices.tests.utils import patched_device
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def mock_shutter():
|
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
|
yield shutter
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user