Error when trying to plot projectors (SSP)

  • MNE version: 1.6.1
  • OS: Windows 11 Pro

Hello!
I have a problem trying to display the projectors (I’m working with OPM data in fif format).
I have tried everything, including just uploading a file, calculating the projectors and adding them and then I run:

mne.viz.plot_projs_topomap(projs, colorbar=True, vlim=“joint” , info=raw.info)

I get:

File :12 in pick_channels

** File ~\anaconda3\Lib\site-packages\mne_fiff\pick.py:293 in pick_channels**
** raise RuntimeError(“ch_names is not a unique list, picking is unsafe”)**

RuntimeError: ch_names is not a unique list, picking is unsafe

I have checked the structures and everything is ok, maybe (it seems to be) a problem with pick_channels.

Could you save the projector and the raw.info and share them here to replicate?

Mathieu

1 Like

Sure! but I am wondering what is the best way to share it, because the structure (specially of projectors) has too many branches to just paste it here. Because It is not possible to upload files, is it?

Thanks,

Rodrigo

You can’t upload files directly here, but if you save only the projectors and the info with:

The 2 files will be very small and you can share them either directly on the forum through an external provider; or in a GitHub issue here: Issues · mne-tools/mne-python · GitHub

Mathieu

Super, here are the files under the names test-info.fif and test-proj.fif

Proj and info

Rodrigo

More info:

First I thought that the error was related to the (additional) input channel stored in info.raw, but by dropping it before the projectors computing I got the same error message.

The issue is that this function mne-python/mne/utils/misc.py at a622a467074ea9ba0f1d1168c4ec3b8c6af74323 · mne-tools/mne-python · GitHub

Turns your list of unique channel names into a list of channel names with duplicate, which then yields the error you get: ch_names is not a unique list. In particular, the 2 channels L108_bz-s77 and L108_bz-s110 both end up as L108_bz.

I am not familiar with the naming schema of your channels, but since you mention working with OPM data, this is not a VectorView or CTF system and should be treated as a bug. I opened: Fix by mscheltienne · Pull Request #12489 · mne-tools/mne-python · GitHub to track and fix it.
In the meantime, you can try renaming your channels with raw.rename_channels.

Mathieu

1 Like

Thanks! I realized of the same issue. Now everything is working ok forcing the name changes.

1 Like

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