mne_bids.mark_bad_channels¶
-
mne_bids.mark_bad_channels(ch_names, descriptions=None, *, bids_path, overwrite=False, verbose=True)[source]¶ Update which channels are marked as “bad” in an existing BIDS dataset.
- Parameters
- ch_names
str|listofstr The names of the channel(s) to mark as bad. Pass an empty list in combination with
overwrite=Trueto mark all channels as good.- descriptions
None|str|listofstr 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.- bids_path
mne_bids.BIDSPath The recording to update. The
mne_bids.BIDSPathinstance passed here must have the.rootattribute set. The.datatypeattribute may be set. If.datatypeis not set and only one data type (e.g., only EEG or MEG data) is present in the dataset, it will be selected automatically.- overwritebool
If
False, only update the information of the channels passed viach_names, and leave the rest untouched. IfTrue, update the information of all channels: mark the channels passed viach_namesas bad, and all remaining channels as good, also discarding their descriptions.- verbosebool
The verbosity level.
- ch_names
Examples
Mark a single channel as bad.
>>> mark_bad_channels('MEG 0112', bids_path=bids_path)
Mark multiple channels as bad.
>>> bads = ['MEG 0112', 'MEG 0131'] >>> mark_bad_channels(bads, bids_path=bids_path)
Mark channels as bad, and add a description as to why.
>>> ch_names = ['MEG 0112', 'MEG 0131'] >>> descriptions = ['Only produced noise', 'Continuously flat'] >>> mark_bad_channels(bads, descriptions, bbids_path=bids_path)
Mark two channels as bad, and mark all others as good by setting
overwrite=True.>>> bads = ['MEG 0112', 'MEG 0131'] >>> mark_bad_channels(bads, bids_path=bids_path, overwrite=True)
Mark all channels as good by passing an empty list of bad channels, and setting
overwrite=True.>>> mark_bad_channels([], bids_path=bids_path, overwrite=True)