Artifact and physiological signal processing
Independent component analysis for artifact correction and processing of physiological signals.
almkanal.almkanal_steps.ica_utils.ICA
Bases: AlmKanalStep
Identify and optionally remove artifacts using independent component analysis.
ICA fits an independent component analysis model to continuous raw data and
identifies components associated with physiological or environmental artifacts.
Supported artifact classes include eye movements (EOG), cardiac activity (ECG),
muscle activity (EMG), and the approximately 16 Hz train-related artifact
encountered in recordings acquired in Salzburg.
The data used to fit ICA can be filtered and resampled independently of the
original recording. Identified components can either be removed immediately or
retained for inspection by setting fit_only=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit_only
|
bool
|
If |
False
|
n_components
|
int | float | None
|
Number of ICA components to estimate. The interpretation follows
:class: |
None
|
method
|
str
|
ICA fitting method passed to :class: |
'picard'
|
random_state
|
int | None
|
Random seed used during ICA fitting. |
None
|
fit_params
|
dict | None
|
Additional method-specific parameters passed to the ICA fitting procedure. |
None
|
ica_hp_freq
|
float | None
|
High-pass cutoff frequency, in Hz, applied to the copy of the data used for
ICA fitting. |
1.0
|
ica_lp_freq
|
float | None
|
Low-pass cutoff frequency, in Hz, applied to the copy of the data used for
ICA fitting. |
None
|
resample_freq
|
int
|
Sampling frequency, in Hz, used for the data on which ICA is fitted. |
200
|
eog
|
bool
|
Whether to identify components associated with ocular artifacts. |
True
|
surrogate_eog_chs
|
dict | None
|
Definition of surrogate EOG channels used when dedicated EOG channels are unavailable. |
None
|
eog_corr_thresh
|
float
|
Correlation threshold used to classify components as EOG-related. |
0.4
|
ecg
|
bool
|
Whether to identify components associated with cardiac artifacts. |
True
|
ecg_corr_thresh
|
float
|
Correlation threshold used to classify components as ECG-related. |
0.4
|
emg
|
bool
|
Whether to identify components associated with muscle activity. |
False
|
emg_thresh
|
float
|
Threshold used to classify components as EMG-related. |
0.5
|
train
|
bool
|
Whether to identify components associated with the train-related artifact. |
False
|
train_freq
|
float
|
Frequency, in Hz, around which the train-related artifact is detected. |
16.666
|
train_thresh
|
float
|
Threshold used to classify components as train-related. |
3.0
|
img_path
|
str | None
|
Optional image-output path retained as part of the ICA step configuration. |
None
|
fname
|
str | None
|
Optional filename retained as part of the ICA step configuration. |
None
|
Notes
ICA preprocessing is performed on a working copy of the recording. Filtering
and resampling controlled by ica_hp_freq, ica_lp_freq, and
resample_freq therefore do not replace the corresponding preprocessing of
the pipeline data itself.
When fit_only=False, components identified as artifacts are excluded and
the fitted ICA solution is applied to the original data. When
fit_only=True, the fitted ICA model and identified components are returned
without modifying the input signal through component removal.
The processing metadata returned by :meth:run is stored under 'ica_info'.
It contains the fitted ICA object, identified components grouped by artifact
type, the applied exclusion list, EOG and ECG scores, and the effective ICA
configuration.
Multiple ICA steps are permitted in a pipeline. Reporting uses the most
recent occurrence.
See Also
run_ica Fit ICA, identify artifact-related components, and optionally apply the resulting exclusions. mne.preprocessing.ICA MNE-Python implementation of independent component analysis.
almkanal.almkanal_steps.bio_utils.PhysioCleaner
Bases: AlmKanalStep
Preprocess physiological signals in a continuous MNE recording.
PhysioCleaner extracts selected ECG, respiratory, EOG, and EMG channels
from a continuous recording and preprocesses them using
:func:run_bio_preproc. The resulting data contain the cleaned physiological
signals together with stimulus channels retained from the original recording.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ecg
|
str | list | None
|
ECG channel or channels to preprocess. |
None
|
resp
|
str | list | None
|
Respiratory channel or channels to preprocess. |
None
|
eog
|
str | list | None
|
EOG channel or channels to preprocess. |
None
|
emg
|
str | list | None
|
EMG channel or channels to preprocess. |
None
|
Notes
Physiological preprocessing is delegated to :func:run_bio_preproc, which
uses NeuroKit2 to process the selected signals.
The processed recording returned by :meth:run is stored under 'data'.
It contains the physiological outputs produced by the preprocessing routine
together with the stimulus channels retained from the original recording.
Processing metadata are stored under 'physio_info'. The current metadata
include the sampling frequency and signal-specific preprocessing information
for ECG, EOG, and EMG processing.
PhysioCleaner can occur only once in a pipeline and is intended to run
before forward modelling, spatial filtering, and source reconstruction.
The step currently does not add content to the MNE report.
See Also
run_bio_preproc Preprocess the selected physiological channels.