Skip to content

Conversation

@alexandrebarachant
Copy link
Contributor

This is code for reading GDF files (http://arxiv.org/abs/cs/0608052)

This file format is commonly use in the BCI community, and is supported by the biosig toolbox.
There is a biosig python package, but it rely on the c++ implementation and its compilation is a bit tricky on some OS. So i made a pure python implementation, inspired by an old python-biosig code and the EDF raw reader of MNE (There is a lot of overlap between EDF and GDF).

The code support only GDF file version < 1.9 . I only have GDF files generated by openvibe (GDF version 1.25), and i could not find more recent files to extend the support.

I provided tests and data samples (the smallest file i can find is 4.5Mb). It works fine on my data.

@teonbrooks
Copy link
Member

hey @alexandrebarachant. this looks good so far, thanks for the contribution! we will probably need to work out the logistics of merging this with the edf/bdf module because it will help reduce the code overlap by a lot. once this is stable we can do the incorporation. we will also need to wait until #2127 is merged because it will refactor a lot of the way we do reading across modules.

@alexandrebarachant
Copy link
Contributor Author

I will be able to test the code more intensively in the next days, and if i found other sources of gdf file, i'm willing to extend the support.
My first attempt was to merge this with the edf code, but there were some issues with file encoding and i gave up. I will make another attempt once the code is stable. In the meantime, the code is here if someone want to test it.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 90.3% when pulling 8389d3f on alexandrebarachant:gdf into 8aeb977 on mne-tools:master.

@wmvanvliet
Copy link
Contributor

some Graz data from the BCI competition is in GDF format:
http://www.bbci.de/competition/

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 90.3% when pulling e633d47 on alexandrebarachant:gdf into 8aeb977 on mne-tools:master.

@teonbrooks
Copy link
Member

@alexandrebarachant #2127 has been merged. If you want, I can help take a look at unifying your GDF with the EDF/BDF module when the code is stable.

@agramfort
Copy link
Member

@alexandrebarachant can you bring this PR back to life after a rebase on master? might be painful...

@alexandrebarachant
Copy link
Contributor Author

yep, in a couple of days, i will have time to finish this (+ the XDawn PR).
i've been extra busy with running an experiment, but now it's almost over.

i plan to merge this with the new EDF code.

I used the gdf reader for some time now and i did'n spot any major bug.

@agramfort
Copy link
Member

agramfort commented Jul 13, 2015 via email

@alexandrebarachant
Copy link
Contributor Author

@agramfort I'm closing this one and opening a new one on a fresh new branch.
I did the merge with edf, seems to works.

@nbara
Copy link
Contributor

nbara commented Apr 11, 2017

Hello, has gdf support ever been implemented ?

I can't find any trace of it in the latest code...

@agramfort
Copy link
Member

no it still needs to be completed

@nbara
Copy link
Contributor

nbara commented Apr 12, 2017

Ok no problem!

@alexandrebarachant do you think your code is anywhere near useable as is? or should I rather look elsewhere? I don't mind looking under the hood to see if I'm able to patch things up...

@alexandrebarachant
Copy link
Contributor Author

I think you can use my branch https://github.com/alexandrebarachant/mne-python/tree/gdf
it is supposed to work perfectly fine (at least for the GDF version that openvibe generates). I used the code not so long ago (like 6 month).

The current reason i'm not pushing this further is that the gdf code has a lot of overlap with the edf code, and that it must be factorized before being integrated to mne. I just don't have the bandwidth to work on this and it is low priority for me (i don't use GDF anymore). But i will be more than happy if you can take the lead on that.

@nbara
Copy link
Contributor

nbara commented Apr 12, 2017

Cool! I can give it a try. I'm still very much a python noob so no guarantees, but if I ever get anywhere with this, what's the proper way to take the code in your gdf branch as the basis for a PR here?

Or should I make a PR directly to alexandrebarachant/gdf ?

@alexandrebarachant
Copy link
Contributor Author

If the code is still working, or working with minimal modification, the best would be to create your own PR with your own branch.

GDF as a lot of overlap with EDF/BDF. most of the meta data are stored the same way, the main difference is that GDF is more flexible on the datatype used to store binary EEG data. you might want to see how you can actually merge my code from gdf.py into edf.py
This is a great way to dig into "low level" python.

@nbara
Copy link
Contributor

nbara commented Apr 14, 2017

OK, thanks for the info. I checked out your code and it doesn't run on my gdf files (at least not natively). I'm going to look into this first and see how much of your code I need to change before possibly merging it into edf.py

@nbara nbara mentioned this pull request Apr 18, 2017
@nbara nbara mentioned this pull request Nov 28, 2018
4 tasks
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

Successfully merging this pull request may close these issues.

6 participants