channels.ChannelsMixin#
- class autoclean.mixins.signal_processing.channels.ChannelsMixin[source]#
Mixin class providing channel operations functionality for EEG data.
- clean_bad_channels(data=None, correlation_thresh=0.35, deviation_thresh=2.5, ransac_sample_prop=0.35, ransac_corr_thresh=0.65, ransac_frac_bad=0.25, ransac_channel_wise=False, random_state=1337, cleaning_method='interpolate', reset_bads=True, stage_name='post_bad_channels')[source]#
Detect and mark bad channels using various methods.
This method uses the MNE NoisyChannels class to detect bad channels using SNR, correlation, deviation, and RANSAC methods.
- Parameters:
- data
mne.io.Raw
,Optional
The data object to detect bad channels from. If None, uses self.raw.
- correlation_thresh
float
,Optional
Threshold for correlation-based detection.
- deviation_thresh
float
,Optional
Threshold for deviation-based detection.
- ransac_sample_prop
float
,Optional
Proportion of samples to use for RANSAC.
- ransac_corr_thresh
float
,Optional
Threshold for RANSAC-based detection.
- ransac_frac_bad
float
,Optional
Fraction of bad channels to use for RANSAC.
- ransac_channel_wisebool,
Optional
Whether to use channel-wise RANSAC.
- random_state
int
,Optional
Random state for reproducibility.
- cleaning_method
str
,Optional
Method to use for cleaning bad channels. Options are ‘interpolate’ or ‘drop’ or None(default).
- reset_badsbool,
Optional
Whether to reset bad channels.
- stage_name
str
,Optional
Name for saving and metadata.
- data
- Returns:
- result_raw
instance
ofmne.io.Raw
The raw data object with bad channels marked or cleaned
- result_raw
See also
pyprep.find_noisy_channels.NoisyChannels
For more information on the NoisyChannels class
- drop_channels(data=None, channels=None, stage_name='drop_channels', use_epochs=False)[source]#
Drop specified channels from the data.
This method removes specified channels from the data.
- Parameters:
- data
mne.io.Raw
ormne.Epochs
,Optional
The data object to drop channels from. If None, uses self.raw or self.epochs.
- channels
List
[str
],Optional
List of channel names to drop.
- stage_name
str
,Optional
Name for saving and metadata.
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- data
- Returns:
- result_data
instance
ofmne.io.Raw
ormne.Epochs
The data object with channels dropped
- result_data
See also
mne.io.Raw.drop_channels()
For MNE’s raw data channel dropping functionality
mne.Epochs.drop_channels()
For MNE’s epochs channel dropping functionality
- set_channel_types(data=None, ch_types_dict=None, stage_name='set_channel_types', use_epochs=False)[source]#
Set channel types for specific channels.
This method sets the type of specific channels (e.g., marking channels as EOG).
- Parameters:
- data
mne.io.Raw
ormne.Epochs
,Optional
The data object to set channel types for. If None, uses self.raw or self.epochs.
- ch_types_dict
dict
,Optional
Dictionary mapping channel names to types (e.g., {‘E1’: ‘eog’})
- stage_name
str
,Optional
Name for saving and metadata.
- use_epochsbool,
Optional
If True and data is None, uses self.epochs instead of self.raw.
- data
- Returns:
- result_data
instance
ofmne.io.Raw
ormne.Epochs
The data object with updated channel types
- result_data