Error reading BIDS dataset

  • MNE version: 1.0.0
  • mne-bids version: 0.10
  • operating system: Windows 10
  • Python Version: 3.9.9

Me and my team are working on a dataset for research purposes, while running mne.read_raw.bids() we ran into a error. The error is attached as follows:

Extracting parameters from C:\Users\HP\Desktop\research\ds004043\sub-02\eeg\sub-02_task-tempex_eeg.vhdr...
C:\Users\HP\AppData\Local\Temp/ipykernel_10456/1468954698.py:1: RuntimeWarning:     MNE-Python currently only supports header versions 1.0 and 2.0, got unparsable     '/annex/objects/MD5E-s11201--c740eb5ee5f685191833e1152163bc22.vhdr'. Contact MNE-Python developers for support.
  raw = read_raw_bids(bids_path=bids_path)
---------------------------------------------------------------------------
NoSectionError                            Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_10456/1468954698.py in <module>
----> 1 raw = read_raw_bids(bids_path=bids_path)

<decorator-gen-579> in read_raw_bids(bids_path, extra_params, verbose)

C:\Python39\lib\site-packages\mne_bids\read.py in read_raw_bids(bids_path, extra_params, verbose)
    693     if raw_path.suffix == '.fif' and 'allow_maxshield' not in extra_params:
    694         extra_params['allow_maxshield'] = True
--> 695     raw = _read_raw(raw_path, electrode=None, hsp=None, hpi=None,
    696                     config_path=config_path, **extra_params)
    697 

C:\Python39\lib\site-packages\mne_bids\read.py in _read_raw(raw_path, electrode, hsp, hpi, allow_maxshield, config_path, **kwargs)
     66             )
     67         raw_path = Path(raw_path)
---> 68         raw = reader[ext](raw_path, **kwargs)
     69 
     70     # MEF and NWB are allowed, but not yet implemented

C:\Python39\lib\site-packages\mne\io\brainvision\brainvision.py in read_raw_brainvision(vhdr_fname, eog, misc, scale, preload, verbose)
    857     mne.io.Raw : Documentation of attribute and methods.
    858     """
--> 859     return RawBrainVision(vhdr_fname=vhdr_fname, eog=eog,
    860                           misc=misc, scale=scale, preload=preload,
    861                           verbose=verbose)

<decorator-gen-220> in __init__(self, vhdr_fname, eog, misc, scale, preload, verbose)

C:\Python39\lib\site-packages\mne\io\brainvision\brainvision.py in __init__(self, vhdr_fname, eog, misc, scale, preload, verbose)
     71         vhdr_fname = op.abspath(vhdr_fname)
     72         (info, data_fname, fmt, order, n_samples, mrk_fname, montage,
---> 73          orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale)
     74 
     75         with open(data_fname, 'rb') as f:

C:\Python39\lib\site-packages\mne\io\brainvision\brainvision.py in _get_vhdr_info(vhdr_fname, eog, misc, scale)
    457                       "not a file with extension '%s'." % ext)
    458 
--> 459     settings, cfg, cinfostr, info = _aux_vhdr_info(vhdr_fname)
    460     info._unlocked = True
    461 

C:\Python39\lib\site-packages\mne\io\brainvision\brainvision.py in _aux_vhdr_info(vhdr_fname)
    406     # get sampling info
    407     # Sampling interval is given in microsec
--> 408     sfreq = 1e6 / cfg.getfloat(cinfostr, 'SamplingInterval')
    409     info = _empty_info(sfreq)
    410     info._unlocked = False

C:\Python39\lib\configparser.py in getfloat(self, section, option, raw, vars, fallback, **kwargs)
    821     def getfloat(self, section, option, *, raw=False, vars=None,
    822                  fallback=_UNSET, **kwargs):
--> 823         return self._get_conv(section, option, float, raw=raw, vars=vars,
    824                               fallback=fallback, **kwargs)
    825 

C:\Python39\lib\configparser.py in _get_conv(self, section, option, conv, raw, vars, fallback, **kwargs)
    806                   fallback=_UNSET, **kwargs):
    807         try:
--> 808             return self._get(section, conv, option, raw=raw, vars=vars,
    809                              **kwargs)
    810         except (NoSectionError, NoOptionError):

C:\Python39\lib\configparser.py in _get(self, section, conv, option, **kwargs)
    801 
    802     def _get(self, section, conv, option, **kwargs):
--> 803         return conv(self.get(section, option, **kwargs))
    804 
    805     def _get_conv(self, section, option, conv, *, raw=False, vars=None,

C:\Python39\lib\configparser.py in get(self, section, option, raw, vars, fallback)
    779         """
    780         try:
--> 781             d = self._unify_values(section, vars)
    782         except NoSectionError:
    783             if fallback is _UNSET:

C:\Python39\lib\configparser.py in _unify_values(self, section, vars)
   1150         except KeyError:
   1151             if section != self.default_section:
-> 1152                 raise NoSectionError(section) from None
   1153         # Update with the entry specific variables
   1154         vardict = {}

NoSectionError: No section: 'Common infos'

The dataset which we are using is BIDS compliant and can be found here: OpenNeuro HD-EEGtask(Dataset 1)

Looking forward for some help with this error.

Hi @koolgax99, looks like a very interesting BIDS dataset. Unfortunately, Iā€™m not able to replicate your error. When I downloaded sub-02_task-tempex_eeg.vhdr and did

import mne
raw = mne.io.read_raw('sub-02_task-tempex_eeg.vhdr')

it worked just fine, which if you follow the stack trace, is where your script ran into issues. If you look at the very top of your stack trace output it says that the header version is unparsable. This, to me, would suggest that the file was corrupted on download or inadvertently modified. Since I was just able to get a version of the file off of OpenNeuro that worked, I would just suggest redownloading the dataset (perhaps with OpenNeuro-Py GitHub - hoechenberger/openneuro-py: A Python client for accessing OpenNeuro datasets. !).

PS, you linked to the wrong dataset below but the dataset you were using was in your stack trace, which is a bit confusing.