MNE-BIDS-Pipeline maxwell filter reference run error

Hi,

I am getting the below error whenever I set a run number different than β€˜01’ in the maxwell filter reference run parameter (mf_reference_run) in mne-bids-pipeline.

[16:19:22] β”‚ ⏳️ preprocessing/_01_data_quality sub-02 run-02 Finding flat channels and noisy channels using Maxwell filtering.
Opening raw data file /imaging/davis/Projects/SpeechMisperceptionMEEG/MNE-BIDS_data/sub-02/meg/sub-02_task-main_run-02_meg.fif...
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/ma09/.conda/envs/my_mne1.4/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 54, in wrapper
    out = memory.cache(func)(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ma09/.conda/envs/my_mne1.4/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 147, in wrapper
    in_files = kwargs["in_files"] = self.get_input_fnames(**these_kwargs)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ma09/.conda/envs/my_mne1.4/lib/python3.11/site-packages/mne_bids_pipeline/steps/preprocessing/_01_data_quality.py", line 46, in get_input_fnames_data_quality
    in_files = _get_raw_paths(
               ^^^^^^^^^^^^^^^
  File "/home/ma09/.conda/envs/my_mne1.4/lib/python3.11/site-packages/mne_bids_pipeline/_import_data.py", line 564, in _get_raw_paths
    raw_fname = _read_json(_empty_room_match_path(bids_path_in, cfg))[
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ma09/.conda/envs/my_mne1.4/lib/python3.11/site-packages/mne_bids_pipeline/_io.py", line 17, in _read_json
    with open(fname, "r", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/imaging/davis/Projects/SpeechMisperceptionMEEG/data/derivatives/mne-bids-pipeline/sub-01/meg/sub-01_task-main_run-01_emptyroommatch.json'

So the pipeline is looking for a file named β€˜sub-01_task-main_run-01_emptyroommatch.json’, whereas the actual file is called sub-01_task-main_run-03_emptyroommatch.json as I set mf_reference_run = '03' as it is recommended that a middle run should be used in this situation.

Does this seem like a bug or am I doing something wrong?

Many thanks,
MΓ‘tΓ©

System info:

Platform             Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17
Python               3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:57:19) [GCC 11.3.0]
Executable           /home/ma09/.conda/envs/my_mne1.4/bin/python
CPU                  x86_64 (32 cores)
Memory               251.4 GB

Core
β”œβ˜‘ mne               1.4.0
β”œβ˜‘ numpy             1.24.3 (OpenBLAS 0.3.23 with 32 threads)
β”œβ˜‘ scipy             1.10.1
β”œβ˜‘ matplotlib        3.7.1 (backend=agg)
β”œβ˜‘ pooch             1.7.0
β””β˜‘ jinja2            3.1.2

Numerical (optional)
β”œβ˜‘ sklearn           1.2.2
β”œβ˜‘ numba             0.57.0
β”œβ˜‘ nibabel           5.1.0
β”œβ˜‘ nilearn           0.10.1
β”œβ˜‘ dipy              1.7.0
β”œβ˜‘ openmeeg          2.5.6
β”œβ˜‘ pandas            2.0.2
β””β˜ unavailable       cupy

Visualization (optional)
β”œβ˜‘ pyvista           0.39.1 (OpenGL unavailable)
β”œβ˜‘ pyvistaqt         0.0.0
β”œβ˜‘ ipyvtklink        0.2.2
β”œβ˜‘ vtk               9.2.6
β”œβ˜‘ qtpy              2.3.1 (None=None)
β”œβ˜‘ pyqtgraph         0.13.3
β”œβ˜‘ mne-qt-browser    0.0.0
β””β˜ unavailable       ipympl

Ecosystem (optional)
β”œβ˜‘ mne-bids          0.12
β”œβ˜‘ mne-bids-pipeline 1.3.0
β””β˜ unavailable       mne-nirs, mne-features, mne-connectivity, mne-icalabel

Hello @allermat, this does indeed seem like a bug. Could you please report it to our issue tracker at Issues Β· mne-tools/mne-bids-pipeline Β· GitHub? Thanks!

Richard

1 Like

The issue has now been reported here: MNE-BIDS-Pipeline maxwell filter reference run error Β· Issue #740 Β· mne-tools/mne-bids-pipeline Β· GitHub

1 Like

This bug has been fixed: BUG: Fix bug with mf_reference_run by larsoner Β· Pull Request #742 Β· mne-tools/mne-bids-pipeline Β· GitHub
Thanks @richard and @larsoner!

1 Like