eelbrain.pipeline.RawICA

class eelbrain.pipeline.RawICA(source, task=None, method='extended-infomax', random_state=0, fit_kwargs=None, cache=False, **kwargs)[source]

ICA raw pipe

Parameters:
  • source (str) – Name of the raw pipe to use for input data.

  • task (str | Sequence[str] | None) – Task(s) to use for estimating ICA components. Can be omitted (None) when the experiment has exactly one task, or when the ICA step occurs after a RawMaxwell step (in which case all tasks are used, see Notes).

  • method (str) – Method for ICA decomposition (default: 'extended-infomax'; see mne.preprocessing.ICA).

  • random_state (int) – Set the random state for ICA decomposition to make results reproducible (default 0, see mne.preprocessing.ICA).

  • fit_kwargs (dict[str, Any]) – A dictionary with keyword arguments that should be passed to mne.preprocessing.ICA.fit(). This includes reject={'mag': 5e-12, 'grad': 5000e-13, 'eeg': 300e-6} unless a different value for reject is specified here.

  • cache (bool) – Cache the resulting raw files (default False).

  • ... – Additional parameters for mne.preprocessing.ICA.

Notes

This preprocessing step estimates one set of ICA components per subject, using the data specified in the task parameter. If the experiment has exactly one task, task can be omitted. The selected components are then removed from all data tasks during this preprocessing step, regardless of whether they were used to estimate the components or not.

When the ICA step occurs after a RawMaxwell step, task can be omitted even with multiple tasks: all tasks and runs available for each subject/session/acquisition are concatenated for the fit. This is safe because Maxwell filtering maps every recording to a common head position. Run concatenation applies to any ICA step after a RawMaxwell step (also with an explicit task); without a preceding RawMaxwell step a single run is used.

Use Pipeline.make_ica_selection() for each subject to select ICA components that should be removed. The arguments to that function determine what data is used to visualize the component time courses.

This step merges bad channels from all tasks.

Examples

Some ICA examples:

class Experiment(Pipeline):

    raw = {
        '1-40': RawFilter('raw', 1, 40),
        # Extended infomax with PCA preprocessing
        'ica': RawICA('1-40', n_components=0.99),
        # Fast ICA
        'fastica': RawICA('1-40', 'task', 'fastica', n_components=0.9),
        # Change thresholds for data rejection using fit_kwargs
        'ica-rej': RawICA('1-40', 'task', 'fastica', fit_kwargs=dict(
            reject={'mag': 5e-12, 'grad': 5000e-13, 'eeg': 500e-6},
        )),
    }