mne-tools / mne-python

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

edf reader fails #1767

Closed aestrivex closed 9 years ago

aestrivex commented 9 years ago

I have some iEEG data in .edf format. mne_edf2fiff works just fine. read_edf_file() is able to read the metadata, but when it tries to read the iEEG data it crashes.

In [3]: ra = mne.io.edf.read_raw_edf('raw.edf', preload=True)
Extracting edf Parameters from raw.edf...
Setting channel info structure...
Creating Raw.info structure...
Reading raw data from /local_mount/space/truffles/2/users/rlaplant/ecog/raw.edf...
Reading 0 ... 3781782  =      0.000 ...  7567.997 secs...
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/local_mount/space/truffles/1/users/rlaplant/.canopyrc/User/lib/python2.7/site-packages/mne-0.9.dev-py2.7.egg/mne/io/edf/edf.py in _read_segment(self, start, stop, sel, verbose, projector)
    276                     print int(sfreq), n_chan, blocks
    277                     data = data.reshape((int(sfreq), n_chan, blocks),
--> 278                                         order='F')
    279                     for i in range(blocks):
    280                         start_pt = int(sfreq * i)

It is trying to reshape a 232352736x1 matrix into a 499x129x7568 matrix.

It don't even know where to begin debugging this -- it seems like it is not figuring out correct information in the header? Maybe there is some encoding issue?

@dgwakeman suggested to tag @teonlamont

I don't know if I can provide the raw data as it is clinical data that may not be deanonymized, but does anyone have any idea what might be going on?

teonbrooks commented 9 years ago

First, just to check, have you updated to the most recent master? There were some bugs that were resolved over the past couple of days. Do you have a file you could share to help troubleshoot?

The reshaping is done because edf data are written in segments in time (records or blocks) and it will ultimately need to be in a channel by time.

Envoyé de mon iPhone

Le 28 janv. 2015 à 19:06, Roan LaPlante notifications@github.com a écrit :

I have some iEEG data in .edf format. mne_edf2fiff works just fine. read_edf_file() is able to read the metadata, but when it tries to read the iEEG data it crashes.

In [3]: ra = mne.io.edf.read_raw_edf('raw.edf', preload=True) Extracting edf Parameters from raw.edf... Setting channel info structure... Creating Raw.info structure... Reading raw data from /local_mount/space/truffles/2/users/rlaplant/ecog/raw.edf...

Reading 0 ... 3781782 = 0.000 ... 7567.997 secs...

ValueError Traceback (most recent call last)

/local_mount/space/truffles/1/users/rlaplant/.canopyrc/User/lib/python2.7/site-packages/mne-0.9.dev-py2.7.egg/mne/io/edf/edf.py in _read_segment(self, start, stop, sel, verbose, projector) 276 print int(sfreq), n_chan, blocks 277 data = data.reshape((int(sfreq), n_chan, blocks), --> 278 order='F') 279 for i in range(blocks): 280 start_pt = int(sfreq * i) It is trying to reshape a 232352736x1 matrix into a 499x129x7568 matrix.

It don't even know where to begin debugging this -- it seems like it is not figuring out correct information in the header? Maybe there is some encoding issue?

@dgwakeman suggested to tag @teonlamont

— Reply to this email directly or view it on GitHub.

aestrivex commented 9 years ago

Yes this is on a semi-recent dev version.

I will try it again soon and update.

teonbrooks commented 9 years ago

@aestrivex I found a solution to the problem with pr #1771.