mne_nirs.preprocessing.detect_motion_artifacts#

mne_nirs.preprocessing.detect_motion_artifacts(raw, t_motion=0.5, t_mask=1.0, stdev_thresh=50.0, amp_thresh=5.0, *, verbose=None)[source]#

Detect motion artifacts in fNIRS data.

A sample is flagged when, within the following t_motion seconds, the signal changes by more than stdev_thresh times the standard deviation of its first derivative or by more than amp_thresh. Flagged samples are padded by t_mask seconds on each side. The channels of a source-detector pair are evaluated together and share one mask. This is a port of Homer3’s hmrR_MotionArtifactByChannel [1] and gives identical masks.

Parameters:
rawinstance of Raw

The raw fNIRS data (optical density or hemoglobin).

t_motionfloat

Duration (s) of the window over which changes are evaluated.

t_maskfloat

Duration (s) to pad around each flagged sample.

stdev_threshfloat

Threshold as a multiple of the standard deviation of the first derivative.

amp_threshfloat

Absolute threshold on the amplitude change.

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:
maskndarray of bool, shape (n_channels, n_times)

Per-channel mask (tIncCh in Homer3) for the fNIRS channels, where True means a clean sample. Use mask.all(axis=0) to get the global mask of Homer3’s hmrR_MotionArtifact (tInc).

Notes

The default thresholds are those of Homer3. Suitable values depend on the sampling rate and the units of the data.

References

Examples using mne_nirs.preprocessing.detect_motion_artifacts#

Artifact Correction Techniques

Artifact Correction Techniques