basic_steps.BasicStepsMixin#
- class autoclean.mixins.signal_processing.basic_steps.BasicStepsMixin[source]#
Mixin class providing basic signal processing steps for autoclean tasks.
- run_basic_steps(data=None, use_epochs=False, stage_name='post_basic_steps', export=False)[source]#
Runs all basic preprocessing steps sequentially based on configuration.
The steps included are: 1. Resample Data 2. Filter Data 3. Drop Outer Layer Channels 4. Assign EOG Channels 5. Trim Edges 6. Crop Duration
Each step’s execution depends on its ‘enabled’ status in the configuration.
- Parameters:
- data
Optional
The data object to process. If None, uses self.raw or self.epochs.
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- stage_name
str
,Optional
Name of the processing stage for export. Default is “post_basic_steps”.
- exportbool,
Optional
If True, exports the processed data to the stage directory. Default is False.
- data
- Returns:
- inst
instance
ofmne.io.Raw
ormne.io.Epochs
The data object after applying all enabled basic processing steps.
- inst
- filter_data(data=None, use_epochs=False, l_freq=None, h_freq=None, notch_freqs=None, notch_widths=None, method=None, phase=None, fir_window=None, verbose=None)[source]#
Apply filtering to EEG data within the AutoClean pipeline.
This method wraps the standalone
autoclean.filter_data()
function with pipeline integration including configuration management, metadata tracking, and automatic export functionality.Parameters override configuration values when provided. If not provided, values are read from the task configuration using the existing
_check_step_enabled
system.- Parameters:
- data
mne.io.Raw
,mne.Epochs
,or
None
,default
None
Input data. If None, uses
self.raw
orself.epochs
based onuse_epochs
parameter.- use_epochsbool,
default
False
If True and data is None, uses
self.epochs
instead ofself.raw
.- l_freq
float
orNone
, optional Low cutoff frequency for highpass filtering in Hz. Overrides config if provided.
- h_freq
float
orNone
, optional High cutoff frequency for lowpass filtering in Hz. Overrides config if provided.
- notch_freqs
list
offloat
orNone
, optional Frequencies to notch filter in Hz. Overrides config if provided.
- notch_widths
float
,list
offloat
,or
None
, optional Width of notch filters in Hz. Overrides config if provided.
- method
str
orNone
, optional Filtering method (‘fir’ or ‘iir’). Overrides config if provided.
- phase
str
orNone
, optional Filter phase (‘zero’, ‘zero-double’, ‘minimum’). Overrides config if provided.
- fir_window
str
orNone
, optional FIR window function. Overrides config if provided.
- verbosebool or
None
, optional Control verbosity. Overrides config if provided.
- data
- Returns:
- filtered_data
mne.io.Raw
ormne.Epochs
Filtered data object. Also updates
self.raw
orself.epochs
and triggers metadata tracking and export if configured.
- filtered_data
See also
autoclean.filter_data
The underlying standalone filtering function
- resample_data(data=None, target_sfreq=None, stage_name='post_resample', use_epochs=False, npad=None, window=None, n_jobs=None, pad=None, verbose=None)[source]#
Apply resampling to EEG data within the AutoClean pipeline.
This method wraps the standalone
autoclean.resample_data()
function with pipeline integration including configuration management, metadata tracking, and automatic export functionality.Parameters override configuration values when provided. If not provided, values are read from the task configuration using the existing
_check_step_enabled
system.- Parameters:
- data
mne.io.Raw
,mne.Epochs
,or
None
,default
None
Input data. If None, uses
self.raw
orself.epochs
based onuse_epochs
parameter.- target_sfreq
float
orNone
, optional Target sampling frequency in Hz. Overrides config if provided.
- stage_name
str
,default
“post_resample” Name for saving the resampled data.
- use_epochsbool,
default
False
If True and data is None, uses
self.epochs
instead ofself.raw
.- npad
str
orNone
, optional Padding parameter. Overrides config if provided.
- window
str
orNone
, optional Window function. Overrides config if provided.
- n_jobs
int
orNone
, optional Number of parallel jobs. Overrides config if provided.
- pad
str
orNone
, optional Padding mode. Overrides config if provided.
- verbosebool or
None
, optional Control verbosity. Overrides config if provided.
- data
- Returns:
- resampled_data
mne.io.Raw
ormne.Epochs
Resampled data object. Also updates
self.raw
orself.epochs
and triggers metadata tracking and export if configured.
- resampled_data
See also
autoclean.resample_data
The underlying standalone resampling function
- rereference_data(data=None, ref_type=None, use_epochs=False, stage_name='post_rereference')[source]#
Rereference raw or epoched data based on configuration settings.
This method can work with self.raw, self.epochs, or a provided data object. It checks the rereference_step toggle in the configuration if no ref_type is provided.
- Parameters:
- data
Optional
The raw data to rereference. If None, uses self.raw or self.epochs.
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- ref_type
str
,Optional
The type of reference to use. If None, reads from config.
- stage_name
str
,Optional
Name for saving the rereferenced data (default: “post_rereference”).
- data
- Returns:
- inst
instance
ofmne.io.Raw
ormne.io.Epochs
The rereferenced data object (same type as input)
- inst
See also
mne.io.Raw.set_eeg_reference()
For MNE’s raw data rereferencing functionality
mne.Epochs.set_eeg_reference()
For MNE’s epochs rereferencing functionality
Examples
>>> #Inside a task class that uses the autoclean framework >>> self.rereference_data()
- drop_outer_layer(data=None, stage_name='post_outerlayer', use_epochs=False)[source]#
Drop outer layer channels based on configuration settings.
- Parameters:
- data
Optional
The data object to process. If None, uses self.raw or self.epochs.
- stage_name
str
,Optional
Name for saving the processed data (default: “post_outerlayer”).
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- Returns:
inst : instance of mne.io.Raw or mne.io.Epochs The data object with outer layer channels removed.
- data
- assign_eog_channels(data=None, use_epochs=False)[source]#
Assign EOG channel types based on configuration settings.
- Parameters:
- data
Optional
The data object to process. If None, uses self.raw or self.epochs.
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- Returns:
inst : instance of mne.io.Raw or mne.io.Epochs The data object with EOG channels assigned.
- data
- trim_edges(data=None, stage_name='post_trim', use_epochs=False)[source]#
Trim data edges based on configuration settings.
- Parameters:
- data
Optional
The data object to process. If None, uses self.raw or self.epochs.
- stage_name
str
,Optional
Name for saving the processed data (default: “post_trim”).
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- Returns:
inst : instance of mne.io.Raw or mne.io.Epochs The data object with edges trimmed.
- data
- crop_duration(data=None, stage_name='post_crop', use_epochs=False)[source]#
Crop data duration based on configuration settings.
- Parameters:
- data
Optional
The data object to process. If None, uses self.raw or self.epochs.
- stage_name
str
,Optional
Name for saving the processed data (default: “post_crop”).
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- Returns:
inst : instance of mne.io.Raw or mne.io.Epochs The data object cropped to the specified duration.
- data