I don’t have a great answer, but this might point you in the right direction…
I’ve had a similar error. What is the output of raw.ch_names? Have the channel names been passed to an info object?
I had to map the proper standard names (10/20 system in my case) to the info of my MNE raw data object. This is how I did it.
CHAN_MAP = {'1':'FP1','2':'FP2','3':'AF3','4':'AF4','5':'F7','6':'F3','7':'FZ','8':'F4','9':'F8','10':'FC5','11':'FC1',\
'12':'FC2','13':'FC6','14':'T7','15':'C3','16':'C4','17':'CZ','18':'T8','19':'CP5','20':'CP1','21':'CP2',\
'22':'CP6','23':'P7','24':'P3','25':'PZ','26':'P4','27':'P8','28':'PO7','29':'PO3','30':'PO4','31':'PO8',\
'32':'OZ','GND':'AFZ'}
for number,name in list(CHAN_MAP.items())[0:31]: self.data.ch_names[int(number)-1] = name # remap the channel names to their 10/20 correlates
ch_types = ['eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg',
'eeg', 'eeg', 'eeg', 'eeg','eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg',
'eeg', 'eeg', 'ecg']
info = mne.create_info(ch_names=self.data.ch_names,sfreq=self.SFREQ,ch_types=ch_types)
self.data.info = info
montage = mne.channels.make_standard_montage('standard_1020')
self.data.set_montage(montage,match_case=False) # set the montage for connectivity
I’m by no means an MNE expert, but if I remember correctly this fixed my problem of missing labels. (Not sure if you need the ch_types part, I only needed it because I was doing both eeg and ecg)
To use something like plot_topomap
and get a scalp topography, I believe you will need those x,y positions. Here’s my very crude use of the function (I later scrapped this to use plot_psd_topo but this still gave me a figure).
x_pos = [-29.76,29.76,-44.16,44.16,-77.76,-54.72,0,54.72,77.76,-84.48,-35.52,35.52,84.48,-96,-68.16,68.16,0,96,-84.48,-35.52,35.52,84.48,-77.76,-54.72,-0,54.72,77.76,-56.64,-44.16,44.16,56.64,-0]
y_pos = [91.2,91.2,82.56,82.56,56.64,67.2,68.16,67.2,56.64,34.56,39.36,39.36,34.56,0,0,0,0,0,-34.56,-39.36,-39.36,-34.56,-56.64,-67.2,-68.16,-67.2,-56.64,-77.76,-82.56,-82.56,-77.76,-96]
positions = np.array(list(zip(x_pos[0:31],y_pos[0:31]))) # exclude ecg channel
mne.viz.plot_topomap(np.average(data.get_data('eeg'),axis=1),positions) # data had to be averaged to be accepted by topomap
I abandoned this because I wanted topography in certain frequency bands rather than just voltage at a certain time period, but if you’re doing ERPs I think that should be fine (I think it’s standard to do that). I hope this helps!
-nv