Hello everyone;
I am trying to use the plot_evoked_topomap, but I am having some issues (script below)
I guess the problem is about the sensor location .
the error I get is:
ValueError: Cannot determine location of MEG/EOG/ECG channels using digitization points.
My code:
import pandas as pd
import matplotlib.pyplot as plt
import mne
import numpy as np
from mne.viz import plot_evoked_topomap
excel_file = "DATA2.xlsx" #"your_excel_file.xlsx"
df = pd.read_excel(excel_file)
time_series = df.iloc[:, 0].values
magnetic_field_series = df.iloc[:, 1:].values.T
sfreq = 1 / np.mean(np.diff(time_series))
ch_names = [f'MEG {i:04d}' for i in range(1, magnetic_field_series.shape[0] + 1)]
ch_types = ['mag'] * magnetic_field_series.shape[0]
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
montage = mne.channels.make_standard_montage('standard_1005')
info.set_montage(montage)
raw = mne.io.RawArray(magnetic_field_series, info)
events = np.array([[0, 0, 1]])
event_id = dict(event=1)
epochs_data = magnetic_field_series[np.newaxis, :]
epochs = mne.EpochsArray(epochs_data, info, events=events, event_id=event_id, tmin=0)
evoked = epochs.average()
fig = epochs.plot(scalings='auto', show=False)
fig.set_size_inches(10, 6)
plot_evoked_topomap(evoked, times='auto', ch_type='mag', time_unit='s')
plt.show()
- MNE version: 1.6.1
- operating system: Windows 11