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
New to ophyd, and immediatlely hit a problem... The tutorial to Make a Simple Device appears to be broken.
Minimal example taken from the source:
"""Demo EPICS Devices for the tutorial"""fromenumimportEnumfromophyd.v2.coreimportStandardReadablefromophyd.v2.epicsimportepics_signal_r, epics_signal_rwclassEnergyMode(Enum):
"""Energy mode for `Sensor`"""#: Low energy modelow="Low Energy"#: High energy modehigh="High Energy"classSensor(StandardReadable):
"""A demo sensor that produces a scalar value based on X and Y Movers"""def__init__(self, prefix: str, name="") ->None:
# Define some signalsself.value=epics_signal_r(float, prefix+"Value")
self.mode=epics_signal_rw(EnergyMode, prefix+"Mode")
# Set name and signals for read() and read_configuration()self.set_readable_signals(
read=[self.value],
config=[self.mode],
)
super().__init__(name=name)
s=Sensor('test')
yields:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 31
25 self.set_readable_signals(
26 read=[self.value],
27 config=[self.mode],
28 )
29 super().__init__(name=name)
---> 31 s = Sensor('test')
Cell In[2], line 22, in Sensor.__init__(self, prefix, name)
20 def __init__(self, prefix: str, name="") -> None:
21 # Define some signals
---> 22 self.value = epics_signal_r(float, prefix + "Value")
23 self.mode = epics_signal_rw(EnergyMode, prefix + "Mode")
24 # Set name and signals for read() and read_configuration()
File [~/.python/py3/lib/python3.11/site-packages/ophyd/v2/epics.py:87](https://file+.vscode-resource.vscode-cdn.net/home/oscar/CamDrive/bluesky/~/.python/py3/lib/python3.11/site-packages/ophyd/v2/epics.py:87), in epics_signal_r(datatype, read_pv)
77 def epics_signal_r(datatype: Type[T], read_pv: str) -> SignalR[T]:
78 """Create a `SignalR` backed by 1 EPICS PV
79
80 Parameters
(...)
85 The PV to read and monitor
86 """
---> 87 backend = _make_backend(datatype, read_pv, read_pv)
88 return SignalR(backend)
File [~/.python/py3/lib/python3.11/site-packages/ophyd/v2/epics.py:56](https://file+.vscode-resource.vscode-cdn.net/home/oscar/CamDrive/bluesky/~/.python/py3/lib/python3.11/site-packages/ophyd/v2/epics.py:56), in _make_backend(datatype, read_pv, write_pv)
54 w_transport, w_pv = _transport_pv(write_pv)
55 transport = get_unique({read_pv: r_transport, write_pv: w_transport}, "transports")
---> 56 return transport.value(datatype, r_pv, w_pv)
AttributeError: 'function' object has no attribute 'value'
Running ophyd '1.8.0'.
The text was updated successfully, but these errors were encountered:
The problem is that ophyd v2 supports both CA and PVA, so the base install doesn't install either. You need to pip install ophyd[ca] to get the CA libraries. Unfortunately this isn't added in the tutorials, I have done so in #1133. The error message is bad because of #1113 which was fixed a few days ago but hasn't been released yet. To test this theory, please can you do the following:
Post the output of pip freeze
Do a pip install git+https://github.com/bluesky/ophyd.git and run the tutorial code again, and check you get a better error message saying something like "CA support not available"
Do a pip install ophyd[ca] and the tutorial should work
New to ophyd, and immediatlely hit a problem... The tutorial to Make a Simple Device appears to be broken.
Minimal example taken from the source:
yields:
Running ophyd '1.8.0'.
The text was updated successfully, but these errors were encountered: