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_pathBIDSPath

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_namesstr | list of str

The names of the channel(s) to mark with a status and possibly a description. Can be an empty list to indicate all channel names.

status‘good’ | ‘bad’ | list of str

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.

descriptionsNone | str | list of str

Descriptions of the reasons that lead to the exclusion of the channel(s). If a list, it must match the length of ch_names. If None, no descriptions are added.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

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)

Examples using mne_bids.mark_channels