ophyd
raw JSON → 1.11.1 verified Fri May 01 auth: no python
Ophyd is a hardware abstraction library for the Bluesky framework with an emphasis on EPICS. It provides a device-oriented API for control system signals, motors, area detectors, and more. Currently at version 1.11.1, it is under active development with regular releases. Requires Python >=3.8.
pip install ophyd Common errors
error ModuleNotFoundError: No module named 'epics' ↓
cause Missing PyEpics package for EPICS communication.
fix
pip install pyepics or conda install -c conda-forge pyepics
error TimeoutError: Connection to PV '...' timed out after 2.00 seconds ↓
cause EPICS PV not available or network issue.
fix
Verify PV exists and network is reachable. Increase timeout via 'timeout' parameter in EpicsSignal(..., timeout=10).
error ImportError: cannot import name 'Component' from 'ophyd.device' ↓
cause Direct import from internal module instead of top-level.
fix
Use 'from ophyd import Component'
error AttributeError: 'EpicsSignal' object has no attribute 'set_and_wait' ↓
cause Deprecated function removed or renamed.
fix
Replace with 'signal.set(value)' and use status objects or await.
Warnings
breaking Inophyd v1.10.0, the EPICS backend API changed. Fallback backends are now class-based instead of function-based. Code using custom backends may need updates. ↓
fix Review migration notes at https://blueskyproject.io/ophyd/upcoming-changes.html
deprecated The function 'set_and_wait' is deprecated since v1.7.0 and may be removed in future releases. ↓
fix Use Signal.set() with await or status events instead.
gotcha EpicsSignal and EpicsMotor require a connection to the EPICS PV. If the PV does not exist, connecting will block until timeout (default 2.0 seconds in v1.10.5+). ↓
fix Set 'wait_for_connection=False' and check connection status manually, or increase timeout via timeout kwarg.
gotcha DeviceStatus reports a fraction of 1.0 once complete as of v1.7.0. Code relying on a fraction of 0.0 after completion will break. ↓
fix Adjust code to handle updated fraction value.
breaking In v1.8.0, isort was adopted; imports may need reorganization. Also, setuptools-scm replaced manual versioning. ↓
fix No direct breakage, but import ordering may require changes if using strict flake8 or isort checks.
deprecated The 'user_v2' module is removed as of v1.10.0. Use the standard 'ophyd' API instead. ↓
fix Replace 'from ophyd import user_v2' with direct imports from ophyd.
Install
conda install -c conda-forge ophyd Imports
- EpicsSignal
from ophyd import EpicsSignal - EpicsMotor
from ophyd import EpicsMotor - Device
from ophyd import Device - Signal
from ophyd import Signal - Component wrong
from ophyd.device import Componentcorrectfrom ophyd import Component - DynamicDeviceComponent wrong
from ophyd.device import DynamicDeviceComponentcorrectfrom ophyd import DynamicDeviceComponent
Quickstart
from ophyd import EpicsSignal, EpicsMotor
from ophyd import Component, Device
# Create a simple EPICS signal
sig = EpicsSignal('MYPV:PREFIX', name='my_signal')
sig.wait_for_connection()
print(sig.get())
# Create a motor
motor = EpicsMotor('MYMOTOR:PREFIX', name='my_motor')
motor.wait_for_connection()
print(motor.user_readback.get())
# Define a composite device
class MyDevice(Device):
x = Component(EpicsMotor, 'X')
y = Component(EpicsMotor, 'Y')
detector = Component(EpicsSignal, 'Det')
dev = MyDevice('MYDEV:', name='my_device')
dev.wait_for_connection()
print(dev.detector.get())