mne_nirs.preprocessing.motion_correct_spline#

mne_nirs.preprocessing.motion_correct_spline(raw, mask=None, smoothing=0.99, *, verbose=None)[source]#

Apply spline interpolation motion correction to fNIRS data.

Each motion segment is detrended with a cubic smoothing spline and the segments are then shifted so that the signal is continuous across their boundaries [1]. This is a port of Homer3’s hmrR_MotionCorrectSpline [2] and reproduces its output to numerical precision.

Parameters:
rawinstance of Raw

The raw fNIRS data (optical density or hemoglobin).

maskndarray of bool, shape (n_channels, n_times) | None

Per-channel motion mask for the fNIRS channels, where True means a clean sample, as returned by detect_motion_artifacts(). If None, detect_motion_artifacts() is called with its default parameters.

smoothingfloat

Smoothing parameter of the spline between 0 and 1 (p in Homer3 and MATLAB’s csaps), where 1 interpolates the data (no correction) and 0 fits a straight line.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
rawinstance of Raw

The corrected data (a copy).

Notes

Motion segments shorter than five samples are not detrended.

Homer3 differs from Scholkmann et al.[1] in the number of samples over which the segment means used for the shifts are taken (0.3 s and 3 s rather than 1/3 s and 2 s as the limits between the cases). The paper also describes p with the reverse of the csaps convention used here, so its recommended value of 0.01 corresponds to the default of 0.99.

References

Examples using mne_nirs.preprocessing.motion_correct_spline#

Artifact Correction Techniques

Artifact Correction Techniques