This file provides one-pass, causal, state-carrying IIR filtering that
mirrors scipy.signal (lfilter, lfilter_zi,
sosfilt, sosfilt_zi, sosfiltfilt). Unlike the zero-phase
butterworthFilter default (which uses forward-backward
filtfilt and is inherently non-causal), these functions process a
signal strictly forward in time and can carry filter state across
consecutive chunks. This is the numerical core that a real-time streaming
backend (e.g. a future PhysioStream) reuses so that offline and
online filtering produce identical results.
Details
All recursions use the Direct-Form-II-Transposed (DF2T) structure, which is
the same structure scipy.signal and signal::filter use, so the
outputs agree to machine precision.