ElectricFieldStrengthAccumulator¶
- class lsst.ts.ess.csc.ElectricFieldStrengthAccumulator(num_samples: int)¶
Bases:
object
Accumulate electric field data from a detector.
This supports writing the electricFieldStrength telemetry topic, whose fields are statistics measured on a set of data.
- Parameters:
- num_samples
int
The number of samples to read before producing aggregate data.
- num_samples
- Raises:
- ValueError
In case the value of
num_samples
is smaller than 2.
Notes
To Use
For each data sample read, call
add_sample
. Then callget_topic_kwargs`
. If it returns a non-empty dict, write the electricFieldStrength topic using the returned dict as keyword arguments.get_topic_kwargs
also clears the accumulated data, so you can repeat this indefinitely. You need not callclear
yourself.Bad Data
Samples with
isok=False
are ignored, other than to increment thenum_bad_samples
counter. In the unlikely event that we accumulatenum_samples
of bad data before that many good samples,do_report()
will be true, butget_topic_kwargs()
will returnnan
for all statistical values. The point is to publish something, since this is telemetry and it should be output at semi-regular intervals. Note that the accumulated good data will be lost.- Attributes:
Attributes Summary
Do we have enough data to report good or bad data?
Methods Summary
add_sample
(timestamp, strength, isok)Add a sample.
clear
()Clear the accumulated data.
Return data for the electricFieldStrength telemetry topic.
Attributes Documentation
- do_report¶
Do we have enough data to report good or bad data?
Methods Documentation
- clear() None ¶
Clear the accumulated data.
Note that
get_topic_kwargs()
automatically calls this, so you typically will not have to.