π 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 β