Repository navigation
Closed
Description
First discussed in this gitter thread.
Show the bug (MNE master):
import os.path as op
import mne
datapath = mne.datasets.testing.data_path()
montage_fname = op.join(datapath, 'montage', 'captrak_coords.bvct')
montage = mne.channels.read_dig_captrak(montage_fname)
montage.plot() Expected behavior
... it should plot the montage
Actual behavior
click details.
Details
ValueError Traceback (most recent call last)
<ipython-input-7-b9409427730c> in <module>
----> 1 montage.plot()
~/miniconda3/envs/sp/lib/python3.6/site-packages/mne/channels/montage.py in plot(self, scale_factor, show_names, kind, show, sphere)
192 return plot_montage(self, scale_factor=scale_factor,
193 show_names=show_names, kind=kind, show=show,
--> 194 sphere=sphere)
195
196 def save(self, fname):
<decorator-gen-141> in plot_montage(montage, scale_factor, show_names, kind, show, sphere, verbose)
~/miniconda3/envs/sp/lib/python3.6/site-packages/mne/viz/montage.py in plot_montage(montage, scale_factor, show_names, kind, show, sphere, verbose)
69 info = create_info(ch_names, sfreq=256, ch_types="eeg")
70 RawArray(np.zeros((len(ch_names), 1)), info,
---> 71 copy=None).set_montage(montage)
72 fig = plot_sensors(info, kind=kind, show_names=show_names, show=show,
73 title=title, sphere=sphere)
<decorator-gen-20> in set_montage(self, montage, raise_if_subset, match_case, verbose)
~/miniconda3/envs/sp/lib/python3.6/site-packages/mne/io/meas_info.py in set_montage(self, montage, raise_if_subset, match_case, verbose)
188 from ..channels.montage import _set_montage
189 info = self if isinstance(self, Info) else self.info
--> 190 _set_montage(info, montage, raise_if_subset, match_case)
191 return self
192
~/miniconda3/envs/sp/lib/python3.6/site-packages/mne/channels/montage.py in _set_montage(info, montage, raise_if_subset, match_case)
736 (len(not_in_montage), _pl(not_in_montage), not_in_montage))
737 if raise_if_subset:
--> 738 raise ValueError(msg)
739 else:
740 warn(msg)
ValueError: DigMontage is a only a subset of info. There are 1 channel position not present in the DigMontage. The required channels are: ['REF']
Solution
Do not remove REF until a X.set_montage(montage) call.
Also: Consider removing GND/Gnd/Ground at that stage.
see:
mne-python/mne/channels/montage.py
Lines 690 to 693 in bd6f426
| ch_pos = mnt_head._get_ch_pos() | |
| refs = set(ch_pos) & {'EEG000', 'REF'} | |
| assert len(refs) <= 1 | |
| eeg_ref_pos = np.zeros(3) if not(refs) else ch_pos.pop(refs.pop()) |
Activity
agramfort commentedon Jul 18, 2020
sappelhoff commentedon Jul 19, 2020
Maybe at some point, but not now --> I would say this issue is "up for grabs".