Independent Component Analysis#

This section documents the Independent Component Analysis (ICA) functions for decomposition and component classification.

ICA Decomposition#

eegprep.eeg_picard(EEG, engine=None, posact='off', sortcomps='off', **kwargs)#

Perform ICA decomposition using Picard algorithm.

This function can use either a Python implementation or an EEGLAB (via MATLAB or Octave) implementation.

Parameters#

EEGdict

EEGLAB-like data structure.

engineobject, optional

MATLAB or Octave engine instance. If None (default), the Python implementation is used.

posactstr | bool, optional

If ‘on’ or True, normalize component signs so max(abs(activations)) is positive. Default is ‘off’.

sortcompsstr | bool, optional

If ‘on’ or True, sort components by descending activation variance. Default is ‘off’.

**kwargsdict

Additional keyword arguments to be passed to the Picard algorithm. For example, {‘maxiter’: 500}.

Returns#

dict

The updated EEG structure with ICA fields.

Component Classification#

eegprep.iclabel(EEG, algorithm='default', engine=None)#

Apply ICLabel to classify independent components.

Parameters#

EEGdict

EEGLAB EEG structure

algorithmstr

Algorithm to use for classification, passed to the MATLAB/Octave implementation. Default is ‘default’.

enginestr or None

Engine to use for implementation. Options are: - None: Use the default Python implementation - ‘matlab’: Use MATLAB engine - ‘octave’: Use Octave engine

Returns#

EEGdict

EEGLAB EEG structure with ICLabel classifications added

Feature Extraction#

eegprep.ICL_feature_extractor(EEG, flag_autocorr=False)#

Extract features for ICLabel classification.

Parameters#

EEGdict

EEG data structure with ICA

flag_autocorrbool, optional

Whether to include autocorrelation features (default False)

Returns#

featureslist

List of feature arrays