tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Ophyd Tutorial cannot import set_and_wait

Open davidpcls opened this issue 2 months ago • 0 comments

Looks like set_and_wait was changed in release 1.7.0 (2022-08-04) of Ophyd and this breaks the tutorial "ophyd/03 - Staging.ipynb". I tried to figure out what the release notes were trying to tell me needed to change but couldn't make any progress.

Here's the line in the release notes:

Deprecated ophyd.utils.epics_pv.set_and_wait(obj, val) in favor of obj.set(val).wait(). This ensures that the same logic is used to determine if the signal is set as requested when used in a plan (via yield from bps.abs_set(...) or yield from bps.mv(...)) as from within ophyd methods.

And the error reported by jupyter labs in the docker container:

--------------------------------------------------------------------------- ImportError Traceback (most recent call last) Cell In[21], line 1 ----> 1 from ophyd import Device, Component, EpicsSignal, EpicsSignalRO, set_and_wait, DeviceStatus 2 import time 4 class TriggeredDetector(Device): ImportError: cannot import name 'set_and_wait' from 'ophyd' (/srv/conda/envs/notebook/lib/python3.10/site-packages/ophyd/`init.py)

Any suggestions would be appreciated!

davidpcls avatar Nov 06 '25 20:11 davidpcls