Repository navigation
Closed
Labels
Description
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.
Activity
cbrnr commentedon Feb 12, 2021
Could you share a small example file?
MSA8D8 commentedon Feb 12, 2021
@cbrnr Thank you for your quick reply.
Here is the link for the sample data.
I will give you the access permission of the link when you download them.
I made this sample in the same way as before (just loading the data by Quick 30 and save it in '.set(with '.fdt')' format only).
The EEGLAB version is 2021.0 and MNE is v0.22.0.
Thank you for your help.
cbrnr commentedon Feb 12, 2021
Usually, the
.setfile (which is just a.matfile) contains anEEGkey with all relevant data. Your file does not have thisEEGkey, but all fields are directly in the root of the.matfile.Can you please double-check that you can load this file with EEGLAB? If they changed the format we need to adapt our reader, but I want to make sure that this is a valid EEG file.
cbrnr commentedon Feb 12, 2021
@MSA8D8 can you please also post the output of
eeghistso that we can see how you exported the data from EEGLAB?MSA8D8 commentedon Feb 12, 2021
@cbrnr Thank you for your quick reply.
Here is the Matlab output of loading the sample data and checking the history of it.
I am sure that this is a valid EEG file.
Thank you for your help.
cbrnr commentedon Feb 12, 2021
@agramfort @hoechenberger @mmagnuski @larsoner the fix is relatively simple (instead of raising an error here just continue because we already have all the fields that are otherwise contained within
EEG), but before fixing this I'd like to hear what you think.hoechenberger commentedon Feb 12, 2021
Seems this is a change that was introduced with EEGLAB 2021:
https://eeglab.org/others/EEGLAB_revision_history.html#eeglab-version-20210
I wonder if we should explicitly check for the existence of all required fields before proceeding?
cbrnr commentedon Feb 12, 2021
Hmm, where do you see this change? It says "Now saving all EEGLAB datasets in a single file instead of two (fully backward compatible)", but it doesn't mention dropping the
EEGstruct. Also, the example data set still consists of two files.If we're sure this is a (new) valid format I'd not bother and check all fields, for one because I haven't found any official description of the format. Also, if a required field is missing it will fail at some point anyway.
hoechenberger commentedon Feb 12, 2021
Yeah I just assumed that since they changed something, and since @MSA8D8's dataset was created using EEGLAB 2021, this could be related.
cbrnr commentedon Feb 15, 2021
@arnodelorme sorry to bother you again, but could you confirm if EEGLAB now saves .set/.fdt data fields in the root instead of within an
EEGstruct? All of our test files contain theEEGstruct, but @MSA8D8 has data (created with the latest EEGLAB version) where this is not the case.arnodelorme commentedon Feb 15, 2021
This is correct.
arnodelorme commentedon Feb 15, 2021
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 commentedon Feb 15, 2021
Thanks @arnodelorme! I'll prepare a fix for our reader!
jeangillain commentedon Mar 3, 2021
Hello,
I was wondering if you fixed the problem, because when I try to load .set files on mne, I still have the same problem.
Thanks a lot for everything you do,
Jean Gillain
hoechenberger commentedon Mar 3, 2021
Hello @jeangillain,
this has been fixed in our development and 0.22 maintenance branches; but there hasn't been an official release since this fix was added. You can install the latest version of the (unreleased) 0.22 maintenance branch (which will eventually become 0.22.1) by running:
I hope this helps!
MSA8D8 commentedon Mar 30, 2021
Hello. @cbrnr @hoechenberger
I still have this problem even after installing the latest version of mne as @hoechenberger suggested.
The version of mne I can install is 0.22.0
Thank you in advance.
cbrnr commentedon Mar 30, 2021
Can you share a small example file again? I can't find the link you posted previously.
MSA8D8 commentedon Mar 30, 2021
@cbrnr
I deleted the folder in the drive, so I re-uploaded it again.
Here is the new link for the same data I shared with you before.
https://drive.google.com/drive/folders/1rQAyEMYBxiBgNHQSbphIsb_spFmmXwY-?usp=sharing
Thank you for your help.
cbrnr commentedon Mar 30, 2021
It works for me with the current maint branch (linked above). Maybe you still have the 0.22 release? Unfortunately, the version shows 0.22 in both the latest release and the WIP maint branch, so I don't know how to determine if you have installed it correctly.
In any case, I think it's time for an official release of 0.22.1 - @hoechenberger @larsoner what are our plans?
agramfort commentedon Mar 30, 2021
hoechenberger commentedon Mar 30, 2021
Yes +10 from me for 0.22.1 sooner than later!!
MSA8D8 commentedon Mar 30, 2021
@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 !!