meeg_utils.preprocessing.ica#

ICA-based artifact removal for EEG and MEG data.

Functions

apply_ica_pipeline(raw, datatype[, ...])

Apply ICA pipeline for artifact removal.

meeg_utils.preprocessing.ica.apply_ica_pipeline(raw, datatype, n_components=20, method='infomax', regress=False, manual_labels=None, random_state=42)[source]#

Apply ICA pipeline for artifact removal.

Parameters:
  • raw (BaseRaw) – Raw data.

  • datatype ({"eeg", "meg"}) – Data type.

  • n_components (int, optional) – Number of ICA components. Default is 20.

  • method (str, optional) – ICA method. Default is “infomax”.

  • regress (bool, optional) – Whether to regress out artifacts. Default is False.

  • manual_labels (list[str] | None, optional) – Manual component labels. If None, uses automatic labeling.

  • random_state (int, optional) – Random seed. Default is 42.

Returns:

Raw data with ICA applied (if regress=True) or original (if regress=False).

Return type:

BaseRaw