basic_ops.drop_channels#
- autoclean.functions.preprocessing.basic_ops.drop_channels(data, ch_names, on_missing='raise')[source]#
Drop channels from EEG data.
This function removes specified channels from continuous (Raw) or epoched EEG data. Useful for removing bad channels, artifact channels, or channels not needed for analysis.
- Parameters:
- data
mne.io.BaseRaw
ormne.Epochs
The EEG data from which to drop channels.
- ch_names
str
orlist
ofstr
Name(s) of channel(s) to drop. Can be a single channel name or list of names.
- on_missing
str
,default
‘raise’ What to do if a channel name is not found. Options: - ‘raise’: Raise an error - ‘warn’: Issue a warning and continue - ‘ignore’: Silently ignore missing channels
- data
- Returns:
- data_dropped
mne.io.BaseRaw
ormne.Epochs
Data with specified channels removed.
- data_dropped
- Raises:
TypeError
If data is not an MNE Raw or Epochs object.
ValueError
If on_missing=’raise’ and channels are not found.
Examples
Drop single channel:
>>> from autoclean import drop_channels >>> data_clean = drop_channels(raw, 'E125') # Drop channel E125
Drop multiple channels:
>>> data_clean = drop_channels(raw, ['E125', 'E126', 'E127'])
Drop channels with warning for missing:
>>> data_clean = drop_channels(raw, ['E125', 'NonExistent'], on_missing='warn')