pub fn hampel(values: &[f64], half: usize, threshold: f64) -> Vec<f64>Expand description
The Hampel filter: each sample more than threshold robust standard deviations from its
window’s median replaced by that median, the scale being 1.4826 times the window’s median
absolute deviation (R. K. Pearson et al., The Class of Generalized Hampel Filters, EUSIPCO
2015, §2, eqs. 1 and 2, with K = half and t = threshold). Windows are cut short at the ends
and skip NaNs, as in running_median, which is this filter at threshold = 0.
HPR Sim reads heights after running_median instead (see
MEDIAN_WINDOW_S): a pulse among other large departures,
as an ejection charge’s is, widens its own window’s spread until this filter keeps it. It
cleans an accelerometer’s trace, where a spike stands alone, before the thrust and burnout are
found on it (SPIKE_WINDOW_S).