-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declarative EPICS and StandardReadable Devices #598
Conversation
Some thoughts from office conversations at ISIS (@rerpha):
Would appreciate being involved in the discussion if it looks like we might be going towards declarative route. |
One key point that came out of the discussion is that we should always be free to drop to procedural. We should always be able to have an The question here is should we support the declarative approach for a subset of the EPICS devices. I think the large number of areaDetector drivers and plugins we are writing are good use case for this, they have no logic, only interface, and are more naturally written in the declarative style. This would allow us to teach the declarative style first, then introduce the procedural style when we need the more complicated examples. Happy to discuss this in more detail on a zoom call |
@coretl and I discussed on zoom but will add the result of the discussion here:
This is fine from our perspective then - I was worried that the annotation style would be enforced, as long as procedural is still a supported option this is fine for us. |
I echo @Tom-Willemsen's thoughts. Prefer the more explicit procedural approach but happy if |
142a2b7
to
2837231
Compare
e16a364
to
5e5e2b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give a tentative approval, but I think we should have a review from someone from a dodal type layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation warnings fixed, approved
Add optional Declarative Device support Includes: - An ADR for optional Declarative Devices - Support for `StandardReadable` Declarative Devices via `StandardReadableFormat` annotations - Support for EPICS Declarative Devices via an `EpicsDevice` baseclass and `PvSuffic` annotations - Updates to the EPICS and Tango demo devices to use them Structure read from `.value` now includes `DeviceVector` support. Requires at least PandABlocks-ioc 0.11.2 `ophyd_async.epics.signal` moves to `ophyd_async.epics.core` with a backwards compat module that emits deprecation warning. ```python from ophyd_async.epics.signal import epics_signal_rw from ophyd_async.epics.core import epics_signal_rw ``` `StandardReadable` wrappers change to enum members of `StandardReadableFormat` (normally imported as `Format`) ```python from ophyd_async.core import ConfigSignal, HintedSignal class MyDevice(StandardReadable): def __init__(self): self.add_readables([sig1], ConfigSignal) self.add_readables([sig2], HintedSignal) self.add_readables([sig3], HintedSignal.uncached) from ophyd_async.core import StandardReadableFormat as Format class MyDevice(StandardReadable): def __init__(self): self.add_readables([sig1], Format.CONFIG_SIGNAL) self.add_readables([sig2], Format.HINTED_SIGNAL) self.add_readables([sig3], Format.HINTED_UNCACHED_SIGNAL ``` ```python from ophyd_async.core import ConfigSignal, HintedSignal from ophyd_async.epics.signal import epics_signal_r, epics_signal_rw class Sensor(StandardReadable): def __init__(self, prefix: str, name="") -> None: with self.add_children_as_readables(HintedSignal): self.value = epics_signal_r(float, prefix + "Value") with self.add_children_as_readables(ConfigSignal): self.mode = epics_signal_rw(EnergyMode, prefix + "Mode") super().__init__(name=name) from typing import Annotated as A from ophyd_async.core import StandardReadableFormat as Format from ophyd_async.epics.core import EpicsDevice, PvSuffix, epics_signal_r, epics_signal_rw class Sensor(StandardReadable, EpicsDevice): value: A[SignalR[float], PvSuffix("Value"), Format.HINTED_SIGNAL] mode: A[SignalRW[EnergyMode], PvSuffix("Mode"), Format.CONFIG_SIGNAL] ```
Add optional Declarative Device support
Includes:
StandardReadable
Declarative Devices viaStandardReadableFormat
annotationsEpicsDevice
baseclass andPvSuffic
annotationsChanges
pvi structure changes
Structure read from
.value
now includesDeviceVector
support. Requires at least PandABlocks-ioc 0.11.2Epics
signal
module movesophyd_async.epics.signal
moves toophyd_async.epics.core
with a backwards compat module that emits deprecation warning.StandardReadable
wrappers change toStandardReadableFormat
StandardReadable
wrappers change to enum members ofStandardReadableFormat
(normally imported asFormat
)Declarative Devices are now available