nirspipe.pipeline.hyper.whiten#
Autoregressive prewhitening of the long channels before the wavelet coherence.
Off unless --wtc-whiten asks for it. The order is fixed in seconds and shared by every
channel of both members, rather than chosen per channel the way the correlation’s is, so
the two members of a pair are filtered to the same depth and carry transients of the same
length. It is fitted on the whole aligned record, which every route then windows or crops,
so the real table and both nulls see identically whitened signals. A member carrying
BAD_ spans has its coefficients fitted on its own kept time only, and is still filtered
as one continuous series.
Module Contents#
Functions#
Autocovariances of a centred series at lags |
|
Residuals of an order- |
|
The shared order in samples, |
|
Copies of |
Data#
API#
- nirspipe.pipeline.hyper.whiten.logger = 'get_logger(...)'#
- nirspipe.pipeline.hyper.whiten.autocov(centred: numpy.ndarray, n_lag: int) numpy.ndarray#
Autocovariances of a centred series at lags
0..n_lag, each over the full length.
- nirspipe.pipeline.hyper.whiten.ar_whiten_fixed(x: numpy.ndarray, order: int, keep: numpy.ndarray | None = None) numpy.ndarray | None#
Residuals of an order-
orderAR fit, the input’s length, or None.a 3900 s trace at 10 Hz, order 100 -> 3900 s of residual, the first 10 s zeroed
Yule-Walker on the whole series; with
keepFalse anywhere, least squares on the lag windows lying wholly in kept time instead (the GLM’s gap-aware estimator), the filter still run over the whole series. The filter runs from the first sample, so the firstordersamples are a startup transient; they are set to zero rather than dropped, since dropping them would move every later sample off the shared clock. None when the row cannot be fitted: non-finite, constant, or a singular system.
- nirspipe.pipeline.hyper.whiten.whiten_order(raws: dict, order_s: float) int#
The shared order in samples,
order_sat the members’ common rate.
- nirspipe.pipeline.hyper.whiten.whiten_raws(raws: dict, order_s: float, sep_bands=None) dict#
Copies of
rawswhose long channels, HbT among them where loaded, hold their AR residuals.{"sub-01": raw, "sub-02": raw}, 10.0 -> the same two recordings, whitened at AR(100)
Refuses a record shorter than four times the order, the floor the correlation’s fit uses, rather than lowering the order for it, since the order is shared, and likewise a member whose kept time holds too few lag windows. A channel that cannot be fitted is marked bad on the copy, which drops it from the coherence the way a rejected channel is dropped.