ica_processing.fit_ica#

autoclean.functions.ica.ica_processing.fit_ica(raw, n_components=None, method='fastica', max_iter='auto', random_state=97, picks=None, verbose=None, **kwargs)[source]#

Fit Independent Component Analysis (ICA) to EEG data.

This function creates and fits an ICA decomposition on the provided EEG data. ICA is commonly used to identify and remove artifacts like eye movements, muscle activity, and heartbeat from EEG recordings.

Parameters:
rawmne.io.Raw

The raw EEG data to decompose with ICA.

n_componentsint or None, default None

Number of principal components to use. If None, uses all available components based on the data rank.

methodstr, default “fastica”

The ICA algorithm to use. Options: “fastica”, “infomax”, “picard”.

max_iterint or “auto”, default “auto”

Maximum number of iterations for the ICA algorithm.

random_stateint or None, default 97

Random state for reproducible results.

pickslist of str, str, or None, default None

Channels to include in ICA. If None, uses all available channels.

verbosebool or None, default None

Control verbosity of output.

**kwargs

Additional keyword arguments passed to mne.preprocessing.ICA.

Returns:
icamne.preprocessing.ICA

The fitted ICA object containing the decomposition.

See also

classify_ica_components

Classify ICA components using ICLabel

apply_ica_rejection

Apply ICA to remove artifact components

mne.preprocessing.ICA

MNE ICA implementation

Examples

>>> ica = fit_ica(raw)
>>> ica = fit_ica(raw, n_components=20, method="picard")