RollingStatistic
- class gpype.backend.transform.rolling_statistic.RollingStatistic[source]
Bases:
IONodeOne statistic per channel over a sliding window.
Amplitude features and amplitude-based quality judgements both need this, and most of these are reachable by no combination of the other nodes: a moving average is the mean and only the mean. Peak-to-peak over a window, in particular, is the textbook way to spot a channel that has come loose.
The window is a real window: every emitted value describes the last
window_sizesamples, and the first values are computed against a history primed with the first sample rather than against silence, so there is no start-up ramp to mistake for signal.One row per input frame, so a frame longer than one sample lowers the rate. A row is timed at the last sample of its frame, and
start_timeis moved to the first frame’s. A marker in the input context then moves to the first row at or after it. A gap covers every row whose window holds a missing sample, at any frame size.Every statistic but
"var"is in its input’s unit. A variance is in that unit squared, so its channels record no unit.- ONE_OF = (('window_size', 'window_seconds'),)
Exactly one of these must be given; the window is either a sample count or a duration.
- STATISTICS = ('rms', 'mean', 'var', 'std', 'min', 'max', 'peak_to_peak', 'median')
Statistics this node can compute.
- class Configuration[source]
Bases:
ConfigurationConfiguration class for RollingStatistic parameters.
- __init__(statistic='rms', window_size=None, window_seconds=None, **kwargs)[source]
Initialize the rolling statistic.
- Parameters:
- Raises:
ValueError – If the statistic is unknown, if both or neither window form is given, or if a window is not positive.