harbor run -t swe-rebench/mne-tools__mne-bids-1388harbor download swe-rebench/mne-tools__mne-bids-1388Is zero-padding mandatory in indices?
Hi, I have a dataset in which the runs are NOT zero-padded. Something like this:
mkdir -p test_bids/sub-1/eeg/
touch test_bids/sub-1/eeg/sub-1_run-1_raw.fif
touch test_bids/sub-1/eeg/sub-1_run-10_raw.fif
This BIDS validator did not complain about the files naming. And it seems from the BIDS specification that the zero padding is optional, but it is unclear.
However, the missing zero-padding creates an issue in mne-bids:
import mne_bids
mne_bids.BIDSPath(root="test_bids", subject='1', run='1', extension='.fif', datatype='eeg').fpath
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/miniforge3/envs/mne-bids-pipeline/lib/python3.12/site-packages/mne_bids/path.py", line 916, in fpath
raise RuntimeError(msg)
RuntimeError: Found more than one matching data file for the requested recording. While searching:
BIDSPath(
root: test_bids
datatype: eeg
basename: sub-1_run-1)
Found 2 paths:
test_bids/sub-1/eeg/sub-1_run-10_raw.fif
test_bids/sub-1/eeg/sub-1_run-1_raw.fif
Cannot proceed due to the ambiguity. This is likely a problem with your BIDS dataset. Please run the BIDS validator on your data.
Is it a feature or a bug?
see above
The following path: "test_bids/sub-1/eeg/sub-1_run-1_raw.fif"
see above
>>> mne.sys_info()
Platform macOS-15.3.2-arm64-arm-64bit
Python 3.12.9 | packaged by conda-forge | (main, Mar 4 2025, 22:44:42) [Clang 18.1.8 ]
Executable /Users/Pierre.Guetschel/miniforge3/envs/mne-bids-pipeline/bin/python
CPU Apple M1 Pro (10 cores)
Memory 16.0 GiB
Core
├☑ mne 1.10.0.dev72+g1fb9dd6d5 (devel, latest release is 1.9.0)
├☑ numpy 2.2.3 (unknown linalg bindings)
├☑ scipy 1.15.2
└☑ matplotlib 3.10.1 (backend=macosx)
Numerical (optional)
├☑ sklearn 1.6.1
├☑ nibabel 5.3.2
├☑ pandas 2.2.3
├☑ h5io 0.2.4
├☑ h5py 3.13.0
└☐ unavailable numba, nilearn, dipy, openmeeg, cupy
Visualization (optional)
├☑ pyvista 0.44.2 (OpenGL 4.1 Metal - 89.3 via Apple M1 Pro)
├☑ pyvistaqt 0.11.2
├☑ vtk 9.3.1
└☐ unavailable qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional)
├☑ mne-bids 0.17.0.dev32+g3a25345
├☑ mne-bids-pipeline 1.10.0.dev69+g6005b52
├☑ eeglabio 0.0.3
├☑ edfio 0.4.6
├☑ pybv 0.7.6
└☐ unavailable mne-nirs, mne-features, mne-connectivity, mne-icalabel, neo, mffpy