Error using ica.plot_sources - error says channel names are missing but they are not

Hi all,

I am trying to run an ICA decomposition on spinal electrophysiology data, it’s very simple code at the minute, and the relevant part of the code looks like this:


ica = mne.preprocessing.ICA(n_components=15, max_iter='auto', random_state=97)

ica.plot_sources(raw, show_scrollbars=False)

I’m essentially following the tutorial here at the moment (Repairing artifacts with ICA β€” MNE 0.24.1 documentation)

Unfortunately, the above code throws up the following error:
Traceback (most recent call last):
File β€œ/data/pt_02569/python/”, line 67, in
run_post_ica(subject, condition, srmr_nr, sampling_rate)
File β€œ/data/pt_02569/python/”, line 66, in run_post_ica
ica.plot_sources(raw, show_scrollbars=False)
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/preprocessing/”, line 1852, in plot_sources
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/viz/”, line 88, in plot_ica_sources
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/viz/”, line 989, in _plot_sources
File β€œβ€, line 24, in set_annotations
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/io/”, line 659, in set_annotations
new_annotations._prune_ch_names(, on_missing)
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/”, line 422, in _prune_ch_names
on_missing, 'At least one channel name in ’
File β€œ/data/pt_02569/python/venv/lib/python3.6/site-packages/mne/utils/”, line 757, in _on_missing
raise error_klass(msg)
ValueError: At least one channel name in annotations missing from info: S35

I can’t find the reason for this error - if I print raw.ch_names and raw_filtered.ch_names, I get the following identical output:
[β€˜S35’, β€˜S24’, β€˜S36’, β€˜Iz’, β€˜S17’, β€˜S15’, β€˜S32’, β€˜S22’, β€˜S19’, β€˜S26’, β€˜S28’, β€˜S9’, β€˜S13’, β€˜S11’, β€˜S7’, β€˜SC1’, β€˜S4’, β€˜S18’, β€˜S8’, β€˜S31’, β€˜SC6’, β€˜S12’, β€˜S16’, β€˜S5’, β€˜S30’, β€˜S20’, β€˜S34’, β€˜AC’, β€˜S21’, β€˜S25’, β€˜L1’, β€˜S29’, β€˜S14’, β€˜S33’, β€˜S3’, β€˜AL’, β€˜L4’, β€˜S6’, β€˜S23’, β€˜ECG’]

and if i print the variable, the ch_names are similarly given as:
ch_names: S35, S24, S36, Iz, S17, S15, S32, S22, S19, S26, S28, S9, S13, …

So evidently channel S35 is present in both the ica and the raw structures, so I can’t understand how this error (β€˜At least one channel name in annotations missing from info: S35’) comes to be.

Any help/advice would be greatly appreciated!

  • MNE version: 0.23.4
  • operating system: Ubuntu 18.04.6

Edit to add: ica.plot_overlay is working as expected so it is potentially just a bug in the plot_sources function