Repository: mne-tools/mne-python

Issue:
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.
 



Discussion:
Could you share a small example file?

Resolving patch:
diff --git a/mne/datasets/utils.py b/mne/datasets/utils.py
--- a/mne/datasets/utils.py
+++ b/mne/datasets/utils.py
@@ -251,7 +251,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
     path = _get_path(path, key, name)
     # To update the testing or misc dataset, push commits, then make a new
     # release on GitHub. Then update the "releases" variable:
-    releases = dict(testing='0.115', misc='0.8')
+    releases = dict(testing='0.116', misc='0.8')
     # And also update the "md5_hashes['testing']" variable below.
     # To update any other dataset, update the data archive itself (upload
     # an updated version) and update the md5 hash.
@@ -337,7 +337,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
         sample='12b75d1cb7df9dfb4ad73ed82f61094f',
         somato='32fd2f6c8c7eb0784a1de6435273c48b',
         spm='9f43f67150e3b694b523a21eb929ea75',
-        testing='731f4ce20f0cb439c04c719a67ccf4d5',
+        testing='ee36633fa9872aa434cc91f836beaa45',
         multimodal='26ec847ae9ab80f58f204d09e2c08367',
         fnirs_motor='c4935d19ddab35422a69f3326a01fef8',
         opm='370ad1dcfd5c47e029e692c85358a374',
diff --git a/mne/io/eeglab/eeglab.py b/mne/io/eeglab/eeglab.py
--- a/mne/io/eeglab/eeglab.py
+++ b/mne/io/eeglab/eeglab.py
@@ -61,9 +61,7 @@ def _check_load_mat(fname, uint16_codec):
         raise NotImplementedError(
             'Loading an ALLEEG array is not supported. Please contact'
             'mne-python developers for more information.')
-    if 'EEG' not in eeg:
-        raise ValueError('Could not find EEG array in the .set file.')
-    else:
+    if 'EEG' in eeg:  # fields are contained in EEG structure
         eeg = eeg['EEG']
     eeg = eeg.get('EEG', eeg)  # handle nested EEG structure
     eeg = Bunch(**eeg)


Test patch:
diff --git a/mne/io/eeglab/tests/test_eeglab.py b/mne/io/eeglab/tests/test_eeglab.py
--- a/mne/io/eeglab/tests/test_eeglab.py
+++ b/mne/io/eeglab/tests/test_eeglab.py
@@ -34,7 +34,7 @@
 raw_mat_fnames = [raw_fname_mat, raw_fname_onefile_mat]
 epochs_mat_fnames = [epochs_fname_mat, epochs_fname_onefile_mat]
 raw_fname_chanloc = op.join(base_dir, 'test_raw_chanloc.set')
-
+raw_fname_2021 = op.join(base_dir, 'test_raw_2021.set')
 raw_fname_h5 = op.join(base_dir, 'test_raw_h5.set')
 raw_fname_onefile_h5 = op.join(base_dir, 'test_raw_onefile_h5.set')
 epochs_fname_h5 = op.join(base_dir, 'test_epochs_h5.set')
@@ -422,3 +422,11 @@ def test_position_information(one_chanpos_fname):
 
     _assert_array_allclose_nan(np.array([ch['loc'] for ch in raw.info['chs']]),
                                EXPECTED_LOCATIONS_FROM_MONTAGE)
+
+
+@testing.requires_testing_data
+def test_io_set_raw_2021():
+    """Test reading new default file format (no EEG struct)."""
+    assert "EEG" not in io.loadmat(raw_fname_2021)
+    _test_raw_reader(reader=read_raw_eeglab, input_fname=raw_fname_2021,
+                     test_preloading=False, preload=True)