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

error when opening an edf file: the file is not EDF(+) or BDF(+) compliant (it contains format errors) #82

Open
data-RanDan opened this issue Jun 29, 2020 · 5 comments

Comments

@data-RanDan
Copy link

data-RanDan commented Jun 29, 2020

Hi
This is my first time working with EDFs using Python.
This is the error i get when trying to open them.
the file is not EDF(+) or BDF(+) compliant (it contains format errors)

I couldn't find much information on-line, I saw that you answered a similar question in the past.
any idea how can i solve the problem?

@skjerns
Copy link
Collaborator

skjerns commented Jun 29, 2020

Try opening and saving it with EDFBrowsers header editor (EDFBrowser->Tools->Header Editor). This often fixes the problem. Also EDFBrowser might give you some more details on where the error is.

@xaishu
Copy link

xaishu commented Dec 13, 2020

Can you please elaborate?

What is EDFBrowser? I have a couple of hundred files to open. Do I need to do this for all? Is there any method to do it for all in bulk?

@skjerns
Copy link
Collaborator

skjerns commented Dec 13, 2020

EDFBrowser uses the same library as we do in the background: https://www.teuniz.net/edfbrowser/

Download the program, start the header editor from the menu and try to repair the file (open it in header editor and just click save again). If that works it is repairable

Currently there is no way to do this in batch mode. But if the error is always the same you might be lucky by creating a script that repairs the header automatically. Often it's just a small format, e.g. the time is with a : instead of .. This can be easily solved by just opening it in binary mode and replacing the chars. I'd need a sample file to check that.

@NarayanSchuetz
Copy link

This actually is one of the more annoying shortcomings of EDF in practice. Happens so very often. Would there be any way to fix it (I assume it is primarily a political problem, UTF-8 is not really that esoteric anymore, is it)?

@skjerns
Copy link
Collaborator

skjerns commented Apr 18, 2023

Behind this error there are actually a multitude of different problems. I have not encountered many UTF8 problems recently, most of the errors I saw were inconsistent use of specifications, i.e. wrong date format, time format, wrong use of digital min/max, etc.
I trust edflib (the C library) to have the most accurate implementation of the EDF standard, which it also enforces very strictly.

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

4 participants