braindecode.preprocessing.FixStimArtifact#

class braindecode.preprocessing.FixStimArtifact(events=None, event_id=None, tmin=0.0, tmax=0.01, *, baseline=None, mode='linear', stim_channel=None, picks=None)[source]#

Braindecode preprocessor wrapper for fix_stim_artifact().

Eliminate stimulation’s artifacts from instance.

Note

This function operates in-place, consider passing inst.copy() if this is not desired.

Parameters:
instinstance of Raw or Epochs or Evoked

The data.

eventsarray, shape (n_events, 3)

The list of events. Required only when inst is Raw.

event_idint

The id of the events generating the stimulation artifacts. If None, read all events. Required only when inst is Raw.

tminfloat

Start time of the interpolation window in seconds.

tmaxfloat

End time of the interpolation window in seconds.

baselineNone | tuple, shape (2,)

The baseline to use when mode='constant', in which case it must be non-None.

Added in version 1.8.

mode‘linear’ | ‘window’ | ‘constant’

Way to fill the artifacted time interval.

"linear"

Does linear interpolation.

"window"

Applies a (1 - hanning) window.

"constant"

Uses baseline average. baseline parameter must be provided.

Changed in version 1.8: Added the "constant" mode.

stim_channelstr | None

Stim channel to use.

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. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

Returns:
instinstance of Raw or Evoked or Epochs

Instance with modified data.

Methods

fn(events=None, event_id=None, tmin=0.0, tmax=0.01, *, baseline=None, mode='linear', stim_channel=None, picks=None)[source]#

Eliminate stimulation’s artifacts from instance.

Note

This function operates in-place, consider passing inst.copy() if this is not desired.

Parameters:
  • inst (instance of Raw or Epochs or Evoked) – The data.

  • events (array, shape (n_events, 3)) – The list of events. Required only when inst is Raw.

  • event_id (int) – The id of the events generating the stimulation artifacts. If None, read all events. Required only when inst is Raw.

  • tmin (float) – Start time of the interpolation window in seconds.

  • tmax (float) – End time of the interpolation window in seconds.

  • baseline (None | tuple, shape (2,)) –

    The baseline to use when mode='constant', in which case it must be non-None.

    Added in version 1.8.

  • mode ('linear' | 'window' | 'constant') –

    Way to fill the artifacted time interval.

    "linear"

    Does linear interpolation.

    "window"

    Applies a (1 - hanning) window.

    "constant"

    Uses baseline average. baseline parameter must be provided.

    Changed in version 1.8: Added the "constant" mode.

  • stim_channel (str | None) – Stim channel to use.

  • picks (str | 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. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

Returns:

inst – Instance with modified data.

Return type:

instance of Raw or Evoked or Epochs