mne_nirs.preprocessing.motion_correct_wavelet#
- mne_nirs.preprocessing.motion_correct_wavelet(raw, iqr=1.5, *, verbose=None)[source]#
Apply wavelet motion correction to fNIRS data.
Each channel is decomposed with a translation-invariant wavelet transform, detail coefficients that are outliers with respect to the interquartile range are set to zero, and the signal is reconstructed. The method targets spike artifacts and is adapted from Molavi and Dumont[1]. This is a port of Homer3’s
hmrR_MotionCorrectWavelet[2] and reproduces its output to numerical precision.- Parameters:
- rawinstance of
Raw The raw fNIRS data (optical density or hemoglobin).
- iqr
float Interquartile-range multiplier used as the outlier threshold for the wavelet coefficients. Larger values remove fewer coefficients.
- verbosebool |
str|int|None Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- rawinstance of
- Returns:
- rawinstance of
Raw The corrected data (a copy).
- rawinstance of
Notes
Requires the optional dependency
PyWavelets, which can be installed withpip install mne-nirs[full].Like Homer3, this differs from Molavi and Dumont[1], who used a Daubechies 5 wavelet, set a coefficient to zero when its probability under a Gaussian fit to its level was below a threshold (0.1), and only corrected the most contaminated levels. Here a Daubechies 2 wavelet is used, coefficients outside
iqrtimes the interquartile range of their level are set to zero, and all but the coarsest levels are corrected.References