Possible bug in BIDS split namig

Hi,

Iā€™ve observed a strange behaviour (not sure if a bug) when saving Raw files, and a split is required. This only happens with the BIDS split naming version and if the BIDS naming convention is not followed, so thatā€™s why it may be the expected behaviour.

When running this super-simple code snippet:

raw.save(rf'D:\path\path\path\{new_name}.fif', split_size='2GB', split_naming='bids', verbose='Error'),

with new_name having the following format:

0001-11_F_45_HC (that is, ID-ID_Sex_Age_Group)

The naming in the splits are:

  • 0001-11_F_45_split-01_HC
  • 0001-11_F_45_split-02_HC
  • 0001-11_F_45_split-03_HC

and I expected them to be:

  • 0001-11_F_45_HC_split-01
  • 0001-11_F_45_HC_split-02
  • 0001-11_F_45_HC_split-03

Is this the expected behaviour or is it a bug?
The easier workaround is to use the neuromag naming convention but the BIDS one fits better some additional funtions that I have developed

  • MNE version: 1.8.0
  • operating system: Windows 10

Hi and welcome to the forum!

The file name doesnā€™t conform to BIDS. By the spec, the last bit represents the modality; thatā€™s why the split modality goes before that.

I have to say Iā€™m not sure why MNE supports something called ā€œBIDS split namingā€ if it doesnā€™t check whether the filename is even BIDS-compatible in the first place ā€¦ this probably should not be part of the public API at all.

What is your opinion on this, @sappelhoff?

Best wishes,
Richard

This behavior seems unexpected to me, too.

I think we added the BIDS split naming back then to make something possible in mne-bids. I donā€™t remember why we made it part of the public API, instead of another route.

1 Like

Perhaps weā€™re relying on this in MNE-BIDS-Pipeline too, I would have to checkā€¦

@larsoner Any thoughts on this one?

Now that itā€™s in the public API itā€™s probably worth keeping there. Especially since people could potentially have legitimate use cases where they want to write their own BIDS-filename-formatted data, or even donā€™t care about the BIDS-ness but prefer how the BIDS option operates. To me we should just update the docs to say what the option will actually do, and note that itā€™s there primarily for compat with MNE-BIDS. I donā€™t think we should check BIDS path validity in MNE-Python.

1 Like

agreed!

That would be fine by me, too.

1 Like

The problem is likely that the check here was not triggered: mne-python/mne/_fiff/utils.py at 2983d2a19148e8760b67de399e85c91a3e040de7 Ā· mne-tools/mne-python Ā· GitHub