braindecode.preprocessing.InterpolateBads#

class braindecode.preprocessing.InterpolateBads(reset_bads=True, mode='accurate', origin='auto', method=None, exclude=(), verbose=None)[source]#

Braindecode preprocessor wrapper for interpolate_bads().

Interpolate bad MEG and EEG channels.

Operates in place.

Parameters:
reset_badsbool

If True, remove the bads from info.

modestr

Either 'accurate' or 'fast', determines the quality of the Legendre polynomial expansion used for interpolation of channels using the minimum-norm method.

originarray-like, shape (3,) | str

Origin of the sphere in the head coordinate frame and in meters. Can be 'auto' (default), which means a head-digitization-based origin fit.

Added in version 0.17.

methoddict | str | None

Method to use for each channel type.

  • "meg" channels support "MNE" (default) and "nan"

  • "eeg" channels support "spline" (default), "MNE" and "nan"

  • "fnirs" channels support "nearest" (default) and "nan"

  • "ecog" channels support "spline" (default) and "nan"

  • "seeg" channels support "spline" (default) and "nan"

None is an alias for:

method=dict(meg="MNE", eeg="spline", fnirs="nearest")

If a str is provided, the method will be applied to all channel types supported and available in the instance. The method "nan" will replace the channel data with np.nan.

Warning

Be careful when using method="nan"; the default value reset_bads=True may not be what you want.

Added in version 0.21.

excludelist | tuple

The channels to exclude from interpolation. If excluded a bad channel will stay in bads.

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:
instinstance of Raw, Epochs, or Evoked

The modified instance.

Notes

The "MNE" method uses minimum-norm projection to a sphere and back.

Added in version 0.9.0.