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

CHB-MIT (Physionet) error - regular EDF not supported anymore #14

Closed
zaccharieramzi opened this issue May 5, 2017 · 8 comments
Closed

Comments

@zaccharieramzi
Copy link

zaccharieramzi commented May 5, 2017

Hi,

So I was having an issue reading some edf files from the CHB-MIT database. This issue was reported here. I, therefore, followed your recent advice to update the pyedflib version.
However, I found myself with another error:

OSError: the file is not EDF(+) or BDF(+) compliant (it contains format errors)

So I looked a bit into it and here is what's happening:
in some CHB-MIT edf files (chb12_06 for example), the header contains some blacked out channels (i.e. their label is "-"). These channels have their digital maximum equal to their digital minimum. This is problematic for pyedflib who considers that there is a format error (that's what I understand from my poor reading of C code).
This was also confirmed when I tried to open them in EDFBrowser:

Error, digital maximum of signal 5 is less than or equal to digital minimum
 File is not a valid EDF or BDF file.

I wanted to know why you had this check. What I mean is, I don't think it's really that bad if the maximum is equal to the minimum (maybe just issue a warning when they are equal) and I don't see it in the EDF specs.

I also wanted to know if others had had this issue and how they coped with it.

Don't hesitate to ask for additional details and thanks in advance for your help.

EDIT: The channels which caused the issue were not blacked out, an explanation is actually given here :

In some cases, up to 5 “dummy” signals (named "-") were interspersed among the EEG signals to obtain an easy-to-read display format; these dummy signals can be ignored.

@jkuepker
Copy link

jkuepker commented May 8, 2017

I am getting a similar error. "IOError: the file is not EDF(+) or BDF(+) compliant (it contains format errors)"

I thought it related to the number of data records in the EDF spec.
"8 ascii : number of data records (-1 if unknown)"
If I have a number of data records > 0, there are no issues, but if it is -1 for unknown then I get the error.

This is only for signals and not for annotations. I get the error for any file with annotations.

@zaccharieramzi
Copy link
Author

Well, maybe for that particular matter, it is because pyedflib chose to obey the EDF+ spec.

However, this led me to look into this question of digital minimum, and it appears that in EDF +, the digital minimum must indeed be smaller than the digital maximum. All these checks in the C code must, therefore, mean that regular EDF is not supported anymore.

I will change the title of the question to reflect this evolution of our understanding of the issue.

@zaccharieramzi zaccharieramzi changed the title CHB-MIT (Physionet) error CHB-MIT (Physionet) error - regular EDF not supported anymore May 9, 2017
@holgern
Copy link
Owner

holgern commented May 9, 2017

I will change this, thank you for reporting. pyedflib should also be able to read EDF-files.

@zaccharieramzi
Copy link
Author

Do you know how long it will be for you to fix it?
Because if you tell me 2 weeks I will modify my data (harmless since I can download it again) but if you think you can do it quickly, I will wait for your modifications.

Thanks for your answer.

holgern added a commit that referenced this issue May 10, 2017
@holgern
Copy link
Owner

holgern commented May 10, 2017

Do you need a new version pushed to pypi?
I changed the source code, and chb12_06.edf can now be read by pyedflib.
Proper BDF and EDF can now be written with pyedflib

Please let me know, if there are more problems with EDF/BDF file format.

@zaccharieramzi
Copy link
Author

Yes if it's not too much to ask, my workflow for deployment generally has pip install -r requirements.txt, so it would be nice if the new version was pushed to pypi.

@holgern
Copy link
Owner

holgern commented May 10, 2017

Ok, i uploaded it to pypi

@zaccharieramzi
Copy link
Author

It appears to work for me too! Thank you very much for your help :)

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

No branches or pull requests

3 participants