Critical error mne-bids-pipeline ICA automated EOG artefact correction on Fp1 and Fp2

Hello again,

as mentioned before - I am new to python and mne.

I have been working step be step through the mne-bids-pipeline, sorting out one problem after the other, but now I am stuck at the ‘calculating ICA solution’ step:

[15:28:51] preprocessing/_04a_run_ica sub-AUAY02MA A critical error occured. The error message was: No EOG channel(s) found

Aborting pipeline run.


File “/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/mne/preprocessing/eog.py”, line 142, in _get_eog_channel_index
raise RuntimeError(‘No EOG channel(s) found’)
RuntimeError: No EOG channel(s) found

In my customised config file I have defined the eog as virtual channels as no separate eog channels were recorded.

eog_channels: Optional[Iterable[str]] = ['Fp1', 'Fp2'] (reference has been set to average, and analyse channels to all).

It doesn’t seem to recognise the eog-specification. What am I missing? Do I need to specify the eog channels anywhere else?

Best wishes, and thanks again.
Fraenni

Hello @fraenni, this should work :thinking:

Could you please post the entire (sometimes super long) error message? I mean all lines that get printed when the error occurs.

For good formatting, you can use the “Preformatted text” button in the toolbar.

Thanks!

Richard

@fraenni If you cannot get it to work, I invite you to join our tomorrow’s online office hour, where we can try to figure things out together via screen share:

The office hours sound great. thanks. will try to join.

Here is the full error message:

[15:56:05] preprocessing/_04a_run_ica sub-AUAY02MA A critical error occured. The error message was: No EOG channel(s) found

Aborting pipeline run.
Traceback (most recent call last):
  File "/Users/PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/run.py", line 246, in <module>
    fire.Fire(process)
  File "/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/run.py", line 241, in process
    script_module.main()
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/scripts/preprocessing/_04a_run_ica.py", line 534, in main
    logs = parallel(
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/scripts/preprocessing/_04a_run_ica.py", line 535, in <genexpr>
    run_func(
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/config.py", line 2803, in wrapper
    raise(e)
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/config.py", line 2785, in wrapper
    out = func(*args, **kwargs)
  File "/Users//PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/scripts/preprocessing/_04a_run_ica.py", line 408, in run_ica
    eog_ics, eog_scores = detect_bad_components(
  File "/Users/PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main-3/scripts/preprocessing/_04a_run_ica.py", line 204, in detect_bad_components
    inds, scores = ica.find_bads_eog(
  File "<decorator-gen-423>", line 12, in find_bads_eog
  File "/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/mne/preprocessing/ica.py", line 1751, in find_bads_eog
    eog_inds = _get_eog_channel_index(ch_name, inst)
  File "/Users/opt/miniconda3/envs/mne/lib/python3.10/site-packages/mne/preprocessing/eog.py", line 142, in _get_eog_channel_index
    raise RuntimeError('No EOG channel(s) found')
RuntimeError: No EOG channel(s) found

Thanks a lot!

Something just came to my mind: Are you sure the channels are actually named Fp1 and Fp2, and not FP1 and FP2, as is sometimes the case? MNE is case-sensitive, hence such a slight change can make all the difference sometimes


Hi, I had already tried that, but didn’t make a difference. Sorry should have mentioned it in my post! Thanks.

For all those following this thread:

@fraenni and I just had a video call and found the problem observed here is actually caused by a bug in the pipeline. We’ll work on a fix ASAP.

We’re working on a bugfix here:

This is now fixed in the pipeline.

Hi again,

it still doesn’t seem to work for me for some reason - I am basically getting the same mistake :face_with_spiral_eyes:

Let me explain:

I have updated men-bids

 pip install -U https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
 pip install -U https://github.com/mne-tools/mne-bids/archive/refs/heads/main.zip

and downloaded the pipeline scripts again. In my personalised config-file I am defining my EOG channel and artefact removal as follows:

ch_types = ['eeg']
data_type = 'eeg'
eog_channels = ['Fp1', 'Fp2']
spatial_filter = 'ica'
ica_reject = dict(eeg=350e-6, eog=500e-6)
ica_algorithm = 'picard'
ica_max_iterations = 1000
ica_n_components = 30 - len(eeg_reference)
ica_eog_threshold = 2
reject = 'autoreject_global'

When I am running the code I am still getting this error in run_ica:

[15:40:02] **preprocessing/_04a_run_ica** **sub-TUCO02IR** **A critical error occured. The error message was: No EOG channel found. Cannot reject based on EOG.**
**Aborting pipeline run. The full traceback is:**
**Traceback (most recent call last):**
**File "/Users/Franziska/Dropbox/PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main/config.py", line 2785, in wrapper**
**out = func(*args, **kwargs)**
**File "/Users/Franziska/Dropbox/PredictiveLanguageCoding_EEG/EEG_analysis/mne-bids-pipeline-main/scripts/preprocessing/_04a_run_ica.py", line 380, in run_ica**
**epochs.drop_bad(reject=cfg.ica_reject)**
**File "<decorator-gen-251>", line 12, in drop_bad**
**File "/Users/Franziska/opt/miniconda3/envs/mne/lib/python3.10/site-packages/mne/epochs.py", line 1269, in drop_bad**
**self._reject_setup(reject, flat)**
**File "/Users/Franziska/opt/miniconda3/envs/mne/lib/python3.10/site-packages/mne/epochs.py", line 772, in _reject_setup**
**raise ValueError("No %s channel found. Cannot reject based on "**
**ValueError: No EOG channel found. Cannot reject based on EOG.**

It seems like the same error, or am I missing something?

Thanks for your help!!
Franziska

Hello,

This is a slightly different issue now, caused by this line;

since your data doesn’t have an EOG channel, you cannot set an EOG rejection threshold. When you specify eog_channels, those channels will be used to detect EOG artifacts. But we won’t change their channel type to eog — in your case, they remain EEG channels.

Simply pass a single eeg rejection threshold and drop the eog threshold, and the issue should go away.

I had briefly discussed this behavior with @agramfort last week and we agreed that it should probably be the right thing to do. But I suppose we need to expand the documentation there


Best,
Richard

Okay, fantastic, that makes sense, and that is exactly what I have done!

One more question regarding the notch filter - at the moment the pipeline does not include one. Do you have any suggestion how I can tackle that from within the pipeline if I want to filter power line noise?

Thanks :smiley:

Yes, simply set the l_freq of the bandpass filter to e.g. 40 Hz to cut away the line noise. Will this work in your case?

Best,
Richard

Okay, yes, that’s the way I have done that. Thanks :slight_smile:

1 Like

Of course I meant h_freq, i.e. the upper bound.