yjmantilla / sovabids

A python package for the automatic conversion of EEG datasets to the BIDS standard, with a focus on making the most out of metadata.
https://sovabids.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

EDF writer #5

Open yjmantilla opened 3 years ago

yjmantilla commented 3 years ago

So I have been delving into this edf conversion topic. What I have found is the following:

Robert Oostenveld and Phillip Alday did a pure python edf writer: pyedf . It is in python2 but has a branch on python3 and also the following repo https://github.com/bsandeepan95/pyedf . It also seems slower (expected) than pyedflib (https://github.com/bids-standard/pyedf/issues/6)

Apparently pyedf has not been integrated to mne because it adds maintainance overhead while making relatively little difference in usability

Why is this important?

Our design has mne-bids as the bids writer, that is, we just infer the necessary arguments and the "CONVERT THEM" module does the job with mne-bids inside. So as it is now, we are constrained by what mne-bids accepts as outputs:

format : 'auto' | 'BrainVision' | 'FIF' Controls the file format of the data after BIDS conversion. If 'auto', MNE-BIDS will attempt to convert the input data to BIDS without a change of the original file format. A conversion to a different file format (BrainVision, or FIF) will only take place when the original file format lacks some necessary features. When a str is passed, a conversion can be forced to the BrainVision format for EEG, or the FIF format for MEG data.

So we have some options:

@stebo85 @civier @TomEmotion What do you think?

civier commented 3 years ago

Thanks @yjmantilla for investigating it. Very surprising given that edf is one of two recommended formats for BIDS.

I originally suggested edf over BrainVision because it is an open standard (see @TomEmotion comment in our meeting), but for the GSoC project, maybe we should only focus on BrainVision as the output format. It is still one of the recommended BIDS formats, so I don't see an issue with that. Adding edf support can be a longer-term goal, and ideally done by incorporating edf support into MNEbids.

Any thoughts mentors? Dave? @stebo85 @TomEmotion @aswinnarayanan @DavidjWhite33

stebo85 commented 3 years ago

Starting with BrainVision makes sense and later we could investigate how to best get things converted into EDF.

I think these problems should be solved upstream (in MNE?), but we should help if we have the time towards the end of the project: pyedflib - I had a similar problem with cython and found a good workaround by compiling the cython code before execution on the target system -> by this we avoided distributing precompiled binaries that wouldn't be optimized for the hardware at hand (https://github.com/NeuroDesk/caid/blob/master/recipes/qsmxtbase/setup.py). The other option is to compile it with "-march=x86-64" and this will run on almost all CPUs (but slower than with specific instruction sets) -> https://github.com/NeuroDesk/caid/blob/master/recipes/tgvqsm/setup.py pyedf - looks good, too - I wouldn't be too worried about the speed to start with - worth a try?

Cheers Steffen

yjmantilla commented 3 years ago

So for now, I guess the conclusion is to use brainvision. Later if we have got time we can try to address the issue in MNE-BIDS through pyedf (why MNE-BIDS? I don't think the matter is relevant enough for MNE as a whole).