secop_ophyd.signals.backend#

Signal backend for SECoP parameters, properties and struct/tuple members, and the check of the datatype a signal is annotated with.

Module Contents#

Classes#

AttributeType

SECoPBackend

Unified backend for SECoP Parameters, Properties, and split composite Members (one struct field / tuple index of a decomposed “depth <= MAX_DEPTH” StructOf/TupleOf parameter).

Functions#

check_annotated_datatype

Raise TypeError if the datatype from a class annotation (annotated) does not fit what the SEC node describes (secop_dtype, mapped to the Signal datatype described).

API#

secop_ophyd.signals.backend.check_annotated_datatype(annotated: Any, secop_dtype: frappy.datatypes.DataType, described: Any, what: str) → None[source]#

Raise TypeError if the datatype from a class annotation (annotated) does not fit what the SEC node describes (secop_dtype, mapped to the Signal datatype described).

Enum annotations must match the node’s enum members: exactly for a StrictEnum, as a subset for a SubsetEnum and as a superset for a SupersetEnum.

class secop_ophyd.signals.backend.AttributeType[source]#

Bases: ophyd_async.core.StrictEnum

PARAMETER = 'parameter'#
PROPERTY = 'property'#
MEMBER = 'member'#
class secop_ophyd.signals.backend.SECoPBackend(datatype: type[ophyd_async.core.SignalDatatypeT] | None, path: str | None = None, attribute_type: str | None = None, secclient: secop_ophyd.AsyncFrappyClient.AsyncSecopClient | None = None)[source]#

Bases: ophyd_async.core.SignalBackend[ophyd_async.core.SignalDatatypeT]

Unified backend for SECoP Parameters, Properties, and split composite Members (one struct field / tuple index of a decomposed “depth <= MAX_DEPTH” StructOf/TupleOf parameter).

This allows a single backend type to be used in signal_backend_factory (DeviceFiller always constructs the same backend class for every child Signal, regardless of what Signal subclass – SignalR/SignalW/SignalRW – it ends up wrapped in), with deferred initialization based on annotation metadata.

Several MEMBER backends typically share the same underlying (module, parent_param) SECoP parameter – one per member. Each fetches the parent’s raw wire reading and extracts its own field; no extra network round-trips are incurred since AsyncFrappyClient.get_parameter(…, trycache=True) is backed by frappy’s own per-(module, parameter) cache.

Initialization

Initialize backend (supports deferred initialization).

Args:

datatype: Optional datatype for the signal path: Optional path for immediate initialization (module:param or prop_key) secclient: Optional SECoP client for immediate initialization

format: ophyd_async.core.StandardReadableFormat = None#
attribute_type: str | None = None#
path_str: str = None#
SECoPdtype_obj: frappy.datatypes.DataType = None#
SECoP_type_info: secop_ophyd.datatypes.secop_dtype.SECoPdtype = None#
describe_dict: dict = None#
init_parameter_from_introspection(datatype: type[ophyd_async.core.SignalDatatypeT], path: str, secclient: secop_ophyd.AsyncFrappyClient.AsyncSecopClient)[source]#
init_property_from_introspection(datatype: type[ophyd_async.core.SignalDatatypeT], path: str, secclient: secop_ophyd.AsyncFrappyClient.AsyncSecopClient)[source]#
init_member_from_introspection(module_name: str, parent_param: str, member_key: str, member_datatype: frappy.datatypes.DataType, secclient: secop_ophyd.AsyncFrappyClient.AsyncSecopClient) → None[source]#

Bind this backend to one member (struct field / tuple index) of a decomposed composite parameter. Fully initialized eagerly here (rather than deferred to connect(), like _init_parameter/_init_property) since a member’s own datatype is fully known once the parent parameter has been introspected – mirrors SECoPCommandBackend’s single-phase init.

source(name: str, read: bool) → str[source]#
async connect(timeout: float)[source]#

Connect and initialize backend (parameters/properties are deferred-initialized here; members are already fully initialized by init_member_from_introspection).

async put(value: Any | None)[source]#

Put a value to the parameter. Properties and struct/tuple members are read-only.

async get_datakey(source: str) → bluesky.protocols.DataKey[source]#

Metadata like source, dtype, shape, precision, units

async get_reading() → bluesky.protocols.Reading[ophyd_async.core.SignalDatatypeT][source]#

Get reading, handling parameters, properties, and members.

async get_value() → ophyd_async.core.SignalDatatypeT[source]#
async get_location() → bluesky.protocols.Location[ophyd_async.core.SignalDatatypeT][source]#
set_callback(callback: ophyd_async.core.Callback[bluesky.protocols.Reading[ophyd_async.core.SignalDatatypeT]] | None) → None[source]#
get_param_path()[source]#
get_path_tuple()[source]#