pcdsdevices.signal.MultiDerivedSignal
- class pcdsdevices.signal.MultiDerivedSignal(*args, attrs: list[str], calculate_on_get: MdsOnGetFunction | None = None, calculate_on_put: MdsOnPutFunction | None = None, timeout: int | float | None = None, settle_time: int | float | None = None, **kwargs)
Signal derived from multiple signals in the device hierarchy.
Requires a calculation function to be passed in. Support writing to multiple signals if an additional
calculate_on_put
function is supplied.Functions may also be defined in a subclass for advanced or repeated usage.
Functions may or may be methods. If
self
is noted as the first argument of your function, it will be assumed to be a method.self
will then refer to theMultiDerivedSignal
instance.- Parameters:
attrs (list of str) – Attribute names of signals that are used to generate a value for this signal.
calculate_on_get (MdsCalculationFunction) – A calculation function that takes in a dictionary of signals to values. It should be made to return a value of a compatible ophyd data type, such as an integer, float, or an array.
calculate_on_put (MdsOnPutFunction) – A calculation function that allows this MultiDerivedSignal to be read-write instead of just read-only. It should take in a single value and return a dictionary of signal-to-value to write, each with a compatible ophyd data type, such as an integer, float, or an array. Values will be written to simultaneously and result in a single
Status
object.
Methods
- add_signal_by_attr_name(name: str) Signal
Add a signal from which to aggregate information.
This must be called before any subscriptions are made to the signal. Duplicate signals will not be re-added.
- Parameters:
name (str) – The attribute name of the signal, relative to the parent device.
- Returns:
sig (ophyd.Signal) – The signal referenced by the attribute name.
- Raises:
RuntimError – If called after .subscribe() or used without a parent Device.
- describe()
Provide schema and meta-data for
read()
This keys in the
OrderedDict
this method returns must match the keys in theOrderedDict
return byread()
.This provides schema related information, (ex shape, dtype), the source (ex PV name), and if available, units, limits, precision etc.
- Returns:
data_keys (OrderedDict) – The keys must be strings and the values must be dict-like with the
event_model.event_descriptor.data_key
schema.
- get(**kwargs)
Update all values and recalculate.
- Parameters:
**kwargs – Keyword arguments are passed to each
signal.get(**kwargs)
.
- read()
Put the status of the signal into a simple dictionary format for data acquisition
- Returns:
dict
- read_configuration()
Dictionary mapping names to value dicts with keys: value, timestamp
- set(value: str | int | bool | float | list[str | int | bool | float] | ndarray[Any, dtype[str | int | bool | float]], *, timeout: float | None = None, settle_time: float | None = None) StatusBase
Set the value of the Signal and return a Status object.
- Returns:
st (Status) – This status object will be finished upon return in the case of basic soft Signals
- trigger()
Call that is used by bluesky prior to read()
Attributes
- SUB_META = 'meta'
- connected
Are all relevant signals connected?
- high_limit
The high, inclusive control limit for the Signal
- hints
Field hints for plotting
- kind
- limits
The control limits (low, high), such that low <= value <= high
- low_limit
The low, inclusive control limit for the Signal
- metadata
A copy of the metadata dictionary associated with the signal
- metadata_keys
Metadata keys that will be passed along on value subscriptions
- read_access
Can the signal be read?
- signals
The signals used to calculate_on_get this MultiDerivedSignal.
- source_name
- timestamp
Timestamp of the readback value
- tolerance
The absolute tolerance associated with the value.
- value
The signal’s value
- write_access
Can the signal be written to?
- calculate_on_get: MdsOnGetFunction