Describe the bug
The mne.viz.plot_topomap does not produce the expected result on the sample dataset when limiting to MEG channels.
Steps to reproduce
Run the following script:
import os
import mne
import numpy as np
data_path = mne.datasets.sample.data_path()
subjects_dir = os.path.join(data_path, "subjects")
data_dir = os.path.join(data_path, 'MEG', 'sample')
file_name = os.path.join(data_dir, 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(file_name, preload=True, verbose=False)
raw.pick_types(meg='grad', eeg=False, eog=False, stim=True)
print('done')
# info of the loaded channels
info = raw.copy().pick_types(meg=True).info
X = raw.get_data(picks=['meg'])
print("Data shape:", X.shape)
# simulate random data
data = np.random.randn(203)
assert len(info['chs']) == data.size
# plot
mne.viz.plot_topomap(data, info)
Expected results
plot_topomap should create a topographic map as image.
Actual results
Got the following error:
ValueError: cannot reshape array of size 203 into shape (101,2,newaxis)
which intervenes when the function _merge_grad_data(data, method) is called.
Additional information
Platform: macOS-10.15.7-x86_64-i386-64bit
Python: 3.7.4 (default, Aug 13 2019, 15:17:50) [Clang 4.0.1 (tags/RELEASE_401/final)]
Executable: /Users/cedricallain/anaconda3/bin/python
CPU: i386: 8 cores
Memory: 16.0 GB
mne: 0.21.0
numpy: 1.17.2 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.3.1
matplotlib: 3.1.1 {backend=module://ipykernel.pylab.backend_inline}
sklearn: 0.21.3
numba: 0.45.1
nibabel: Not found
cupy: Not found
pandas: 0.25.1
dipy: Not found
mayavi: Not found
pyvista: Not found
vtk: Not found
Describe the bug
The
mne.viz.plot_topomapdoes not produce the expected result on the sample dataset when limiting to MEG channels.Steps to reproduce
Run the following script:
Expected results
plot_topomapshould create a topographic map as image.Actual results
Got the following error:
which intervenes when the function
_merge_grad_data(data, method)is called.Additional information
Platform: macOS-10.15.7-x86_64-i386-64bit
Python: 3.7.4 (default, Aug 13 2019, 15:17:50) [Clang 4.0.1 (tags/RELEASE_401/final)]
Executable: /Users/cedricallain/anaconda3/bin/python
CPU: i386: 8 cores
Memory: 16.0 GB
mne: 0.21.0
numpy: 1.17.2 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.3.1
matplotlib: 3.1.1 {backend=module://ipykernel.pylab.backend_inline}
sklearn: 0.21.3
numba: 0.45.1
nibabel: Not found
cupy: Not found
pandas: 0.25.1
dipy: Not found
mayavi: Not found
pyvista: Not found
vtk: Not found