** Errors with
I’m having a problem with
.edf files in the dataset
ds002720 found in the OpenNeuro repository.
I’ve succeeded in working with other datasets, so I don’t know if the bug is in the dataset in the MNE library.
In the MNE GitHub account, I’ve found that you have to set the verbose to load the wrong channels.
I’ve done it, and I’m still getting an error, and I didn’t do any processing yet, just trying to read the raw data.
I’m sending a jupyter notebook with the error; I’ve used the tutorial jupyter notebook on the MNE site and just changed the dataset.
Thank you a lot, guys
Hello @AngelicaRibeiro and welcome to the forum!
I couldn’t access your notebook (but requested permission), so I cooked up a minimal working example:
from pathlib import Path
bids_root = Path('/tmp/ds002720')
bids_path = mne_bids.BIDSPath(
raw = mne_bids.read_raw_bids(bids_path=bids_path)
This yields the following error message:
ValueError Traceback (most recent call last)
Untitled-4 in <module>
----> 25 raw = mne_bids.read_raw_bids(bids_path=bids_path)
<decorator-gen-557> in read_raw_bids(bids_path, extra_params, verbose)
~/Development/mne-bids/mne_bids/read.py in read_raw_bids(bids_path, extra_params, verbose)
692 if events_fname is not None:
--> 693 raw = _handle_events_reading(events_fname, raw)
695 # Try to find an associated channels.tsv to get information about the
~/Development/mne-bids/mne_bids/read.py in _handle_events_reading(events_fname, raw)
400 if trial_type_col_name is not None:
401 # Drop events unrelated to a trial type
--> 402 events_dict = _drop(events_dict, 'n/a', trial_type_col_name)
404 if 'value' in events_dict:
~/Development/mne-bids/mne_bids/tsv_handler.py in _drop(data, values, column)
110 # FutureWarning, see
111 # https://github.com/mne-tools/mne-bids/pull/372
--> 112 values = np.array(values, dtype=new_data_col.dtype)
114 mask = np.in1d(new_data_col, values, invert=True)
ValueError: could not convert string to float: 'n/a'
Seems like a bug in MNE-BIDS.
@sappelhoff can you take a look if you have time?
the cause of the issue is that the
*_events.tsv files in the dataset are empty (except for the column names). The BIDS spec isn’t clear on whether this is valid. In any case, MNE-BIDS doesn’t handle this situation gracefully.
Simply removing the
*_events.tsv files fixes the issue.
btw another aspect that this dataset isn’t doing great is that apparently it encodes runs as “tasks”. May seem like a formality only, but it’s clearly not how BIDS envisioned things to be…
Edit: I’ve opened an issue at
seems like it … I’ll look into it and will maybe make a PR to the spec and the validator.
I’ve gave you permission, to access the file.
And its the same ‘NaN’ error that you reproduced.
I’ve noticed that they are using run as tasks, to work around this problem, I’ve settled up like :
subject = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18']
session = None
task=['run1','run2', 'run3', 'run4', 'run5','run6', 'run7','run8','run9']
acquisition = None
run = None
split = None
suffix = ['channels', 'eeg', 'eeg', 'events', '.events']
extension = ['.tsv', '.edf', '.json', '.json', '.tsv' ]
datatype = 'eeg'
check = True