nirspipe.pipeline.motion#
Motion artifact correction for optical density signals: tddr, wavelet, tpca, spline, spline_sg, wavelet_tddr (wavelet, then tddr) and spline_wavelet (spline, then wavelet).
Module Contents#
Functions#
-3 dB frequency (Hz) of the Savitzky-Golay step at this sampling rate. |
|
The settings this method runs with, keyed as its sidecar records them. |
|
Whether a spline detector’s recorded summary marks more than MOTION_SHARE_WARN. |
|
Apply motion artifact correction to the OD signal. |
Data#
API#
- nirspipe.pipeline.motion.MotionMethod = None#
- nirspipe.pipeline.motion.WAVELET = 'db2'#
- nirspipe.pipeline.motion.WAVELET_IQR_FACTOR = 1.5#
- nirspipe.pipeline.motion.WAVELET_LOWEST_SCALE = 4#
- nirspipe.pipeline.motion.TPCA_T_MOTION = 0.5#
- nirspipe.pipeline.motion.TPCA_STD_THRESH = 20.0#
- nirspipe.pipeline.motion.TPCA_AMP_THRESH = 5.0#
- nirspipe.pipeline.motion.TPCA_T_MASK = 1.0#
- nirspipe.pipeline.motion.TPCA_N_SV = 0.97#
- nirspipe.pipeline.motion.TPCA_MAX_ITER = 5#
- nirspipe.pipeline.motion.SPLINE_T_MOTION = 0.5#
- nirspipe.pipeline.motion.SPLINE_STD_THRESH = 20.0#
- nirspipe.pipeline.motion.SPLINE_AMP_THRESH = 0.5#
- nirspipe.pipeline.motion.SPLINE_T_MASK = 2.0#
- nirspipe.pipeline.motion.SPLINE_P = 0.99#
- nirspipe.pipeline.motion.SPLINE_DT_SHORT = 0.3#
- nirspipe.pipeline.motion.SPLINE_DT_LONG = 3.0#
- nirspipe.pipeline.motion.SPLINE_SG_P = 0.99#
- nirspipe.pipeline.motion.SPLINE_SG_FRAME = 10.0#
- nirspipe.pipeline.motion.SPLINE_SG_ORDER = 3#
- nirspipe.pipeline.motion.SPLINE_SG_LOWPASS = 2.0#
- nirspipe.pipeline.motion.SPLINE_SG_DETECT_LOWPASS = 0.5#
- nirspipe.pipeline.motion.SPLINE_SG_STD_WINDOW = 1.0#
- nirspipe.pipeline.motion.SPLINE_SG_STD_IQR = 2.0#
- nirspipe.pipeline.motion.SPLINE_SG_GRAD_IQR = 1.5#
- nirspipe.pipeline.motion.SPLINE_SG_SHIFT_LAG = 0.5#
- nirspipe.pipeline.motion.SPLINE_SG_SNR_MIN = 3.0#
- nirspipe.pipeline.motion.SPLINE_SG_PAD = 12.0#
- nirspipe.pipeline.motion.spline_sg_cutoff(sfreq: float = 10.0) float#
-3 dB frequency (Hz) of the Savitzky-Golay step at this sampling rate.
The frame is fixed in seconds, so the cutoff barely moves with the rate.
- nirspipe.pipeline.motion.SPLINE_WAVELET_T_MOTION = 1.0#
- nirspipe.pipeline.motion.SPLINE_WAVELET_AMP_THRESH = 0.4#
- nirspipe.pipeline.motion.SPLINE_WAVELET_T_MASK = 1.0#
- nirspipe.pipeline.motion.SPLINE_WAVELET_STD_THRESH = 13.0#
- nirspipe.pipeline.motion.SPLINE_WAVELET_IQR_FACTOR = 0.8#
- nirspipe.pipeline.motion.STD_THRESH_DEFAULTS = None#
- nirspipe.pipeline.motion.IQR_FACTOR_DEFAULTS = None#
- nirspipe.pipeline.motion.motion_settings(method: str | None, std_thresh: float | None = None, iqr_factor: float | None = None) dict[str, float]#
The settings this method runs with, keyed as its sidecar records them.
An unset one takes the method’s default; one the method does not read is refused:
spline_wavelet, nothing set -> {“motion_std_thresh”: 13.0, “wavelet_iqr”: 0.8} tddr, nothing set -> {} tddr, iqr_factor 0.5 -> ValueError
- nirspipe.pipeline.motion.MOTION_SHARE_WARN = 0.1#
- nirspipe.pipeline.motion.overmarked(method: str | None, summary: dict[str, Any] | None) bool#
Whether a spline detector’s recorded summary marks more than MOTION_SHARE_WARN.
- nirspipe.pipeline.motion.correct_motion(raw_od: mne.io.Raw, method: nirspipe.pipeline.motion.MotionMethod | None = None, std_thresh: float | None = None, iqr_factor: float | None = None) mne.io.Raw#
Apply motion artifact correction to the OD signal.
Returns corrected raw (modified in-place for tddr). tpca, spline, spline_sg and spline_wavelet also record what they did on the stamp, under their own name. std_thresh and iqr_factor are resolved by motion_settings.