Skip to content

Amplitude-based artifact rejection

Good Practice / Advice

Have a look at your raw data and train yourself to detect a blink, a heart beat and an eye movement. You can do a quick average of blink data and check what the amplitude looks like.

reject module-attribute

Python
reject: dict[str, float] | Literal["autoreject_global", "autoreject_local"] | None = (
    None
)

Peak-to-peak amplitude limits to mark epochs as bad. This allows you to remove epochs with strong transient artifacts.

Info

The rejection is performed after SSP or ICA, if any of those methods is used. To reject epochs before fitting ICA, see the ica_reject setting.

If None (default), do not apply artifact rejection.

If a dictionary, manually specify rejection thresholds (see examples). The thresholds provided here must be at least as stringent as those in ica_reject if using ICA. In case of 'autoreject_global', thresholds for any channel that do not meet this requirement will be automatically replaced with those used in ica_reject.

If "autoreject_global", use autoreject to find suitable "global" rejection thresholds for each channel type, i.e., autoreject will generate a dictionary with (hopefully!) optimal thresholds for each channel type.

If "autoreject_local", use "local" autoreject to detect (and potentially repair) bad channels in each epoch. Use autoreject_n_interpolate to control how many channels are allowed to be bad before an epoch gets dropped.

Example
Python
reject = {"grad": 4000e-13, 'mag': 4e-12, 'eog': 150e-6}
reject = {"eeg": 100e-6, "eog": 250e-6}
reject = None  # no rejection based on PTP amplitude
reject = "autoreject_global"  # find global (per channel type) PTP thresholds
reject = "autoreject_local"  # find local (per channel) thresholds and repair epochs
Pipeline steps using this setting

The following steps are directly affected by changes to reject:

  • preprocessing/_09_ptp_reject

reject_tmin module-attribute

Python
reject_tmin: float | None = None

Start of the time window used to reject epochs. If None, the window will start with the first time point. Has no effect if reject has been set to "autoreject_local".

Example
Python
reject_tmin = -0.1  # 100 ms before event onset.
Pipeline steps using this setting

The following steps are directly affected by changes to reject_tmin:

  • preprocessing/_09_ptp_reject

reject_tmax module-attribute

Python
reject_tmax: float | None = None

End of the time window used to reject epochs. If None, the window will end with the last time point. Has no effect if reject has been set to "autoreject_local".

Example
Python
reject_tmax = 0.3  # 300 ms after event onset.
Pipeline steps using this setting

The following steps are directly affected by changes to reject_tmax:

  • preprocessing/_09_ptp_reject

autoreject_n_interpolate module-attribute

Python
autoreject_n_interpolate: FloatArrayLike = [4, 8, 16]

The maximum number of bad channels in an epoch that autoreject local will try to interpolate. The optimal number among this list will be estimated using a cross-validation procedure; this means that the more elements are provided here, the longer the autoreject run will take. If the number of bad channels in an epoch exceeds this value, the channels won't be interpolated and the epoch will be dropped.

Info

This setting only takes effect if reject has been set to "autoreject_local".

Info

Channels marked as globally bad in the BIDS dataset (in *_channels.tsv)) will not be considered (i.e., will remain marked as bad and not analyzed by autoreject).

Pipeline steps using this setting

The following steps are directly affected by changes to autoreject_n_interpolate:

  • preprocessing/_06a1_fit_ica
  • preprocessing/_06a2_find_ica_artifacts
  • preprocessing/_09_ptp_reject