mne_bids.mark_channels¶
- mne_bids.mark_channels(bids_path, *, ch_names, status, descriptions=None, verbose=None)[source]¶
Update status and description of channels in an existing BIDS dataset.
- Parameters
- bids_path
BIDSPath
The recording to update. The
mne_bids.BIDSPath
instance passed here must have the.root
attribute set. The.datatype
attribute may be set. If.datatype
is not set and only one data type (e.g., only EEG or MEG data) is present in the dataset, it will be selected automatically.- ch_names
str
|list
ofstr
The names of the channel(s) to mark with a
status
and possibly adescription
. Can be an empty list to indicate all channel names.- status‘good’ | ‘bad’ |
list
ofstr
The status of the channels (‘good’, or ‘bad’). Default is ‘bad’. If it is a list, then must be a list of ‘good’, or ‘bad’ that has the same length as
ch_names
.- descriptions
None
|str
|list
ofstr
Descriptions of the reasons that lead to the exclusion of the channel(s). If a list, it must match the length of
ch_names
. IfNone
, no descriptions are added.- verbose
bool
|str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- bids_path
Examples
Mark a single channel as bad.
>>> root = Path('./mne_bids/tests/data/tiny_bids').absolute() >>> bids_path = BIDSPath(subject='01', task='rest', session='eeg', ... datatype='eeg', root=root) >>> mark_channels(bids_path=bids_path, ch_names='C4', status='bad', ... verbose=False)
Mark multiple channels as bad, and add a description as to why.
>>> bads = ['C3', 'PO10'] >>> descriptions = ['very noisy', 'continuously flat'] >>> mark_channels(bids_path, ch_names=bads, status='bad', ... descriptions=descriptions, verbose=False)
Mark all channels with a new description, while keeping them as a “good” channel.
>>> descriptions = ['resected', 'resected'] >>> mark_channels(bids_path=bids_path, ch_names=['C3', 'C4'], ... descriptions=descriptions, status='good', ... verbose=False)