Skip to content

Problems with reading mff files #11188

Open

Description

@elba1212

Description of the problem

Hi,
I am trying to open data files that recorded with EGI system, with mne.io.read_raw_egi.
for some recordings it works perfectly fine and for others I get an error message.

MNE version: 1.1.1
tried also 1.2.dev0 version and the error persisted.
operating system: Windows 10

here is an example code and files. for sub3003 I can read the file and for sub3004 I get an error message.

Steps to reproduce

import mne

sub3003 = r"C:\Users\paltiele.WISMAIN\Dropbox (Weizmann Institute)\PhD\Learning_faces\EEG experiment\data\samples\EL3003_SLEEP_20220221_015208.mff"
raw3003 = mne.io.read_raw_egi(sub3003)

sub3004 = r"C:\Users\paltiele.WISMAIN\Dropbox (Weizmann Institute)\PhD\Learning_faces\EEG experiment\data\samples\EL3004_SLEEP_20220309_125216.mff"
raw3004 = mne.io.read_raw_egi(sub3004)

Link to data

subject 3003:
https://www.dropbox.com/s/ptgf959fdhs2ydn/EL3003_SLEEP_20220221_015208.mff.zip?dl=0

subject 3004:
https://www.dropbox.com/s/8ydahvu84dhv6f6/EL3004_SLEEP_20220309_125216.mff.zip?dl=0

Expected results

read the mff file smoothly

Actual results

Error message:

'''
sub3004 = r"C:\Users\paltiele.WISMAIN\Dropbox (Weizmann Institute)\PhD\Learning_faces\EEG experiment\data\EEG\EL3004\EL3004_SLEEP_20220309_125216.mff"
raw = mne.io.read_raw_egi(sub3004)
Reading EGI MFF Header from C:\Users\paltiele.WISMAIN\Dropbox (Weizmann Institute)\PhD\Learning_faces\EEG experiment\data\EEG\EL3004\EL3004_SLEEP_20220309_125216.mff...
Traceback (most recent call last):

File "C:\Users\paltiele.WISMAIN\AppData\Local\Temp\ipykernel_12524\2134038754.py", line 2, in
raw = mne.io.read_raw_egi(sub3004)

File "", line 12, in read_raw_egi

File "C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\lib\site-packages\mne\io\egi\egi.py", line 157, in read_raw_egi
exclude, preload, channel_naming, verbose)

File "", line 12, in _read_raw_egi_mff

File "C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\lib\site-packages\mne\io\egi\egimff.py", line 390, in _read_raw_egi_mff
preload, channel_naming, verbose)

File "", line 12, in init

File "C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\lib\site-packages\mne\io\egi\egimff.py", line 404, in init
egi_info = _read_header(input_fname)

File "C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\lib\site-packages\mne\io\egi\egimff.py", line 212, in _read_header
mff_hdr = _read_mff_header(input_fname)

File "C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\lib\site-packages\mne\io\egi\egimff.py", line 93, in _read_mff_header
list(epochs['last_samps'])))

RuntimeError: EGI epoch first/last samps could not be parsed:
[0]
[26586364]
'''

Additional information

Platform: Windows-10-10.0.19041-SP0
Python: 3.7.13 (default, Mar 28 2022, 08:03:21) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Users\paltiele.WISMAIN\Anaconda3\envs\for_visbrain\python.exe
CPU: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel: 8 cores
Memory: 31.7 GB

mne: 1.2.dev0
numpy: 1.21.6 {MKL 2022.1-Product with 4 threads}
scipy: 1.7.3
matplotlib: 3.5.3 {backend=module://matplotlib_inline.backend_inline}

sklearn: 1.0.2
numba: 0.56.2
nibabel: Not found
nilearn: Not found
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: 1.3.5
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
qtpy: Not found
ipympl: Not found
pyqtgraph: Not found
pooch: v1.6.0

mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found

Activity

  1. welcome commented on Sep 19, 2022

    @welcome

    Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

  2. scott-huberty commented on Sep 19, 2022

    @scott-huberty
    Contributor

    Hi @elba1212 - can you zip the .mff files before you upload them to dropbox? Do you have any smaller files that you can share and which also cause the issue? The files you shared appear to be so large that dropbox won't even let me download them.

    EDIT: It looks like the signal.bin file (this is the primary data file) inside the .mff directory, is 25g!

  3. scott-huberty commented on Sep 19, 2022

    @scott-huberty
    Contributor

    @elba1212 I also just wanted to highlight that the patient video stream is included in your file. If you are not allowed to disclose patient information you can remove the .mov files inside the .mff directory (which may also slightly decrease your overall file size).

    Thanks!

  4. larsoner commented on Sep 19, 2022

    @larsoner
    Member

    One of those .bin files is 26.5GB for example -- I'm guessing this as a 32-bit int problem. I should be able to check this week hopefully

  5. elba1212 commented on Sep 22, 2022

    @elba1212
    Author

    Hi @scott-huberty and @larsoner,
    Thank you for your reply!

    I tried replicating the error with some of my smaller files, but it only replicates with my large files.
    (when I try to read the smaller files for some of them, I get a different error: IndexError when it reads the event channel).

    I removed the videos, zipped the mff files, and updated the links in the original message as you suggested.
    Thanks,
    Ella

  6. drammock commented on Sep 22, 2022

    @drammock
    Member

    @scott-huberty @larsoner there is an off-by-one error in subject 3004:

    ipdb> p n_samps_epochs
    26586364
    ipdb> p n_samps_block
    26586365
    

    I can't access subject 3003, Dropbox says "zip files are supported but something went wrong"

  7. larsoner commented on Sep 22, 2022

    @larsoner
    Member

    We have an off-by-one-bug check elsewhere:

    if pns_samples == eeg_samples - 1:
    warn('This file has the EGI PSG sample bug')
    annot['onset'].append(last_samps[-1] / egi_info['sfreq'])
    annot['duration'].append(1 / egi_info['sfreq'])
    annot['description'].append('BAD_EGI_PSG')

    I wonder if we need to introduce one here, too.

  8. added this to the 1.3 milestone on Sep 28, 2022
  9. elba1212 commented on Sep 28, 2022

    @elba1212
    Author

    I corrected the "3003" link; it works now.
    Anyway, this is the file that I can successfully read.

    If you need more examples of problematic files, tell me.

  10. removed this from the 1.3 milestone on Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions