mahos.msgs.param_msgs#
Message Types for Generic Parameters.
Param is a wrapper around a value of primitive (mostly Python builtin) type, with a default. NumberParam has bounds (minimum and maximum). ChoiceParam has its available options. Collection of parameters are expressed as a ParamDict: nestable, str-keyed dict of Params.
GetParamDictReq (get_param_dict()) is usually served by meas nodes, to tell the client about required parameters for a measurement. The client can use param_dict to update the parameter values and pass it in StateReq (change_state()). At the meas node side, it is usually required to unwrap the Params using unwrap().
Messages#
- class mahos.msgs.param_msgs.GetParamDictReq(label: str = '')#
Request to get ParamDict.
ParamDict#
Measurement parameter can be reported by using ParamDict.
- class mahos.msgs.param_msgs.ParamDict(dict=None, /, **kwargs)#
- mahos.msgs.param_msgs.PDValue#
Allowed value types for ParamDict
- mahos.msgs.param_msgs.RawPDValue#
Allowed value types for Raw (unwrapped) ParamDict
Contents of ParamDict is instances of Param. The Param is mutable object; we can get / set the value.
- class mahos.msgs.param_msgs.Param(typ, default, optional: bool, enable: bool, doc: str)#
Base class for all Param types.
- value()#
Get raw value of this Param.
- set(value) bool #
Set value of this Param. Return True on success.
Param has subclasses according to the types.
NumberParam#
NumberParam has bounds: minimum and maximum.
- class mahos.msgs.param_msgs.NumberParam(typ, default, minimum, maximum, unit, SI_prefix, digit, step, optional, enable, doc)#
Base class for Param types represents a number.
- minimum()#
Get minimum value (lower bound) of this NumberParam.
- maximum()#
Get maximum value (upper bound) of this NumberParam.
- class mahos.msgs.param_msgs.IntParam(default: int = 0, minimum=None, maximum=None, unit: str = '', SI_prefix: bool = False, digit: int = 6, step: int = 1, optional: bool = False, enable: bool = True, doc: str = '')#
Param type of builtin int.
- class mahos.msgs.param_msgs.FloatParam(default: float = 0.0, minimum=None, maximum=None, unit: str = '', SI_prefix: bool = False, digit: int = 6, step: float = 1.0, optional: bool = False, enable: bool = True, doc: str = '')#
Param type of builtin float.
ChoiceParam#
- class mahos.msgs.param_msgs.ChoiceParam(typ, default, options, optional, enable, doc)#
Base class for Param types expressing a choice from finite set options.
- options() tuple #
Get available options for this Param.
- class mahos.msgs.param_msgs.BoolParam(default: bool, optional: bool = False, enable: bool = True, doc: str = '')#
Param type of builtin bool.
- class mahos.msgs.param_msgs.EnumParam(typ: Enum, default, options=None, optional: bool = False, enable: bool = True, doc: str = '')#
Param type of Enum.
- class mahos.msgs.param_msgs.StrChoiceParam(default, options: tuple[str], optional: bool = False, enable: bool = True, doc: str = '')#
Param type of selection type of builtin strs.
- class mahos.msgs.param_msgs.IntChoiceParam(default, options: tuple[int], optional: bool = False, enable: bool = True, doc: str = '')#
Param type of selection type of builtin ints.
Other Param#
- class mahos.msgs.param_msgs.StrParam(default: str = '', optional: bool = False, enable: bool = True, doc: str = '')#
Param type of builtin str.
- class mahos.msgs.param_msgs.UUIDParam(optional: bool = False, enable: bool = True, doc: str = '')#
Param type of uuid.UUID.
Functions#
- mahos.msgs.param_msgs.unwrap(params: List[ForwardRef('RawPDValue')]]]]]) dict[str, typing.Union[bool, str, int, float, enum.Enum, uuid.UUID, dict, typing.List[typing.Union[bool, str, int, float, enum.Enum, uuid.UUID, dict, typing.List[ForwardRef('RawPDValue')]]]]] #
Unwrap the ParamDict to RawParamDict. If params is not a ParamDict, do nothing.
- mahos.msgs.param_msgs.isclose(params: List[ForwardRef('RawPDValue')]]]]], other: List[ForwardRef('RawPDValue')]]]]], rtol: float = 1e-05, atol: float = 1e-08) bool #
Check if two ParamDicts or RawParamDicts are close.