π Documentation in Progress
We are actively expanding and refining the full documentation for ICA workflows and related preprocessing steps.In the meantime, this page provides an overview of the default template steps included in AutoCleanEEG during development. These defaults are designed to give users a working, reproducible pipeline even before every option is fully documented.
We are actively expanding and refining the full documentation for ICA workflows and related preprocessing steps.In the meantime, this page provides an overview of the default template steps included in AutoCleanEEG during development. These defaults are designed to give users a working, reproducible pipeline even before every option is fully documented.
Annotate noisy epochs
Flags high-variance segments by temporarily epoching the continuous signal and measuring channel standard deviations. Technical details: Custom algorithm that uses an interquartile range (IQR) rule to mark epochs where many channels have outlier variance. View Source Code β Parametersepoch_duration
,epoch_overlap
β size and overlap of temporary epochs in seconds.quantile_k
β IQR multiplier for outlier detection.quantile_flag_crit
β proportion of channels required to flag an epoch.annotation_description
β text for added annotations.
Annotate uncorrelated epochs
Identifies periods where channels lose spatial correlation with their neighbors. Technical details: Custom routine that computes nearest-neighbor correlations using channel locations; epochs with too many low-correlation channels are annotated. View Source Code β Parametersepoch_duration
,epoch_overlap
β epoch size and overlap in seconds.n_nearest_neighbors
β number of spatial neighbors per channel.corr_method
,corr_trim_percent
β aggregation strategy for neighbor correlations.outlier_k
,outlier_flag_crit
β thresholds for marking epochs.annotation_description
β text for added annotations.
Detect dense oscillatory artifacts
This step looks for short bursts of oscillations that appear across many channels simultaneously. These patterns often correspond to what some researchers call reference artifacts β global signals that arise not from neural activity but from the reference montage or amplifier coupling. They can appear as large-amplitude βwavesβ shared across nearly every electrode at once.Technical details
AutoCleanEEG uses a custom sliding-window algorithm:- For each window, it counts how many channels exceed a peak-to-peak amplitude threshold.
- If the number of channels crossing the threshold is above a specified minimum, the window is annotated as an artifact.
- Optional padding ensures the artifact window includes pre- and post-burst activity for safety.
window_size_ms
β window length in milliseconds.channel_threshold_uv
β per-channel peak-to-peak amplitude threshold (Β΅V).min_channels
β minimum number of channels exceeding the threshold.padding_ms
β padding added before/after detected artifacts.annotation_label
β description for annotations.
Run ICA
Decomposes the signal into independent components for later artifact rejection. Technical details:run_ica
wraps autoclean.functions.ica.fit_ica
, which uses mne.preprocessing.ICA
and optional temporary high-pass filtering.
View Source Code β
Parameters
method
,n_components
,fit_params
β passed to MNEβs ICA.temp_highpass_for_ica
β optional high-pass filter applied only for decomposition.
Classify and reject components
Labels ICA components as brain or artifact and optionally removes the bad ones. Technical details:classify_ica_components
calls AutoCleanβs classifier wrappers (ICLabel, ICVision, or a hybrid of both). apply_ica_component_rejection
then drops components exceeding an optional probability threshold.
View Classification Code β | View Rejection Code β
Parameters
method
β'iclabel'
(machine learning),'icvision'
(custom template matching), or'hybrid'
(ICLabel followed by ICVision on a subset).ic_flags_to_reject
β component labels considered artifacts.ic_rejection_threshold
β minimum probability for rejection.psd_fmax
β max frequency in power spectrum plots (ICVision only).icvision_n_components
β number of leading components to inspect with ICVision when using the hybrid method.
Create regular epochs
Splits continuous data into fixed-length segments for analysis. Technical details: Wrapper aroundautoclean.functions.epoching.create_regular_epochs
, which builds events and constructs an mne.Epochs
object while tracking metadata.
View Source Code β
Parameters
tmin
,tmax
β epoch boundaries in seconds.remove_baseline.window
β baseline interval if enabled.threshold_rejection.volt_threshold
β amplitude rejection threshold.reject_by_annotation
β drop epochs overlapping bad annotations.
Detect outlier epochs
Removes epochs with abnormal amplitude or variance. Technical details:detect_outlier_epochs
implements a FASTER-inspired z-score approach across mean, variance, maximum, and range metrics.
View Source Code β
Parameters
threshold
β z-score required to mark an epoch as an outlier.
GFP clean epochs
Drops epochs with extreme Global Field Power (GFP) values and optionally subsamples to a fixed count. Technical details:gfp_clean_epochs
computes GFP across scalp electrodes and removes epochs whose GFP z-score exceeds a threshold.
View Source Code β
Parameters
gfp_threshold
β z-score cutoff.number_of_epochs
β randomly retain this many cleaned epochs.random_seed
β seed used when selecting epochs.
Generate reports
Creates before/after visualizations for quality control. Technical details: Combines mixin helpers likeplot_raw_vs_cleaned_overlay
and step_psd_topo_figure
to save diagnostic figures.
View Report Generation β | View PSD Figures β