Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_epochs step fails if runs have different bads #797

Open
hoechenberger opened this issue Oct 25, 2023 · 0 comments
Open

make_epochs step fails if runs have different bads #797

hoechenberger opened this issue Oct 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@hoechenberger
Copy link
Member

hoechenberger commented Oct 25, 2023

I'm handling EEG data where bads may vary from one block ("run") to another.

I'm seeing the following problem when running preprocessing/make_epochs:

23:10:33│ ❌ sub-184 A critical error occurred. The error message was: epochs[1].info['bads'] must match

Aborting pipeline run. The traceback is:

  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 54, in __mne_bids_pipeline_failsafe_wrapper__
    out = memory.cache(func)(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 154, in wrapper
    func(*args, **kwargs)
  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne_bids_pipeline/steps/preprocessing/_05_make_epochs.py", line 145, in run_epochs
    epochs_all_runs = mne.concatenate_epochs(
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-208>", line 12, in concatenate_epochs
  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne/epochs.py", line 4330, in concatenate_epochs
    ) = _concatenate_epochs(
        ^^^^^^^^^^^^^^^^^^^^
  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne/epochs.py", line 4189, in _concatenate_epochs
    _ensure_infos_match(epochs.info, info, f"epochs[{ii}]", on_mismatch=on_mismatch)
  File "/Users/richardhochenberger/mambaforge/envs/tasin/lib/python3.11/site-packages/mne/_fiff/meas_info.py", line 3723, in _ensure_infos_match
    raise ValueError(f"{name}.info['bads'] must match")

We should probably use unify_bad_channels()?

x-ref #538

@hoechenberger hoechenberger added the bug Something isn't working label Oct 25, 2023
@hoechenberger hoechenberger changed the title make_epochs step fails if runs have different pads make_epochs step fails if runs have different bads Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant