pcdsdevices.signal.AvgSignal
- class pcdsdevices.signal.AvgSignal(signal: Signal | str, averages: int, duration: float | None = None, *, name: str, parent: Device | None = None, **kwargs)
- Signal that acts as a rolling average of another signal. - Optionally, the rolling average can be reset every time the - triggermethod is called (e.g. at every point in a bluesky scan). This is the behavior if you specific a duration for the- triggerusing the- durationargument.- This will subscribe to a signal, and fill an internal buffer with values from - SUB_VALUE. It will update its own value to be the mean of the last n accumulated values, up to the buffer size. If we haven’t filled this buffer, this will still report a mean value composed of all the values we’ve receieved so far.- Warning: this means that if we only have recieved ONE value, the mean will just be the mean of a single value! - Parameters:
- signal (Signal or str) – Any subclass of - ophyd.signal.Signalthat returns a numeric value. This signal will be subscribed to be AvgSignal to calculate the mean. Parent classes can pass a str instead that matches the attr name of one of their component signals.
- averages (int) – The number of - SUB_VALUEupdates to include in the average. New values after this number is reached will begin overriding old values.
- duration (float, optional) – The number of seconds to wait before returning trigger complete. Nominally this should be set to averages divided by the expected update rate of the signal. If omitted, we will not reset the buffer or wait for values at scan points. 
 
 - Methods - describe()
- Provide schema and meta-data for - read()- This keys in the - OrderedDictthis method returns must match the keys in the- OrderedDictreturn by- read().- 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_keyschema.
 
 - get(**kwargs)
- The readback value 
 - 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, *, timeout=None, settle_time=None, **kwargs)
- 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 
 
 - Attributes - SUB_META = 'meta'
 - averages
- The size of the internal buffer of values to average over. 
 - 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? 
 - 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?