Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mne.io.read_raw_edf cannot load data correctly with argument include or exclude #11486

Open
datalw opened this issue Feb 16, 2023 · 4 comments
Open
Labels

Comments

@datalw
Copy link

datalw commented Feb 16, 2023

Description of the problem

I just tried to load EEG, EMG and bio channels separately, unfortunately I did not suceed to load the data correctly.

Steps to reproduce

eeg_raw = mne.io.read_raw_edf('test.edf', exclude=['Resp', 'BVP-0','EMG-0','EMG-1','EMG-2','EMG-3', 'BVP-1'], preload=True)
bio_raw = mne.io.read_raw_edf('test.edf', include=[ 'Resp','BVP-0','BVP-1'], preload=True)
emg_raw = mne.io.read_raw_edf('test.edf', include=[ 'EMG-0','EMG-1','EMG-2','EMG-3'], preload=True) 

Link to data

https://drive.google.com/file/d/1IMP_HK0JvzNOzd7worc3zDTBy7f3E9Zj/view?usp=sharing

Expected results

eeg_raw should have all 21 eeg channels.
bio_raw should have the 3 channels 'Resp','BVP-0','BVP-1'
emg_raw should have the 4 emg channels 'EMG-0','EMG-1','EMG-2','EMG-3'

Actual results

The result is that,

eeg_raw only excluded one bio channel ‘Resp’.
emg_raw had no channel.
bio_raw had only 1 channel ‘Resp’…

Then I tried upgraded mne to 1.3, the result is that,

eeg_raw only excluded one bio channel ‘Resp’.
The following 2 lines did not work and I got TypeError: read_raw_edf() got an unexpected keyword argument 'include' . I looked into the function and found that include was not implemented in the function mne.io.read_raw_edf. According to the documentation it should be there…

Additional information

Platform:         Windows-10-10.0.22621-SP0
Python:           3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)]
Executable:       [c:\Users\luwan\anaconda3\envs\mne1_1\python.exe](file:///C:/Users/luwan/anaconda3/envs/mne1_1/python.exe)
CPU:              AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD: 12 cores
Memory:           15.3 GB

mne:              1.1.1
numpy:            1.23.3 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:            1.9.1
matplotlib:       3.6.0 {backend=Qt5Agg}

sklearn:          1.1.2
numba:            0.56.2
nibabel:          4.0.2
nilearn:          0.9.2
dipy:             1.5.0
cupy:             Not found
pandas:           1.5.0
pyvista:          0.36.1 {OpenGL 4.5.0 Compatibility Profile Context 22.20.02.04.220711 via AMD Radeon(TM) Graphics}
pyvistaqt:        0.9.0
ipyvtklink:       0.2.3
vtk:              9.1.0
qtpy:             2.2.1 {PyQt5=5.12.9}
ipympl:           0.8.7
pyqtgraph:        [c:\Users\luwan\anaconda3\envs\mne1_1\lib\site-packages\pyqtgraph\colors\palette.py:1](file:///C:/Users/luwan/anaconda3/envs/mne1_1/lib/site-packages/pyqtgraph/colors/palette.py:1): RuntimeWarning: PyQtGraph supports Qt version >= 5.15, but 5.12.9 detected.
  from ..Qt import QtGui
0.13.1
pooch:            v1.6.0

mne_bids:         Not found
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   0.4.0
mne_connectivity: 0.4.0
mne_icalabel:     Not found
@datalw datalw added the BUG label Feb 16, 2023
@cbrnr
Copy link
Contributor

cbrnr commented Feb 16, 2023

It should be noted that this file has signals with different sampling frequencies. When fixing include and exclude, picking a particular signal group should not trigger resampling, which I think is currently the case.

@datalw
Copy link
Author

datalw commented Mar 21, 2023

It should be noted that this file has signals with different sampling frequencies. When fixing include and exclude, picking a particular signal group should not trigger resampling, which I think is currently the case.

Hi, I would like to have a quick follow-up: is fixing this bug already in plan?

@agramfort
Copy link
Member

agramfort commented Mar 21, 2023 via email

@datalw
Copy link
Author

datalw commented Mar 30, 2023

Thanks for replying! I tried the lastest master, the result is still incorrect. Codes to reproduce the bug:

eeg_raw = mne.io.read_raw_edf(edf_path,exclude=['Resp', 'BVP-0','EMG-0','EMG-1','EMG-2','EMG-3', 'BVP-1'])
emg_raw = mne.io.read_raw_edf(edf_path,exclude=['Resp', 'BVP-0','BVP-1','EEG O1-(A1~A2)','EEG P8-(A1~A2)',
 'EEG P4-(A1~A2)',
 'EEG Pz-(A1~A2)',
 'EEG P3-(A1~A2)',
 'EEG P7-(A1~A2)',
 'EEG T8-(A1~A2)',
 'EEG C4-(A1~A2)',
 'EEG Cz-(A1~A2)',
 'EEG C3-(A1~A2)',
 'EEG T7-(A1~A2)',
 'EEG F8-(A1~A2)',
 'EEG F4-(A1~A2)',
 'EEG O2-(A1~A2)',
 'EEG Fz-(A1~A2)',
 'EEG A1-(A1~A2)',
 'EEG A2-(A1~A2)',
 'EEG F3-(A1~A2)',
 'EEG F7-(A1~A2)',
 'EEG Fp2-(A1~A2)',
 'EEG Fp1-(A1~A2)'])
bio_raw = mne.io.read_raw_edf(edf_path,exclude=['EMG-0','EMG-1','EMG-2','EMG-3','EEG O1-(A1~A2)','EEG P8-(A1~A2)',
 'EEG P4-(A1~A2)',
 'EEG Pz-(A1~A2)',
 'EEG P3-(A1~A2)',
 'EEG P7-(A1~A2)',
 'EEG T8-(A1~A2)',
 'EEG C4-(A1~A2)',
 'EEG Cz-(A1~A2)',
 'EEG C3-(A1~A2)',
 'EEG T7-(A1~A2)',
 'EEG F8-(A1~A2)',
 'EEG F4-(A1~A2)',
 'EEG O2-(A1~A2)',
 'EEG Fz-(A1~A2)',
 'EEG A1-(A1~A2)',
 'EEG A2-(A1~A2)',
 'EEG F3-(A1~A2)',
 'EEG F7-(A1~A2)',
 'EEG Fp2-(A1~A2)',
 'EEG Fp1-(A1~A2)'])

Result
eeg_raw should only have 21 eeg channels, but it still has all channels except 'Resp'.
emg_raw should only have 4 emg channels, but it has also 2 bio channels 'BVP-0' and 'BVP-1'.
bio_raw should only have 3 bio channels, but it has also 4 emg channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants