holgern / pyedflib

pyedflib is a python library to read/write EDF+/BDF+ files based on EDFlib.
http://pyedflib.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
214 stars 121 forks source link

`readsignal` fails to retrieve data #228

Closed rr1017 closed 1 year ago

rr1017 commented 1 year ago

The function fails to retrieve data with the following error:

read -1, less than 921600 requested!!!

The edf file for which this happens is readily available from physionet.org (chb01_01.edf)

DimitriPapadopoulos commented 1 year ago

Are you certain the file is an error-free EDF file?

Please provide a link to a compliant EDF file.

DimitriPapadopoulos commented 1 year ago

Found a chb01_01.edf file in the CHB-MIT Scalp EEG Database.

DimitriPapadopoulos commented 1 year ago

This works for me:

import pyedflib

signals, signal_headers, header = pyedflib.highlevel.read_edf("chb01_01.edf")

How to reproduce the error?

rr1017 commented 1 year ago

That was the file I was using, I see pyedflib.highlevel.read_edf works but I just wonder why readSignal on the EdfReader class won’t work.

So, if I create an instance of EdfReader with that file and I try to use the readSignal(chn=1) method it fails.

I have switched to using the “mne” library anyway which has similar functionalities but I would recommend attempting to solve this issue.

Best regards,

Ruben Ruiz-Mateos Serrano MRes+PhD Connected Electronic and Photonic Systems Department of Engineering University of Cambridge / UCL

From: Dimitri Papadopoulos @.> Sent: 27 June 2023 11:15 To: @.> Cc: Ruiz-Mateos Serrano, @.>; @.> Subject: Re: [holgern/pyedflib] readsignal fails to retrieve data (Issue #228)

This email from @.*** originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders listhttps://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address.

This works for me:

import pyedflib

signals, signal_headers, header = pyedflib.highlevel.read_edf("chb01_01.edf")

How to reproduce the error?

— Reply to this email directly, view it on GitHubhttps://github.com/holgern/pyedflib/issues/228#issuecomment-1609209529, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSEWTKEX6I67TNUM5B2MDLXNKXCHANCNFSM6AAAAAAZULQ4VU. You are receiving this because you authored the thread.Message ID: @.***>

skjerns commented 1 year ago

I cannot reproduce the issue, I assume the problem is with the code you are using and not a problem with pyedflib.

import pyedflib
with pyedflib.EdfReader('chb01_01.edf') as f:
    n = f.signals_in_file
    signal_labels = f.getSignalLabels()
    print(n, signal_labels)
    f.readSignal(1)