mne_bids.inspect_dataset

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.

Warning

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.

Note

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

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

Parameters
bids_pathmne_bids.BIDSPath

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.

find_flatbool

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% of flat data will be marked as bad in *_channels.tsv.

Note

This function calls mne.preprocessing.annotate_flat() 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% 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.

show_annotationsbool

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

verbosebool | None

If a boolean, whether or not to produce verbose output. If None, use the default log level.

Examples

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