secop_ophyd.util#
Module Contents#
Classes#
A DataKey that is used to describe the SECoP Datatype. |
|
Functions#
Convert SECoP enum member name to Python identifier. |
|
Map a SECoP command argument/result datatype to a plain python type. |
|
Render a python type object as it should appear in generated source, e.g. int -> “int”, dict[str, Any] -> “dict[str, Any]”. |
|
Render a SECoP command argument/result datatype as a python type string, e.g. for use in a generated Command[[ArgT], ResT] annotation. |
|
Build the call signature for a SECoP command’s argument(s)/result. |
Data#
API#
- secop_ophyd.util.SCALAR_DATATYPES = ()#
- class secop_ophyd.util.SECoPDataKey[source]#
Bases:
event_model.DataKeyA DataKey that is used to describe the SECoP Datatype.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- dtype_str: typing_extensions.NotRequired[str] = None#
The array-protocol typestring of the data-type object.
- exception secop_ophyd.util.NestedRaggedArray[source]#
Bases:
ExceptionThe Datatype contains nested ragged arrays
Initialization
Initialize self. See help(type(self)) for accurate signature.
- class secop_ophyd.util.DtypeNP[source]#
Bases:
abc.ABC- secop_dtype: frappy.datatypes.DataType = None#
- abstractmethod make_concrete_numpy_dtype(value) tuple[source]#
Create Numpy Compatible structured Datatype from a concrete data value
- secop_ophyd.util.dt_factory(secop_dt: frappy.datatypes.DataType, name: str = '', array_element: bool = False) secop_ophyd.util.DtypeNP[source]#
- secop_ophyd.util.STR_LEN_DEFAULT = 100#
- class secop_ophyd.util.BLOBNP(blob_dt: frappy.datatypes.BLOBType, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.BoolNP(bool_dt: frappy.datatypes.BoolType, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.EnumNP(enum_dt: frappy.datatypes.EnumType, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.FloatNP(float_dt: frappy.datatypes.FloatRange, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.IntNP(int_dt: frappy.datatypes.IntRange, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.ScaledIntNP(scaled_int_dt: frappy.datatypes.ScaledInteger, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.StringNP(string_dt: frappy.datatypes.StringType, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.StructNP(struct_dt: frappy.datatypes.StructOf, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.TupleNP(tuple_dt: frappy.datatypes.TupleOf, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP
- class secop_ophyd.util.ArrayNP(array_dt: frappy.datatypes.ArrayOf, name: str = '', array_element: bool = False)[source]#
Bases:
secop_ophyd.util.DtypeNP- make_secop_compatible_object(value: numpy.ndarray) Any[source]#
- secop_ophyd.util.secop_enum_name_to_python(member_name: str) str[source]#
Convert SECoP enum member name to Python identifier.
- Examples:
‘Low Energy’ -> ‘LOW_ENERGY’ ‘high-power’ -> ‘HIGH_POWER’ ‘Mode 1’ -> ‘MODE_1’
- Parameters:
member_name – Original SECoP enum member name
- Returns:
Python-compatible identifier in UPPER_CASE
- secop_ophyd.util.command_dtype_to_python_type(datatype: frappy.datatypes.DataType) type[source]#
Map a SECoP command argument/result datatype to a plain python type.
- secop_ophyd.util.python_type_to_str(python_type: Any) str[source]#
Render a python type object as it should appear in generated source, e.g. int -> “int”, dict[str, Any] -> “dict[str, Any]”.
- secop_ophyd.util.command_dtype_to_annotation_str(datatype: frappy.datatypes.DataType) str[source]#
Render a SECoP command argument/result datatype as a python type string, e.g. for use in a generated Command[[ArgT], ResT] annotation.
- secop_ophyd.util.build_command_signature(cmd_datatype: frappy.datatypes.CommandType, annotated_signature: inspect.Signature | None = None) inspect.Signature[source]#
Build the call signature for a SECoP command’s argument(s)/result.
A StructOf argument is unraveled into one KEYWORD_ONLY parameter per member (optional members default to None, matching frappy’s own “None means missing” convention for structs); any other argument datatype becomes a single POSITIONAL_OR_KEYWORD ‘arg’ parameter; no argument means no argument parameters. A trailing ‘wait_for_idle: bool = False’ is always appended (KEYWORD_ONLY if the preceding param is, to avoid mixing keyword-only and positional-or-keyword params). Used by SECoPCommandBackend to build both its real call signature and to validate/convert calls via Signature.bind().
annotated_signature, if given, is the signature captured from a real Command[[ArgT], ResT] class annotation (before this function’s caller would otherwise discard it) – when the bare (non-struct) argument or result is an Enum and annotated_signature already carries a concrete generated enum class there, that class is reused instead of building a fresh, differently-named one via _dynamic_enum_class. Struct members are unaffected: annotated_signature has a different shape there (a single flat argument, not a per-member decomposition), and struct members never get named enum classes at codegen time anyway.
- class secop_ophyd.util.SECoPReading(secop_dt: secop_ophyd.util.SECoPdtype, entry: frappy.client.CacheItem | None = None)[source]#
Initialization
- get_reading() bluesky.protocols.Reading[source]#
- secop_ophyd.util.SECOP2DTYPE = None#