Standalone Functions (autoclean.functions)#

This section covers the standalone functions that provide modular EEG data processing capabilities in AutoClean. These functions can be used independently without the Task/Mixin framework, making them ideal for custom workflows, scripting, and integration with other EEG analysis pipelines.

Standalone functions are designed to be stateless and operate directly on MNE data objects:

from autoclean.functions import filter_data, detect_bad_channels, fit_ica

# Direct function usage - no task object required
filtered_raw = filter_data(raw, l_freq=1.0, h_freq=40.0)
bad_channels = detect_bad_channels(filtered_raw)
ica = fit_ica(filtered_raw)

Note: Standalone functions return processed data objects and do not modify the input data in-place. They provide a functional programming approach as an alternative to the object-oriented Task/Mixin pattern.

Available Function Categories#

Preprocessing Functions#

filtering.filter_data

Filter EEG data using highpass, lowpass, and/or notch filtering.

referencing.rereference_data

Apply referencing scheme to EEG data.

resampling.resample_data

Resample EEG data to a new sampling frequency.

basic_ops.crop_data

Crop EEG data to a specific time range.

basic_ops.drop_channels

Drop channels from EEG data.

Artifact Detection Functions#

channels.detect_bad_channels

Detect bad channels using multiple statistical methods.

channels.interpolate_bad_channels

Interpolate bad channels using spherical spline interpolation.

Epoching Functions#

regular.create_regular_epochs

Create regular fixed-length epochs from continuous EEG data.

statistical.create_sl_epochs

Create statistical learning epochs based on syllable event patterns.

eventid.create_eventid_epochs

Create epochs based on specific event IDs from continuous EEG data.

quality.detect_outlier_epochs

Detect and mark outlier epochs based on statistical measures.

quality.gfp_clean_epochs

Clean epochs based on Global Field Power (GFP) outlier detection.

ICA Functions#

ica_processing.fit_ica

Fit Independent Component Analysis (ICA) to EEG data.

ica_processing.classify_ica_components

Classify ICA components using automated algorithms.

ica_processing.apply_ica_rejection

Apply ICA to remove specified components from EEG data.

Segment Rejection Functions#

segment_rejection.annotate_noisy_segments

Identify and annotate noisy segments in continuous EEG data.

segment_rejection.annotate_uncorrelated_segments

Identify and annotate segments with poor channel-neighbor correlations.

dense_oscillatory.detect_dense_oscillatory_artifacts

Detect smaller, dense oscillatory multichannel artifacts.

Advanced Processing Functions#

autoreject.autoreject_epochs

Apply AutoReject for automatic epoch cleaning and channel interpolation.

Visualization Functions#

plotting.plot_raw_comparison

Plot raw data comparison showing original vs cleaned data overlay.

plotting.plot_ica_components

Plot ICA component topographies and properties.

plotting.plot_psd_topography

Plot power spectral density topographical maps for frequency bands.

reports.generate_processing_report

Generate a comprehensive HTML processing report.

reports.create_processing_summary

Create a JSON summary of processing steps.