MNE-BIDS-Pipeline ICA step critical error

Hi,

I’m getting a critical error from mne_bids_pipeline at the ICA stage:

[18:03:15] \u2502 \u274c preprocessing/_05a_run_ica sub-90 A critical error occurred. The error message was: attempt to get argmax of an empty sequence

Aborting pipeline run. The full traceback is:

Traceback (most recent call last):

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne_bids_pipeline/_run.py", line 55, in wrapper
    out = memory.cache(func)(*args, **kwargs)

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne_bids_pipeline/_run.py", line 264, in wrapper
    out_files = memorized_func(*args, **kwargs)

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/joblib/memory.py", line 594, in __call__
    return self._cached_call(args, kwargs)[0]

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/joblib/memory.py", line 537, in _cached_call
    out, metadata = self.call(*args, **kwargs)

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/joblib/memory.py", line 779, in call
    output = self.func(*args, **kwargs)

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_05a_run_ica.py", line 299, in run_ica
    ecg_epochs = make_ecg_epochs(

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_05a_run_ica.py", line 131, in make_ecg_epochs
    ecg_epochs = create_ecg_epochs(raw, baseline=(None, -0.2), tmin=-0.5, tmax=0.5)

  File "<decorator-gen-430>", line 12, in create_ecg_epochs

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne/preprocessing/ecg.py", line 346, in create_ecg_epochs
    events, _, _, ecg = find_ecg_events(

  File "<decorator-gen-429>", line 12, in find_ecg_events

  File "/home/ma09/.conda/envs/my_mne1.3/lib/python3.10/site-packages/mne/preprocessing/ecg.py", line 202, in find_ecg_events
    max_idx = (ends - onsets).argmax()

ValueError: attempt to get argmax of an empty sequence

It seems that there are no ecg epochs found.

I’m using v1.1.0 of mne_bids_pipeline
The rest of the system info:

Platform:         Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17
Python:           3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:20:04) [GCC 11.3.0]
Executable:       /home/ma09/.conda/envs/my_mne1.3/bin/python
CPU:              x86_64: 32 cores
Memory:           251.4 GB

mne:              1.3.0
numpy:            1.23.5 {OpenBLAS 0.3.21 with 32 threads}
scipy:            1.10.0
matplotlib:       3.6.3 {backend=module://matplotlib_inline.backend_inline}

sklearn:          1.2.1
numba:            0.56.4
nibabel:          5.0.1
nilearn:          0.10.0
dipy:             1.6.0
openmeeg:         2.5.5
cupy:             Not found
pandas:           1.5.3
pyvista:          0.38.2 {OpenGL could not be initialized}
pyvistaqt:        0.9.1
ipyvtklink:       0.2.2
vtk:              9.2.5
qtpy:             2.3.0 {None=None}
ipympl:           Not found
pyqtgraph:        0.13.1
pooch:            v1.6.0

mne_bids:         0.12
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   0.4.0
mne_connectivity: Not found
mne_icalabel:     Not found

In my config file I set ICA for artefact removal

spatial_filter: Optional[Literal["ssp", "ica"]] = 'ica'

The rest of the settings for ICA are default.

Could anyone please help?

Many thanks,
Máté

do you have an ECG channel in your dataset? if so is your ECG channel clean?

Alex

Hi Alex,

Thanks for your response. It seems that I haven’t properly set up my environment before running the pipeline. After setting up everyting properly, the pipeline ran without an error.

Best wishes,
Máté

1 Like