mne-bids: Unable to convert EDF -> BV anymore?

Describe the bug

I was doing another conversion again for EDF source iEEG files, and I noticed that I can’t convert to BV anymore, even if I pass back anonymization daysback.

In the BIDs spec, it is said that BV BV and EDF are the RECOMMENDED format for iEEG data.

Is this intended behavior? I built a lot of func that required me to assume that data was stored in BV. Wiil it be possible to add a convert kwarg to write_raw_bids that converts the said dataset into the RECOMMENDED format?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

I would actually propose to do:

def write_raw_bids(raw, bids_path, events_data=None,
                   event_id=None, anonymize=None, format='auto',
                   overwrite=False, verbose=True):
"""
...
    format : 'auto' | 'BrainVision' | 'EDF' | 'FIF'
        If `'auto'` (default), there is no explicit change in how the file is
        converted to BIDS. The native format is used. If a str, then will accept RECOMMENDED
        BIDS file formats. For example, EEG and iEEG RECOMMENDED formats
        are ``BrainVision`` and ``EDF``. If ``'BrainVision'``
        is passed in, then file will be forced to be converted to the 
        ``BrainVision`` file format. For MEG, this could be ``FIF``.
"""
...
# check that convert_to is acceptable given datatype
...
# rewrite convert logic to force convert data to BrainVision

Like this soln. seems most explicit.

Only thing is, I might exclude EDF since we don’t have a robust edf writer to my knowledge.

I would actually propose to do:

def write_raw_bids(raw, bids_path, events_data=None,
                   event_id=None, anonymize=None, format='auto',
                   overwrite=False, verbose=True):
"""
...
    format : 'auto' | 'BrainVision' | 'EDF' | 'FIF'
        If `'auto'` (default), there is no explicit change in how the file is
        converted to BIDS. The native format is used. If a str, then will accept RECOMMENDED
        BIDS file formats. For example, EEG and iEEG RECOMMENDED formats
        are ``BrainVision`` and ``EDF``. If ``'BrainVision'``
        is passed in, then file will be forced to be converted to the 
        ``BrainVision`` file format. For MEG, this could be ``FIF``.
"""
...
# check that convert_to is acceptable given datatype
...
# rewrite convert logic to force convert data to BrainVision

no strong opinions. I let @sappelhoff and @hoechenberger decide

Okay PR coming in… Dam I wish I caught this before 0.6 :p

wait a second with the PR until we have heard more people’s opinions 😃

If we wanted to “convert” files from EDF -> BV like this, would it be best to add a kwarg to write_raw_bids

I think a convert_to={'BrainVision} parameter would be best … and the value could also be fif for MEG data 🤷

I suppose EDF and BV are both “RECOMMENDED” formats for iEEG. However, it still brings up an issue because I was pretty used to working w/ BV files, and ideally would like to stick w/ that.

Personally I think that BrainVision is superior to EDF because we can have data as float32, because the header and marker files are human readable, because dates can be properly anonymized, etc. etc. --> so I totally get why you’d want to ditch EDF