Universal thresholding of Haar detail coefficients at \(\sigma\sqrt{2\log n}\), with sigma from the median absolute deviation of the finest level.
Details
The LEVEL at which a coefficient fires is the diagnostic, not just
the fact that one did: a single-point spike fires at level 1 only,
while a level shift fires at every coarse scale. level_fired
records it, and max_span caps how wide a region a coarse
coefficient is allowed to mark, so one level-6 coefficient cannot
paint 64 points as anomalous.
The Haar basis localises abrupt changes and is blind to slow drift, which produces no large coefficient at any scale.
The max_span cap has a consequence worth knowing: a sustained
LEVEL SHIFT fires large coefficients at coarse scales, but those are
not allowed to mark their whole span, so the shift appears in
per_level_count without appearing in anomaly. The cap
buys sharp localisation of spikes at that price; raise
max_span to mark shifts as well.
