secop_ophyd.devices.writable#

Devices for SECoP modules with a ‘target’: their common base, and the device for the interface class Writable.

Module Contents#

Classes#

SECoPWritableBase

Common base of all device classes for SECoP modules with a ‘target’: the interface classes “Writable” and “Drivable”.

SECoPWritableMock

Mock behaviour for SECoP Writable modules, and for Drivable modules with a struct/tuple ‘value’ or ‘target’: start IDLE. SECoPWritableDevice.set() itself moves the mocked signals to the target instantly.

SECoPWritableDevice

Settable SECoP device, corresponding to a SECoP module with the interface class “Writable”: a module with a ‘target’ but without a ‘stop’ command.

Data#

T

API#

class secop_ophyd.devices.writable.SECoPWritableBase(sri: str = '', name: str = '', connector: secop_ophyd.devices.connector.SECoPDeviceConnector | None = None, loglevel=logging.INFO, logdir: str | None = None)[source]#

Bases: secop_ophyd.devices.readable.SECoPReadableDevice

Common base of all device classes for SECoP modules with a ‘target’: the interface classes “Writable” and “Drivable”.

Initialization

Initializes the SECoPReadableDevice

Parameters:
  • secclient (AsyncSecopClient) – SECoP client providing communication to the SEC Node

  • module_name (str) – Name of the SEC Node module that is represented by this device

hinted_signals: list[str] = ['target', 'value']#
mandatory_parameters: list[str] = None#
secop_ophyd.devices.writable.T = 'TypeVar(...)'#
class secop_ophyd.devices.writable.SECoPWritableMock(name: str = '', parent: ophyd_async.core._device.DeviceMock | None = None)[source]#

Bases: ophyd_async.core.DeviceMock[SECoPWritableDevice]

Mock behaviour for SECoP Writable modules, and for Drivable modules with a struct/tuple ‘value’ or ‘target’: start IDLE. SECoPWritableDevice.set() itself moves the mocked signals to the target instantly.

Initialization

async connect(device: secop_ophyd.devices.writable.SECoPWritableDevice) → None[source]#
class secop_ophyd.devices.writable.SECoPWritableDevice(sri: str = '', name: str = '', connector: secop_ophyd.devices.connector.SECoPDeviceConnector | None = None, loglevel=logging.INFO, logdir: str | None = None)[source]#

Bases: secop_ophyd.devices.writable.SECoPWritableBase, bluesky.protocols.Locatable[secop_ophyd.devices.writable.T], bluesky.protocols.Checkable[secop_ophyd.devices.writable.T], typing.Generic[secop_ophyd.devices.writable.T]

Settable SECoP device, corresponding to a SECoP module with the interface class “Writable”: a module with a ‘target’ but without a ‘stop’ command.

set() writes ‘target’ and waits until the module is not BUSY. For a module whose value follows the target at once that is immediately; a Writable that needs time to reach its target reports BUSY meanwhile. The module must report BUSY by the time it answers the target write, or set() ends at once: SECoP has no other sign that a move has started. locate() returns the setpoint (‘target’) and readback (‘value’).

‘target’ and ‘value’ may be of any SECoP datatype. For a struct or tuple, the position is one value in set() and locate(), but several data keys in read() and describe(), because an event can only hold scalars and arrays:

  • set() takes the whole target: a dict for a struct, a tuple for a tuple. locate() returns setpoint and readback in the same form.

  • read() has one key per member, from the read-only Signals target_<member> and value_<member> (_0, _1, … for a tuple). locate()["readback"]["x"] is the value of value_x.

set() is the only way to change a struct/tuple target: there is no writable ‘target’ Signal for it. An atomic ‘target’ is also a SignalRW, whose set() only writes the parameter, without waiting.

The type parameter is the type of the target, e.g. float, or a TypedDict in a generated device class.

Initialization

Initializes the SECoPReadableDevice

Parameters:
  • secclient (AsyncSecopClient) – SECoP client providing communication to the SEC Node

  • module_name (str) – Name of the SEC Node module that is represented by this device

async check_value(value: secop_ophyd.devices.writable.T) → None[source]#

Check that value is a valid target, without moving. In mock mode there is no node description to check against, so every value passes.

async set(value: secop_ophyd.devices.writable.T, timeout: float | None = None) → None[source]#

Set the target and wait until the module is not BUSY.

async locate() → bluesky.protocols.Location[secop_ophyd.devices.writable.T][source]#

Return the current setpoint (‘target’) and readback (‘value’).