You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the DG-645 is listed here but I don't see any issues or commits that add it. Happy to do it myself, just checking before I get started in case it's been done already. Thanks!
@prjemian, putting this here so it's documented in case anyone runs into this problem.
The DG-645 support I put in the PR uses a subclass of ophyd.EpicsSignal: EpicsSignalWithIO.
I came across an edge case where if you use the DG645 delay device with ophyd.sim.make_fake_device it doesn't recognize EpicsSignalWithIO, and so doesn't fake it. You can still create a fake device from it, but if you access any of the signals that use the custom EpicsSignalWithIO class, it will time out because the PV is not available:
fromophyd.simimportmake_fake_devicefromapstools.devices.delayimportDG645Delay@pytest.fixture()deffake_delay():
Delay=make_fake_device(DG645Delay)
returnDelay("255id:DG645:", name="fake_delay")
deftest_fake_delay(fake_delay):
fake_delay.label.get() # Success, since it's a regular EpicsSignalfake_delay.dhcp_state.get() # TimeoutError, since it's an EpicsSignalWithIO
Ophyd sim module builds a cache of signals that it knows how to fake, so we can add our own fake signal to the cache before calling make_fake_device(DG645Delay). The solution then, assuming you use pytest, is to place the following in conftest.py
fromophyd.simimportFakeEpicsSignal, fake_device_cachefromapstools.devices.delayimportEpicsSignalWithIOclassFakeEpicsSignalWithIO(FakeEpicsSignal):
"""An EPICS signal that simply uses the DG-645 convention of 'AO' being the setpoint and 'AI' being the read-back."""_metadata_keys=EpicsSignalWithIO._metadata_keysdef__init__(self, prefix, **kwargs):
super().__init__(f"{prefix}I", write_pv=f"{prefix}O", **kwargs)
fake_device_cache[EpicsSignalWithIO] =FakeEpicsSignalWithIO
I noticed the DG-645 is listed here but I don't see any issues or commits that add it. Happy to do it myself, just checking before I get started in case it's been done already. Thanks!
Originally posted by @canismarko in #489 (comment)
The text was updated successfully, but these errors were encountered: