mne-python: ValueError: Could not find EEG array in the .set file.

Describe the bug

Dear MNE developers Thank you for developing this wonderful tool.

I am faced with the error when I tried to use read_raw_eeglab() to load the .set file made by EEGLAB What I did in EEGLAB is just loading the data by Quick 30 and save it in ‘.set(with ‘.fdt’)’ format only. I think this is very weird, so I guess this is bug.

The script I made is below.

subject_name = 'DA'
script_path = os.path.abspath('./Python/EEG_analysis')
data_path = os.path.abspath('./output_play/' + subject_name) 
os.path.exists(data_path + '/'+ subject_name + '.set') # The print out result is 'True'
raw = mne.io.read_raw_eeglab(input_fname = data_path + '/'+ subject_name + '.set')

Actual results

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-1519c0d84577> in <module>
----> 1 raw = mne.io.read_epochs_eeglab(input_fname = data_path + '/'+ subject_name + '_play_merged.set')

~/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py in read_epochs_eeglab(input_fname, events, event_id, eog, verbose, uint16_codec)
    277     epochs = EpochsEEGLAB(input_fname=input_fname, events=events, eog=eog,
    278                           event_id=event_id, verbose=verbose,
--> 279                           uint16_codec=uint16_codec)
    280     return epochs
    281 

<decorator-gen-198> in __init__(self, input_fname, events, event_id, tmin, baseline, reject, flat, reject_tmin, reject_tmax, montage, eog, verbose, uint16_codec)

~/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py in __init__(self, input_fname, events, event_id, tmin, baseline, reject, flat, reject_tmin, reject_tmax, montage, eog, verbose, uint16_codec)
    449                  uint16_codec=None):  # noqa: D102
    450         eeg = _check_load_mat(input_fname, uint16_codec)
--> 451 
    452         if not ((events is None and event_id is None) or
    453                 (events is not None and event_id is not None)):

~/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/mne/io/eeglab/eeglab.py in _check_load_mat(fname, uint16_codec)
     63             'mne-python developers for more information.')
     64     if 'EEG' not in eeg:
---> 65         raise ValueError('Could not find EEG array in the .set file.')
     66     else:
     67         eeg = eeg['EEG']

ValueError: Could not find EEG array in the .set file.

Additional information

I am using the latest version of EEGLAB(2021), so there might be some minor change in the .set file. This might be why I am faced with this error.

Thank you in advance.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (14 by maintainers)

Most upvoted comments

This is because, when saving in the root, it is possible to ignore some fields (such as “data”). In that case, we can load the metadata without loading the data, so there is no need to save 2 files anymore (.set and .fdt). We can just save one file. Simpler for users. EEGLAB in 2004 used to save files in this way as well so all versions of EEGLAB are already compatible with this format.

@cbrnr I uninstalled mne and install it again as @hoechenberger suggested. Then, the problem was finally solved !!!

Thank you for everything !! I really appriciate all of your kindly help !!

In any case, I think it’s time for an official release of 0.22.1 - @hoechenberger https://github.com/hoechenberger @larsoner https://github.com/larsoner what are our plans?

+1