Unexpected path and file names

  • MNE version: 1.11.0

  • operating system: WSL: Ubuntu-22.04

Hi guys. Following the suggestion of @larsoner in this other topic, I tried to install the latest main of mne-bids-pipeline from GitHub to make sure to be up to date.

Now I’m encountering new sorts of errors that I can’t fix.

During preprocessing/_06a2_find_ica_artifacts step, the pipeline throws a FileNotFoundError related to:

/BIDS/derivatives/mne-bids-pipeline/sub-063/meg/sub-063_task-rest_run-01_emptyroommatch.json’

I don’t understand why it’s skipping the session folder, the correct path should be

/BIDS/derivatives/mne-bids-pipeline/sub-063/ses-01/meg/sub-063_task-rest_run-01_emptyroommatch.json

I could move forward on this problem adding a session = session argument in this line

But then I get blocked by an error in source/_02_make_bem_solution

AssertionError: missing in_files[“inner_skull”] = …/BIDS/derivatives/freesurfer/sub-063_ses-01/bem/inner_skull.surf

My correct path would be:

BIDS/derivatives/freesurfer/sub-063/bem/inner_skull.surf

Is my BIDSification uncorrect or there are some problems with filenames and paths?

I’m not a programmer so I may have messed up something during the installation of the package.

Inside my virtual environment I ran:

pip uninstall mne-bids-pipeline

pip install git+https://github.com/mne-tools/mne-bids-pipeline.git@main

So latest main added support for handling sessions differently (hopefully better!). @drammock should be able to comment on whether the behavior above is expected (and thus BIDSification was done incorrectly somehow) or if it’s a bug with MNE-BIDS-Pipeline that we should fix. Looks like it expects the FreeSurfer surface to have ses in the path if session is named… but maybe we should fall back to also considering the path without ses

The second problem is likely a bug and might be fixed by don't use subj+session for fs_subj unnecessarily by drammock · Pull Request #1130 · mne-tools/mne-bids-pipeline · GitHub

The first problem I can’t figure out because (1) you didn’t provide the full traceback, (2) the link you provided doesn’t work (returns 404 error), and (3) if I check line number 617 that is indicated in the URL… it doesn’t exist (the file only has 400 lines). Can you provide the full traceback please?

I corrected the link

┌────────┬ preprocessing/_06a2_find_ica_artifacts ───────────────────────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/bin/mne_bids_pipeline”, line 8, in 
sys.exit(main())
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/_main.py”, line 253, in main
step_module.main(config=config_imported)
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 615, in main
logs = parallel(
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 617, in 
cfg=get_config(config=config, subject=subject),
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 584, in get_config
runs_tasks=get_runs_tasks(config=config, subject=subject, session=session),
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/_config_utils.py”, line 388, in get_runs_tasks
noise_path = _get_noise_path(
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/_import_data.py”, line 707, in _get_noise_path
raw_fname = _read_json(_empty_room_match_path(raw_fname, cfg))[“fname”]
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/_io.py”, line 17, in _read_json
with open(fname, encoding=“utf-8”) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/leozm/CRNL_projects/MNEBIDS_mimosa_criticality/data/sample_for_Leonardo/BIDS/derivatives/mne-bids-pipeline/sub-063/meg/sub-063_task-rest_run-01_emptyroommatch.json’

thanks for the traceback and the link. (regarding the number of lines in the file: locally I was on an old branch, so that was my mistake sorry).

At first glance I’d say your fix is likely the correct one; I’ll roll that into #1130 and hopefully git it finished and merged in this week.

1 Like

@LeonardoMelloni can you try with current main of mne-bids-pipeline and see if the error is gone now?

Hello, sorry for the delay.

I installed the latest version

uv pip install “git+https://github.com/mne-tools/mne-bids-pipeline.git”

but I’m still getting the same error, the ses folder is skipped:

┌────────┬ preprocessing/_06a2_find_ica_artifacts ──────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/bin/mne_bids_pipeline”, line 10, in
sys.exit(main())
~~~~^^
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/_main.py”, line 253, in main
step_module.main(config=config_imported)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 615, in main
logs = parallel(
run_func(
…<5 lines>…
for subject, session in ss
)
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 617, in
cfg=get_config(config=config, subject=subject),
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/steps/preprocessing/_06a2_find_ica_artifacts.py”, line 584, in get_config
runs_tasks=get_runs_tasks(config=config, subject=subject, session=session),
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/_config_utils.py”, line 390, in get_runs_tasks
noise_path = _get_noise_path(
mf_reference_run=mf_reference_run,
…<4 lines>…
kind=“orig”,
)
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/_import_data.py”, line 707, in _get_noise_path
raw_fname = _read_json(_empty_room_match_path(raw_fname, cfg))[“fname”]
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env_latest/lib/python3.13/site-packages/mne_bids_pipeline/_io.py”, line 17, in _read_json
with open(fname, encoding=“utf-8”) as f:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/leozm/CRNL_projects/MNEBIDS_mimosa_criticality/data/sample_for_Leonardo_latest_mne/BIDS/derivatives/mne-bids-pipeline/sub-063/meg/sub-063_task-rest_run-01_emptyroommatch.json’