eelbrain.pipeline.ChannelModelRejection

class eelbrain.pipeline.ChannelModelRejection(max_interpolate=5, fit_threshold=5e-05, score_threshold=5e-05, raw=None, interpolation=True, continuous=5.0, window=1.0, hop=0.5, min_duration=0.1, merge_gap=None, model='huber', alpha=0.0001, epsilon=1.35)[source]

Automatically generated rejection using a ChannelModel (EEG only).

A ChannelModel is fit to predict each EEG sensor from the others; in each epoch, channels that are poorly predicted (error above score_threshold) are considered bad. An epoch with more than max_interpolate bad channels is rejected; otherwise its bad channels are marked for interpolation. The rejection file is generated and cached automatically (no manual selection).

Time-resolved (windowed) detection with ChannelModel.find_bad_windows() is used for long epochs: always for variable-length epochs (loaded as a list of epochs), and for equal-length epochs longer than continuous seconds. Each channel is then interpolated only over the time window in which it is bad, and such epochs are never rejected wholesale. Shorter equal-length epochs use whole-epoch detection with ChannelModel.score().

Parameters:
  • max_interpolate (int) – Reject an epoch when it has more than this many bad channels; with this many or fewer, mark the bad channels for interpolation instead. For long epochs this caps the number of channels interpolated simultaneously.

  • fit_threshold (float) – Amplitude threshold for excluding epochs from fitting the model (see ChannelModel.fit()).

  • score_threshold (float) – Error threshold above which a channel is considered bad in an epoch (see ChannelModel.score()).

  • raw (str | None) – raw pipeline setting providing the data to fit the model. The default (None) uses the same raw as for scoring.

  • interpolation (bool) – Apply the by-epoch channel interpolation when loading epochs (default True).

  • continuous (float) – Duration threshold in seconds: equal-length epochs longer than this use time-resolved (windowed) detection instead of whole-epoch detection (default 5). Variable-length epochs always use windowed detection.

  • window (float) – Time-resolved detection parameters for long epochs (see ChannelModel.find_bad_windows()).

  • hop (float) – Time-resolved detection parameters for long epochs (see ChannelModel.find_bad_windows()).

  • min_duration (float) – Time-resolved detection parameters for long epochs (see ChannelModel.find_bad_windows()).

  • merge_gap (float | None) – Time-resolved detection parameters for long epochs (see ChannelModel.find_bad_windows()).

  • model (str) – ChannelModel parameters.

  • alpha (float) – ChannelModel parameters.

  • epsilon (float) – ChannelModel parameters.