AirTurbulenceAccumulator¶
- class lsst.ts.ess.csc.AirTurbulenceAccumulator(log: Logger, num_samples: int)¶
Bases:
object
Accumulate air turbulence data from a 3-d anemometer.
This supports writing the airTurbulence telemetry topic, whose fields are statistics measured on a set of data.
- Parameters:
- log
logging.Logger
The logger for which to create a child logger.
- num_samples
int
The number of samples to read before producing aggregate data.
- log
Notes
To Use
For each data sample read, call
add_sample
. The callget_topic_kwargs`
. If it returns a non-empty dict, write the airTurbulence 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:
- num_samples
int
The number of samples to read before producing aggregate data.
- timestamplist[float]
List of timestamps (TAI unix seconds)
- speedlist[float]
List of wind speed in x, y, z (m/s)
- sonic_temperaturelist[float]
List of sonic temperature (deg C)
- num_bad_samplesint
Number of invalid samples.
- num_samples
Attributes Summary
Do we have enough data to report good or bad data?
Methods Summary
add_sample
(timestamp, speed, ...)Add a sample.
clear
()Clear the accumulated data.
Return data for the airTurbulence telemetry topic.
Attributes Documentation
- do_report¶
Do we have enough data to report good or bad data?
Methods Documentation
- add_sample(timestamp: float, speed: Sequence[float], sonic_temperature: float, isok: bool) None ¶
Add a sample.
- clear() None ¶
Clear the accumulated data.
Note that get_topic_kwargs automatically calls this, so you typically will not have to.