ophyd_async.epics.core#

Package Contents#

Classes#

PviDeviceConnector

Connect to PVI structure served over PVA.

EpicsDeviceConnector

Used for connecting signals to static EPICS pvs.

PvSuffix

Define the PV suffix to be appended to the device prefix.

EpicsDevice

Baseclass to allow child signals to be created declaratively.

Functions#

epics_signal_r

Create a SignalR backed by 1 EPICS PV.

epics_signal_rw

Create a SignalRW backed by 1 or 2 EPICS PVs.

epics_signal_rw_rbv

Create a SignalRW backed by 1 or 2 EPICS PVs, with a suffix on the readback pv.

epics_signal_w

Create a SignalW backed by 1 EPICS PVs.

epics_signal_x

Create a SignalX backed by 1 EPICS PVs.

API#

class ophyd_async.epics.core.PviDeviceConnector(prefix: str = '', error_hint: str = '')[source]#

Bases: ophyd_async.core.DeviceConnector

Connect to PVI structure served over PVA.

At init, fill in all the type hinted signals. At connection check their types and fill in any extra signals.

Parameters:
  • prefix – The PV prefix of the device, “PVI” will be appended to it to get the PVI PV.

  • error_hint – If given, this will be appended to the error message if any of they type hinted Signals are not present.

create_children_from_annotations(device: Device)[source]#

Use when children can be created from introspecting the hardware.

Some control systems allow introspection of a device to determine what children it has. To allow this to work nicely with typing we add these hints to the Device like so::

my_signal: SignalRW[int]
my_device: MyDevice

This method will be run during Device.__init__, and is responsible for turning all of those type hints into real Signal and Device instances.

Subsequent runs of this function should do nothing, to allow it to be called early in Devices that need to pass references to their children during __init__.

async connect_mock(device: Device, mock: LazyMock)[source]#

Use during Device.connect with mock=True.

This is called when there is no cached connect done in mock=True mode. It connects the Device and all its children in mock mode.

async connect_real(device: Device, timeout: float, force_reconnect: bool) None[source]#

Use during Device.connect with mock=False.

This is called when there is no cached connect done in mock=False mode. It connects the Device and all its children in real mode in parallel.

class ophyd_async.epics.core.EpicsDeviceConnector(prefix: str)[source]#

Bases: ophyd_async.core.DeviceConnector

Used for connecting signals to static EPICS pvs.

create_children_from_annotations(device: Device)[source]#

Use when children can be created from introspecting the hardware.

Some control systems allow introspection of a device to determine what children it has. To allow this to work nicely with typing we add these hints to the Device like so::

my_signal: SignalRW[int]
my_device: MyDevice

This method will be run during Device.__init__, and is responsible for turning all of those type hints into real Signal and Device instances.

Subsequent runs of this function should do nothing, to allow it to be called early in Devices that need to pass references to their children during __init__.

class ophyd_async.epics.core.PvSuffix[source]#

Define the PV suffix to be appended to the device prefix.

read_suffix: str#

None

write_suffix: str | None#

None

classmethod rbv(write_suffix: str, rbv_suffix: str = '_RBV') PvSuffix[source]#
class ophyd_async.epics.core.EpicsDevice(prefix: str, with_pvi: bool = False, name: str = '')[source]#

Bases: ophyd_async.core.Device

Baseclass to allow child signals to be created declaratively.

ophyd_async.epics.core.epics_signal_r(datatype: type[SignalDatatypeT], read_pv: str, name: str = '') SignalR[SignalDatatypeT][source]#

Create a SignalR backed by 1 EPICS PV.

Parameters:
  • datatype – Check that the PV is of this type

  • read_pv – The PV to read from

ophyd_async.epics.core.epics_signal_rw(datatype: type[SignalDatatypeT], read_pv: str, write_pv: str | None = None, name: str = '') SignalRW[SignalDatatypeT][source]#

Create a SignalRW backed by 1 or 2 EPICS PVs.

Parameters:
  • datatype – Check that the PV is of this type

  • read_pv – The PV to read and monitor

  • write_pv – If given, use this PV to write to, otherwise use read_pv

ophyd_async.epics.core.epics_signal_rw_rbv(datatype: type[SignalDatatypeT], write_pv: str, read_suffix: str = '_RBV', name: str = '') SignalRW[SignalDatatypeT][source]#

Create a SignalRW backed by 1 or 2 EPICS PVs, with a suffix on the readback pv.

Parameters:
  • datatype – Check that the PV is of this type

  • write_pv – The PV to write to

  • read_suffix – Append this suffix to the write pv to create the readback pv

ophyd_async.epics.core.epics_signal_w(datatype: type[SignalDatatypeT], write_pv: str, name: str = '') SignalW[SignalDatatypeT][source]#

Create a SignalW backed by 1 EPICS PVs.

Parameters:
  • datatype – Check that the PV is of this type

  • write_pv – The PV to write to

ophyd_async.epics.core.epics_signal_x(write_pv: str, name: str = '') SignalX[source]#

Create a SignalX backed by 1 EPICS PVs.

Parameters:
  • write_pv – The PV to write its initial value to on trigger

  • name – The name of the signal