mne.preprocessing.remove_fmri_gradient_artifact#

mne.preprocessing.remove_fmri_gradient_artifact(raw, tr_events, *, window=(4, 4), tr_tol=0, picks=None, method='AAS', copy=True, verbose=None)[source]#

Remove the fMRI gradient (imaging) artifact from EEG data.

Removes the gradient artifact present in EEG recorded simultaneously with functional MRI. The default method is average artifact subtraction (AAS) [1], which builds an artifact template for each imaging volume (TR) by averaging neighboring TR epochs and subtracts it.

See Removing the fMRI gradient artifact for a full example.

Parameters:
rawinstance of Raw

The raw data recorded during MRI acquisition. Must be preloaded.

tr_eventsndarray

The sample numbers at which TRs (imaging volumes) begin. May be a 1D array of sample numbers, shape (n_trs,), or an (n_trs, 3) events array as returned by mne.find_events() (the first column is used). TRs must be evenly spaced in time, within tr_tol samples (see below).

windowint | tuple of int

The number of neighboring TRs to average into each template. Either an even integer giving the total number of TRs (split evenly before and after), or a (n_before, n_after) tuple. Default (4, 4).

tr_tolint

The maximum allowed deviation (in samples) of any individual TR spacing from the median TR spacing, to tolerate jitter in detected TR onset times. Default 0.

picksstr | array_like | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values 'all' to pick all channels, or 'data' to pick data channels. None (default) will pick all data channels (excluding reference MEG channels). Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

methodstr

The artifact removal method. Currently only 'AAS' (average artifact subtraction) is supported. Default 'AAS'.

copybool

If True (default), operate on and return a copy of raw. If False, modify raw in place.

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 raw data with the gradient artifact removed.

Notes

New in v1.13.

References

Examples using mne.preprocessing.remove_fmri_gradient_artifact#

Removing the fMRI gradient artifact

Removing the fMRI gradient artifact