file does not start with a file id tag error in mne-bids-pipeline

Dear All,

Iโ€™m trying to run the MNE Sample data demo with MNE-BIDS-Pipeline.

I get the following error, saying that the file does not start with a file id tag:

(/cognestic/mne) cognestic@labQLFR95:~/Desktop/cognestic/notebooks$ mne_bids_pipeline --config=demo_config.py 
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌ Welcome aboard MNE-BIDS-Pipeline! ๏‘‹ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚16:07:00โ”‚ ๏“ Using configuration: demo_config.py
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ด 
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌ init/_01_init_derivatives_dir โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚16:07:00โ”‚ โœ… Output directories already exist โ€ฆ
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ด done (1s)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌ init/_02_find_empty_room โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚16:07:00โ”‚ โœ… sub-01 run-01 Computation unnecessary (cached) โ€ฆ
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ด done (1s)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌ preprocessing/_01_data_quality โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚16:07:02โ”‚ โณ๏ธ sub-01 run-01 Finding flat channels and noisy channels using Maxwell filtering.
โ”‚16:07:02โ”‚ โŒ sub-01 run-01 A critical error occurred. The error message was: file '/home/cognestic/mne_data/ds000248/sub-01/meg/sub-01_task-audiovisual_run-01_meg.fif' does not start with a file id tag

Aborting pipeline run. The traceback is:

  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids_pipeline/steps/preprocessing/_01_data_quality.py", line 87, in assess_data_quality
    auto_scores = _find_bads_maxwell(
                  ^^^^^^^^^^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids_pipeline/steps/preprocessing/_01_data_quality.py", line 175, in _find_bads_maxwell
    raw = import_experimental_data(
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids_pipeline/_import_data.py", line 386, in import_experimental_data
    raw = _load_data(cfg=cfg, bids_path=bids_path_in)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids_pipeline/_import_data.py", line 227, in _load_data
    raw = read_raw_bids(
          ^^^^^^^^^^^^^^
  File "<decorator-gen-387>", line 12, in read_raw_bids
  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids/read.py", line 857, in read_raw_bids
    raw = _read_raw(
          ^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne_bids/read.py", line 72, in _read_raw
    raw = reader(raw_path, allow_maxshield, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne/io/fiff/raw.py", line 537, in read_raw_fif
    return Raw(
           ^^^^
  File "<decorator-gen-266>", line 12, in __init__
  File "/cognestic/mne/lib/python3.12/site-packages/mne/io/fiff/raw.py", line 105, in __init__
    raw, next_fname, buffer_size_sec = self._read_raw_file(
                                       ^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-267>", line 12, in _read_raw_file
  File "/cognestic/mne/lib/python3.12/site-packages/mne/io/fiff/raw.py", line 197, in _read_raw_file
    ff, tree, _ = fiff_open(fname, preload=whole_file)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-7>", line 12, in fiff_open
  File "/cognestic/mne/lib/python3.12/site-packages/mne/_fiff/open.py", line 134, in fiff_open
    return _fiff_open(fname, fid, preload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cognestic/mne/lib/python3.12/site-packages/mne/_fiff/open.py", line 153, in _fiff_open
    raise ValueError(f"{prefix} start with a file id tag")

I used a fresh copy of the ds00248 dataset and the config file supplied in the demo.

I used mne-bids-pipeline version 1.8.0 as that is the version bundled with the latest mne-python, but I also tested it with version 1.9.0 (everything else unchanged) and it throws the same error. Detailed system info below.

Could you please look into this and help me get the pipeline running?

Many thanks,
Mรกtรฉ

System info:

Platform             Linux-6.5.0-1023-azure-x86_64-with-glibc2.35
Python               3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
Executable           /cognestic/mne/bin/python3.12
CPU                  x86_64 (4 cores)
Memory               15.6 GB

Core
โ”œโ˜‘ mne               1.7.1 (latest release)
โ”œโ˜‘ numpy             1.26.4 (OpenBLAS 0.3.27 with 4 threads)
โ”œโ˜‘ scipy             1.13.1
โ””โ˜‘ matplotlib        3.8.4Installed qt5 event loop hook.
 (backend=QtAgg)

Numerical (optional)
โ”œโ˜‘ sklearn           1.5.0
โ”œโ˜‘ numba             0.59.1
โ”œโ˜‘ nibabel           5.2.1
โ”œโ˜‘ nilearn           0.10.4
โ”œโ˜‘ dipy              1.9.0
โ”œโ˜‘ openmeeg          2.5.11
โ”œโ˜‘ pandas            2.2.2
โ”œโ˜‘ h5io              0.2.3
โ”œโ˜‘ h5py              3.11.0
โ””โ˜ unavailable       cupy

Visualization (optional)
โ”œโ˜‘ pyvista           0.43.9 (OpenGL 4.5 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2 via llvmpipe (LLVM 15.0.7, 256 bits))
โ”œโ˜‘ pyvistaqt         0.11.0
โ”œโ˜‘ vtk               9.2.6
โ”œโ˜‘ qtpy              2.4.1 (PyQt5=5.15.8)
โ”œโ˜‘ ipympl            0.9.4
โ”œโ˜‘ pyqtgraph         0.13.7
โ”œโ˜‘ mne-qt-browser    0.6.3
โ”œโ˜‘ ipywidgets        8.1.3
โ”œโ˜‘ trame_client      3.1.0
โ”œโ˜‘ trame_server      3.0.1
โ”œโ˜‘ trame_vtk         2.8.9
โ””โ˜‘ trame_vuetify     2.6.0

Ecosystem (optional)
โ”œโ˜‘ mne-bids          0.15.0
โ”œโ˜‘ mne-nirs          0.6.0
โ”œโ˜‘ mne-features      0.3
โ”œโ˜‘ mne-connectivity  0.7.0
โ”œโ˜‘ mne-icalabel      0.6.0
โ”œโ˜‘ mne-bids-pipeline 1.8.0
โ”œโ˜‘ neo               0.13.0
โ”œโ˜‘ eeglabio          0.0.2-4
โ”œโ˜‘ edfio             0.4.2
โ”œโ˜‘ mffpy             0.9.0
โ””โ˜‘ pybv              0.7.5

UPDATE: The problem was caused by me incorrectly downloading the dataset from openneuro.

Initially, I downloaded it using the shell script which downloads it with only curl. As it turns out this will result in a slightly different dataset than downloading it using openneuro-py.

After downloading the dataset using openneuro-py, the pipeline completed without an error.

Just to mention, that the openneuro-py command in the demo below did not download the sub-01/ and sub-emptyroom/ folders for some reason:

openneuro-py download \
             --dataset=ds000248 \
             --include=sub-01 \
             --include=sub-emptyroom \
             --include=derivatives/freesurfer/subjects \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc.a2005s+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc.a2009s+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/xhemi/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.DKTatlas+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.DKTatlas+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.a2009s+aseg.mgz

So I downloaded the dataset without specifying what to include and exclude:

openneuro-py download --dataset=ds000248

Best,
Mรกtรฉ

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.