Error when setting analyze_channels using mne bids pipeline

Hi everyone,

I am using the mne bids pipeline to process my EEG (currently on a single subject for testing). I first ran the pipeline on all channels, which successfully completed. I then restricted the channels to analyze for evoked potentials to a set of posterior-occip electrodes (I am interested in MMN).

MNE version: 1.6
MNE bids pipeline version: 1.5.0
OS: Ubuntu 22.04.2 LTS

# analyze_channels: Union[
#     Literal["all"], Literal["ch_types"], Iterable["str"]
# ] = "ch_types"
analyze_channels = ['PO7','PO8','POz','PO4','PO3','O1','Oz','O2']
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬ sensor/_01_make_evoked ─────────────────────────────────────────────────────────────────────────────────────────────────────────
β”‚11:36:13β”‚ ⏳️ sub-p015 ses-eeg Input: sub-p015_ses-eeg_task-seqPred_proc-clean_epo.fif
β”‚11:36:13β”‚ ⏳️ sub-p015 ses-eeg Output: sub-p015_ses-eeg_task-seqPred_ave.fif
β”‚11:36:13β”‚ ⏳️ sub-p015 ses-eeg Creating evoked data based on experimental conditions …
β”‚11:36:14β”‚ ⏳️ sub-p015 ses-eeg Contrasting evoked responses …
β”‚11:36:14β”‚ ⏳️ sub-p015 ses-eeg Adding 2 evoked responses and 1 contrast to the report.
β”‚11:36:14β”‚ ⏳️ sub-p015 ses-eeg Adding config and sys info to report
β”‚11:36:16β”‚ ⏳️ sub-p015 ses-eeg Saving report: /RAID1/jupytertmp/ahechler/data/eeg/derivatives/mne-bids-pipeline/sub-p015/ses-eeg/eeg/sub-p015_ses-eeg_task-seqPred_report.html
β”‚11:36:17β”‚ ❌ sub-p015 ses-eeg A critical error occurred. The error message was: 'types.SimpleNamespace' object has no attribute 'eeg_reference'

Aborting pipeline run. The traceback is:

  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/mne_bids_pipeline/", line 54, in __mne_bids_pipeline_failsafe_wrapper__
    out = memory.cache(func)(*args, **kwargs)
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/mne_bids_pipeline/", line 267, in wrapper
    memorized_func(*args, **kwargs)
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/joblib/", line 655, in __call__
    return self._cached_call(args, kwargs)[0]
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/joblib/", line 598, in _cached_call
    out, metadata =*args, **kwargs)
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/joblib/", line 856, in call
    output = self.func(*args, **kwargs)
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/mne_bids_pipeline/steps/sensor/", line 131, in run_evoked
    _restrict_analyze_channels(evoked, cfg)
  File "/home/tumnic/ahechler/.conda/envs/pr_andre_2024/envs/mne/lib/python3.12/site-packages/mne_bids_pipeline/", line 419, in _restrict_analyze_channels
    elif "eeg" in cfg.ch_types and cfg.eeg_reference == "average":

It seems like the reference electrodes were never correctly set. This is weird because the pipeline worked before I restricted the channels.

# eeg_reference: Union[Literal["average"], str, Iterable["str"]] = "average"

I also checked that the channels are correctly named by comparing against the _electrodes.tsv created by BIDS converting my BrainVision files. Which other reasons could there be for this error?

Thanks for the help!


Hello and welcome to the forum! This does indeed seem like a bug (and one that would be easy to fix!). I may have time to look into the problem this weekend.

cc @larsoner

Best wishes,

Great, thanks for checking in so quickly! Let me know if you need more info about my dataset. I meanwhile replicated the error with another subject and also when changing the reference.

This still seems to be an issue in mne_bids_pipeline 1.6.0.

1 Like

Hello, I believe I found the issue and I’m proposing a fix here:

We have released MNE-BIDS-Pipeline 1.7, which fixes this issue.


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