Questions about the sample data set

  • MNE version:1.3.0
  • operating system: Ubuntu 18.04

I recently want to study this MEG+EEG data set (A multi-subject, multi-modal human neuroimaging dataset | Scientific Data, OpenNeuro). I found that MNE also contains the sample data set of the audvis task of the MEG/EEG channel, and their channel names are consistent. Is this the source of the sample data set of MNE?

In addition, I downloaded the ds003645 data set, and the eeg data format is like this:
image

I use mne.io.read_raw(‘sub-002_task-FacePerception_run-1_eeg.set’, preload=True) to read this data, which shows a error:

/tmp/ipykernel_27626/1747141852.py:1: RuntimeWarning: Unknown types found, setting as type EEG:
ekg: ['EEG063', 'EEG064']
heog: ['EEG061']
veog: ['EEG062']
  raw = mne.io.read_raw('/data/public/qht/eeg_FacePerception/sub-002/eeg/sub-002_task-FacePerception_run-1_eeg.set', preload=True)
/tmp/ipykernel_27626/1747141852.py:1: RuntimeWarning: Estimated head radius (1.1 cm) is below the 3rd percentile for infant head size. Check if the montage_units argument is correct (the default is "mm", but your channel positions may be in different units).
  raw = mne.io.read_raw('/data/public/qht/eeg_FacePerception/sub-002/eeg/sub-002_task-FacePerception_run-1_eeg.set', preload=True)
Traceback (most recent call last):

  File "/tmp/ipykernel_27626/1747141852.py", line 1, in <module>
    raw = mne.io.read_raw('/data/public/qht/eeg_FacePerception/sub-002/eeg/sub-002_task-FacePerception_run-1_eeg.set', preload=True)

  File "/data/public/lib/python3.7/site-packages/mne/io/_read_raw.py", line 98, in read_raw
    return readers[ext](fname, preload=preload, verbose=verbose, **kwargs)

  File "/data/public/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py", line 285, in read_raw_eeglab
    montage_units=montage_units, verbose=verbose)

  File "<decorator-gen-295>", line 12, in __init__

  File "/data/public/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py", line 385, in __init__
    info, eeg_montage, _ = _get_info(eeg, eog=eog, scale_units=scale_units)

  File "/data/public/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py", line 207, in _get_info
    info = create_info(ch_names, sfreq=eeg.srate, ch_types=ch_types)

  File "<decorator-gen-38>", line 12, in create_info

  File "/data/public/lib/python3.7/site-packages/mne/io/meas_info.py", line 2467, in create_info
    raise KeyError(f'kind must be one of {list(ch_types_dict)}, '

KeyError: "kind must be one of ['grad', 'mag', 'ref_meg', 'eeg', 'seeg', 'dbs', 'ecog', 'eog', 'emg', 'ecg', 'resp', 'bio', 'misc', 'stim', 'exci', 'syst', 'ias', 'gof', 'dipole', 'chpi', 'fnirs_cw_amplitude', 'fnirs_fd_ac_amplitude', 'fnirs_fd_phase', 'fnirs_od', 'hbo', 'hbr', 'csd', 'temperature', 'gsr'], not meg"

How should a data set like this containing MEG and EEG channels be read in MNE? Thank you very much if anyone can answer.

Hi @jshlyz ,

It looks like that data is in a BIDS compliant structure. Have you tried to use MNE-BIDS to load the dataset?

Hi,thank you for reply!
In fact, I have also tried using the MNE-BIDS function to read, and the result is the same error. I used:

In[1]: bids_path
Out[1]: 
BIDSPath(
root: /data/public/qht/eeg_FacePerception
datatype: eeg
basename: sub-002_task-FacePerception_run-1_eeg.set)

 data = read_raw_bids(bids_path=bids_path, 
                          extra_params={'preload':True},
                          verbose=False)

Still prompt for this error:

KeyError: "kind must be one of ['grad', 'mag', 'ref_meg', 'eeg', 'seeg', 'dbs', 'ecog', 'eog', 'emg', 'ecg', 'resp', 'bio', 'misc', 'stim', 'exci', 'syst', 'ias', 'gof', 'dipole', 'chpi', 'fnirs_cw_amplitude', 'fnirs_fd_ac_amplitude', 'fnirs_fd_phase', 'fnirs_od', 'hbo', 'hbr', 'csd', 'temperature', 'gsr'], not meg"

It seems that the channel name in this data set does not comply with the rules. How should I use MNE to read in the data in this case?

I took a look at subject-002 in that dataset, the channels.tsv file correctly lists the channels as magnetometers or gradiometers. My guess is that within the .set/.fdt files, the channel types are being explicitly called "meg", which as you pointed out, does not match what MNE expects (it has no way of knowing whether the "meg" channel is a grad or mag).

My guess is that MNE-BIDS would eventually load the channels.tsv file and set the channel types according to that file, but it probably never gets a chance to because the error is happening while loading the eeglab file (CC’ing @sappelhoff to correct me if I’m wrong, which I very well could be).

Not sure what to suggest here. You could contact the authors and inform them of the error (in the hopes that they update the files), or you could try to get the data into a numpy array, and then use mne.io.RawArray, but that would probably be a lot of work.

1 Like

Yes, this seems about right.

@jshlyz just to give you a little more to go off, if you really want to go down the road of manually loading these files, I would look into pymatreader:

Then you can look for the data and info needed to create a a Raw object: create_info and RawArray

(untested)

from pymatreader import read_mat

mat_content = read_mat(filename)
print(mat_content.keys())# look for a key like "sEEG" or similar
srate = mat_content["sEEG"]["srate"]
ch_names = mat_content["sEEG"]["chanlocs"]["labels"]
ch_types = mat_content["sEEG"]["chanlocs"]["type"]
data = mat_content["sEEG"]["data"]

Thank you for your patient answer. I will try your method. Sincere thanks again!