eegprep.clean_channels#

eegprep.clean_channels(EEG, corr_threshold=0.8, noise_threshold=5.0, window_len=5, max_broken_time=0.4, num_samples=50, subset_size=0.25)#

Remove channels with problematic data from a continuous data set.

This is an automated artifact rejection function which ensures that the data contains no channels that record only noise for extended periods of time. If channels with control signals are contained in the data these are usually also removed. The criterion is based on correlation: if a channel has lower correlation to its robust estimate (based on other channels) than a given threshold for a minimum period of time (or percentage of the recording), it will be removed.

Parameters:
  • EEG (Dict[str, Any]) – Continuous data set, assumed to be appropriately high-passed (e.g. >0.5Hz or with a 0.5Hz - 2.0Hz transition band).

  • corr_threshold (float) – Correlation threshold. If a channel is correlated at less than this value to its robust estimate (based on other channels), it is considered abnormal in the given time window.

  • noise_threshold (float) – If a channel has more (high-frequency) noise relative to its signal than this value, in standard deviations from the channel population mean, it is considered abnormal.

  • window_len (float) – Length of the windows (in seconds) for which correlation is computed; ideally short enough to reasonably capture periods of global artifacts or intermittent sensor dropouts, but not shorter (for statistical reasons).

  • max_broken_time (float) – Maximum time (either in seconds or as fraction of the recording) during which a channel is allowed to have artifacts. Reasonable range: 0.1 (very aggressive) to 0.6 very lax).

  • num_samples (int) – Number of samples generated for a RANSAC reconstruction. This is the number of samples to generate in the random sampling consensus process. The larger this value, the more robust but also slower the processing will be.

  • subset_size (float) – Subset size. This is the size of the channel subsets to use for robust reconstruction, as a number or fraction of the total number of channels.

Return type:

Dict[str, Any]

Returns#

EEG : data set with bad channels removed