mne_bids.inspect_dataset(bids_path, find_flat=True, l_freq=None, h_freq=None, show_annotations=True, verbose=None)[source]#

Inspect and annotate BIDS raw data.

This function allows you to browse MEG, EEG, and iEEG raw data stored in a BIDS dataset. You can toggle the status of a channel (bad or good) by clicking on the traces, and when closing the browse window, you will be asked whether you want to save the changes to the existing BIDS dataset or discard them.


This functionality is still experimental and will be extended in the future. Its API will likely change. Planned features include automated bad channel detection and visualization of MRI images.


Currently, only MEG, EEG, and iEEG data can be inspected.

To add or modify annotations, press A to toggle annotation mode.


A mne_bids.BIDSPath containing at least a root. All matching files will be inspected. To select only a subset of the data, set more mne_bids.BIDSPath attributes. If datatype is not set and multiple datatypes are found, they will be inspected in the following order: MEG, EEG, iEEG. To read a specific file, set all the mne_bids.BIDSPath attributes required to uniquely identify the file: If this BIDSPath is accepted by mne_bids.read_raw_bids(), it will work here.


Whether to auto-detect channels producing “flat” signals, i.e., with unusually low variability. Flat segments will be added to *_events.tsv, while channels with more than 5 percent of flat data will be marked as bad in *_channels.tsv.


This function calls mne.preprocessing.annotate_amplitude (MNE-Python 1.0 or newer) or mne.preprocessing.annotate_flat (older versions of MNE-Python) and will only consider segments of at least 50 ms consecutive flatness as “flat” (deviating from MNE-Python’s default of 5 ms). If more than 5 percent of a channel’s data has been marked as flat, the entire channel will be added to the list of bad channels. Only flat time segments applying to channels not marked as bad will be added to *_events.tsv.

l_freqfloat | None

The high-pass filter cutoff frequency to apply when displaying the data. This can be useful when inspecting data with slow drifts. If None, no high-pass filter will be applied.

h_freqfloat | None

The low-pass filter cutoff frequency to apply when displaying the data. This can be useful when inspecting data with high-frequency artifacts. If None, no low-pass filter will be applied.


Whether to show annotations (events, bad segments, …) or not. If False, toggling annotations mode by pressing A will be disabled as well.

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.


Disable flat channel & segment detection, and apply a filter with a passband of 1–30 Hz.

>>> from mne_bids import BIDSPath
>>> root = Path('./mne_bids/tests/data/tiny_bids').absolute()
>>> bids_path = BIDSPath(subject='01', task='rest', session='eeg',
...                      suffix='eeg', extension='.vhdr', root=root)
>>> inspect_dataset(bids_path=bids_path, find_flat=False,  
...                 l_freq=1, h_freq=30)

Examples using mne_bids.inspect_dataset#

03. Interactive data inspection and bad channel selection

03. Interactive data inspection and bad channel selection