Qu

rolling_rms

Builtin index · Noise

rolling_rms(x, [window=5])

Input: x, window · Output: no output

What it is

Root-mean-square over a centred window — a moving level, e.g. for an RMS trigger threshold. This is the RMS of the samples themselves, DC included, not of their deviation from the local mean; detrend first if the AC part is what you want, or use rolling_std, which is the already-centred counterpart. Same shape/type rules as rolling_mean.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
rolling_rms(x, [window=5])
x —not documented yet
window optional (default 5)Root-mean-square over a centred window — a moving level, e.g.
not documented yetfor an RMS trigger threshold. This is the RMS of the samples themselves, DC included, not of their deviation from the local mean; detrend first if the AC part is what you want, or use rolling_std, which is the already-centred counterpart. Same shape/type rules as rolling_mean.

Examples

No documentation example calls this form yet. The Noise chapter is where one belongs.

How it works

rolling_mean/rolling_rms/rolling_std/rolling_min/ rolling_max(x, [window=5]) — a statistic over a sliding window: drift removal before an FFT, a moving-RMS trigger level, a moving min/max envelope. Centred on each sample over an ODD window, same as every other windowed function in this engine (medfilt, savgol, smooth, hampel) and refusing an even one for the same reason -- an even window has no middle sample and which way it rounds changes the answer. The edges are where these deliberately DIVERGE from the smoothers above, and it is worth stating why rather than leaving it to be discovered. medfilt/moving_average pad (reflect/clamp) because a filter must emit a sample for every input sample and has to invent the neighbours it does not have. These are statistics, not filters: padding would answer "what was the spread of the data here" with fabricated data, and for rolling_std it does not just add edge error, it biases the answer toward zero (a clamped repeat has no variance), reporting the signal as quietest exactly where least is known about it. So the window SHRINKS at the edges instead -- MATLAB's movmean/movstd default and pandas' min_periods=1 -- and every returned value is the statistic of real samples only. See numeric::noise's own section comment for the full argument. A Signal comes back a Signal at the same Fs: the output is the same length and each sample still lines up with the input instant it was centred on, so the rate is still true.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.