Skip to content

BIDS related: potential change of .fif file split naming #7776

Closed

Description

@sappelhoff

TL;DR

would it be a big problem to change the FIF file "bids-style" split naming from _part-X to something else? (see:

mne-python/mne/io/utils.py

Lines 298 to 310 in 861e825

def _construct_bids_filename(base, ext, part_idx):
"""Construct a BIDS compatible filename for split files."""
# insert index in filename
deconstructed_base = base.split('_')
bids_supported = ['meg', 'eeg', 'ieeg']
for mod in bids_supported:
if mod in deconstructed_base:
idx = deconstructed_base.index(mod)
modality = deconstructed_base.pop(idx)
base = '_'.join(deconstructed_base)
use_fname = '%s_part-%02d_%s%s' % (base, part_idx, modality, ext)
return use_fname
)


When .fif files grow too large, they need to be split into chunks. In a BIDS context, where each file name follows a structure, we need some way to deal with this.

In 2017 or 2018 @jasmainak and @teonbrooks (I think? ... somebody else?) suggested to use *_part-X_meg.fif with the X being a number to define different parts of the same .fif recording.

Some context before the issue: The _part- syntax was (accidentally) not fully introduced into the specification: It is only a non-elaborated example in an appendix, see:

https://bids-specification.readthedocs.io/en/stable/99-appendices/06-meg-file-formats.html#neuromagelektamegin

This leads to the issue that now several other BIDS extension proposals want to use _part- and have started using it --> because they were not aware that it is already being used in MNE (because as I said, _part- is only mentioned in a non-elaborated example in an appendix).

The complete issue is here: bids-standard/bids-specification#429

The fight is essentially whether or not it's OK for MEG/MNE to claim _part- for themselves although it was never properly introduced into the spec.

One pragmatic solution is to

  1. drop the non-elaborated _part- example from the appendix of the BIDS spec
  2. properly introduce a new way to name split .fif files with a new PR to the BIDS spec (e.g., _split-X
  3. adapt MNE-Python to use that new, proper way (e.g., _split-X), and deprecating MNE support for the now invalid _part-X

This part of MNE would have to change:

mne-python/mne/io/utils.py

Lines 298 to 310 in 861e825

def _construct_bids_filename(base, ext, part_idx):
"""Construct a BIDS compatible filename for split files."""
# insert index in filename
deconstructed_base = base.split('_')
bids_supported = ['meg', 'eeg', 'ieeg']
for mod in bids_supported:
if mod in deconstructed_base:
idx = deconstructed_base.index(mod)
modality = deconstructed_base.pop(idx)
base = '_'.join(deconstructed_base)
use_fname = '%s_part-%02d_%s%s' % (base, part_idx, modality, ext)
return use_fname

There are other solutions described in the BIDS issue thread (I summarized them in this comment) but there are several parties with strong opinions, and if the pragmatic solution proposed in THIS issue is not a big deal for MNE folks, then going with this solution would resolve the BIDS issue in a straight forward way.

cc @robertoostenveld @effigies @yarikoptic

Activity

  1. larsoner commented on May 12, 2020

    @larsoner
    Member

    One pragmatic solution is to

    This sounds fine from the MNE end to me. _split is clearer naming than _part for its purpose anyway

  2. agramfort commented on May 12, 2020

    @agramfort
    SponsorMember
  3. hoechenberger commented on May 13, 2020

    @hoechenberger
    Member

    One pragmatic solution is to

    1. drop the non-elaborated _part- example from the appendix of the BIDS spec
    2. properly introduce a new way to name split .fif files with a new PR to the BIDS spec (e.g., _split-X
    3. adapt MNE-Python to use that new, proper way (e.g., _split-X), and deprecating MNE support for the now invalid _part-X

    I like that.

  4. jasmainak commented on May 18, 2020

    @jasmainak
    Member

    I checked a few datasets on openneuro randomly and it seems the split convention is used almost nowhere. So, it's fine to change to _split-X

  5. teonbrooks commented on May 18, 2020

    @teonbrooks
    Member

    i'm also in favor of the switch from changing it from part to split. I gave approval there. I have one dataset with part in it but I will just go back rename them with the landed patch in mne-bids

  6. sappelhoff commented on May 18, 2020

    @sappelhoff
    MemberAuthor

    Thanks for your feedback everybody and for making this so easy. I started to make the relevant PRs to all involved parties. 🙂

  7. self-assigned this
    on May 18, 2020
  8. robertoostenveld commented on May 18, 2020

    @robertoostenveld
    Contributor

    hmm, somehow this seems to be discussed here and also in #429 bids-standard/bids-specification#429.

    In the case of renaming part to something else for MEG, I would prefer segment over split.

  9. hoechenberger commented on May 18, 2020

    @hoechenberger
    Member
  10. sappelhoff commented on May 18, 2020

    @sappelhoff
    MemberAuthor

    hmm, somehow this seems to be discussed here and also in

    yes, sorry @robertoostenveld I did not communicate this very well. It started out as an online discussion with @effigies and @franklin-feingold and we resolved it'd be good to ask the MNE community directly, so I opened this issue.

    The result is basically that it'd be fine to move ahead and replace part in the specification by some other keyword (e.g. split). Most people have voted in favor of split (albeit nobody with a very strong opinion on this)

    I did not communicate this very well.

    I tried to remedy this with a summary post here: bids-standard/bids-specification#429 (comment)

  11. robertoostenveld commented on May 18, 2020

    @robertoostenveld
    Contributor

    | I have no strong feelings there, but it does seem that the term "segment" is often being used interchangeably with "epoch" ...

    Agreed, using "segment" for recordings that are split over multiple files because of technical reasons (i.e. 2GB file size limits) has the risk that people would confuse it with "segment" for task-related reasons, where repeated trials (in the task) are analyzed by cutting the data into segments (or epochs) corresponding to those trials. We don't want an epoched .fif file to be represented in a whole bunch of files, one per trial.

    Hereby I also upvote split in favour of segment.

    Perhaps we should (somewhere) clarify this terminology of split, segment, epoch, and trial.

  12. agramfort commented on May 18, 2020

    @agramfort
    SponsorMember
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions