mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.72k stars 1.32k forks source link

Error loading 'somato' data #9954

Closed hndgzkn closed 3 years ago

hndgzkn commented 3 years ago

Describe the bug

RuntimeError while loading somato data using load_data.

Steps to reproduce

from alphacsc.datasets.mne_data import load_data

X, info = load_data(dataset='somato', epoch= (-2, 4), sfreq= 150.)

Expected results

No errors

Actual results

Downloading file 'MNE-somato-data.tar.gz' from 'https://osf.io/tp4sg/download?version=7' to '.../mne_data'.
100%|████████████████████████████████████████| 611M/611M [00:00<00:00, 775GB/s]
Untarring contents of '.../mne_data/MNE-somato-data.tar.gz' to '.../mne_data'
Opening raw data file .../mne_data/MNE-somato-data/sub-01/meg/sub-01_task-somato_meg.fif...
    Range : 237600 ... 506999 =    791.189 ...  1688.266 secs
Ready.
Reading 0 ... 269399  =      0.000 ...   897.077 secs...
Setting up band-stop filter

FIR filter parameters
---------------------
Designing a one-pass, zero-phase, non-causal bandstop filter:
- Windowed time-domain design (firwin) method
- Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
- Lower transition bandwidth: 0.50 Hz
- Upper transition bandwidth: 0.50 Hz
- Filter length: 1983 samples (6.603 sec)

Filtering raw data in 1 contiguous segment
Setting up high-pass filter at 2 Hz

FIR filter parameters
---------------------
Designing a one-pass, zero-phase, non-causal highpass filter:
- Windowed time-domain design (firwin) method
- Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
- Lower passband edge: 2.00
- Lower transition bandwidth: 2.00 Hz (-6 dB cutoff frequency: 1.00 Hz)
- Filter length: 497 samples (1.655 sec)

111 events found
Event IDs: [1]
Not setting metadata
Not setting metadata
111 matching events found
Setting baseline interval to [-3.9992341833870637, 0.0] sec
Applying baseline correction (mode: mean)
0 projection items activated
Loading data for 111 events and 1202 original time points ...
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
5 bad epochs dropped
Computing rank from data with rank=None
    Using tolerance 7.5e-09 (2.2e-16 eps * 204 dim * 1.7e+05  max singular value)
    Estimated rank (grad): 204
    GRAD: rank 204 computed from 204 data channels with 0 projectors
.../alphacsc/alphacsc/datasets/mne_data.py:94: RuntimeWarning: Something went wrong in the data-driven estimation of the data rank as it exceeds the theoretical rank from the info (204 > 64). Consider setting rank to "auto" or setting it explicitly as an integer.
  cov = mne.compute_covariance(epochs_cov)
Reducing data rank from 204 -> 204
Estimating covariance using EMPIRICAL
Done.
Number of samples used : 127412
[done]
Not setting metadata
Not setting metadata
111 matching events found
Setting baseline interval to [-2.001282051803185, 0.0] sec
Applying baseline correction (mode: mean)
0 projection items activated
Loading data for 111 events and 1803 original time points ...
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
8 bad epochs dropped
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../.local/miniconda3/envs/alphacsc/lib/python3.9/site-packages/joblib/memory.py", line 594, in __call__
    return self._cached_call(args, kwargs)[0]
  File ".../.local/miniconda3/envs/alphacsc/lib/python3.9/site-packages/joblib/memory.py", line 537, in _cached_call
    out, metadata = self.call(*args, **kwargs)
  File ".../.local/miniconda3/envs/alphacsc/lib/python3.9/site-packages/joblib/memory.py", line 779, in call
    output = self.func(*args, **kwargs)
  File ".../alphacsc/alphacsc/datasets/mne_data.py", line 129, in load_data
    info['events'] = events
  File .../.local/miniconda3/envs/alphacsc/lib/python3.9/site-packages/mne/io/meas_info.py", line 718, in __setitem__
    raise RuntimeError(self._attributes[key])
RuntimeError: events cannot be set directly.

Additional information

Platform: Linux-4.19.0-14-amd64-x86_64-with-glibc2.28 Python: 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] Executable: .../.local/miniconda3/envs/alphacsc/bin/python CPU: : 4 cores Memory: Unavailable (requires "psutil" package) mne: 1.0.dev0 numpy: 1.20.3 {blas=openblas, lapack=openblas} scipy: 1.7.1 matplotlib: 3.4.3 {backend=TkAgg}

sklearn: 1.0.1 numba: 0.54.1 nibabel: 3.2.1 nilearn: Not found dipy: Not found cupy: Not found pandas: 1.3.4 pyvista: Not found pyvistaqt: Not found ipyvtklink: Not found vtk: Not found PyQt5: Not found ipympl: Not found mne_qt_browser: Not found

larsoner commented 3 years ago

This looks like a bug with the alphacsc package, not MNE-Python. Can you open an issue on their repo?