Smoothing & filters#
Track and denoise the level of a series: moving averages and designed filters.
Smoothing & moving averages#
Track the level of a series and suppress short-term noise.
Function |
Description |
|---|---|
General-order IIR Butterworth low-pass filter. |
|
Mulloy's Double EMA: 2*EMA - EMA(EMA). |
|
Exponentially-weighted moving average (pandas adjust=True). |
|
Hull's responsive MA: WMA(2*WMA(n/2) - WMA(n), sqrt(n)). |
|
Scalar 1-D Kalman filter for a noisy random-walk model. |
|
Adaptive MA whose smoothing constant responds to the efficiency ratio. |
|
Finite-impulse-response filter with user-supplied taps. |
|
Trailing-window arithmetic mean (simple moving average). |
|
OLS fit y = a + b*t + c*t^2 over a trailing window. |
|
Mulloy's Triple EMA: 3*EMA - 3*EMA(EMA) + EMA(EMA(EMA)). |
|
Triangular MA: SMA of an SMA. Heavier center-weighting than WMA. |
|
Linearly-weighted moving average. O(1) per step. |
Filtering#
Designed frequency-domain and state-space filters.
Function |
Description |
|---|---|
General-order IIR Butterworth low-pass filter. |
|
General-order IIR Butterworth band-pass filter. |
|
General-order IIR Butterworth band-stop (notch) filter. |
|
General-order IIR Butterworth high-pass filter (rejects low frequencies). |
|
Robust Hampel despiker, replace samples far from the window median (in MAD units). |
|
Scalar 1-D Kalman filter for a noisy random-walk model. |
|
Finite-impulse-response filter with user-supplied taps. |
|
Hysteresis comparator. Latches 1.0 above the upper threshold, 0.0 below the lower threshold, and retains its previous value in between. |