How to import subjects' ERP amplitude into CSV

  • MNE version: e.g. 0.24.0
  • operating system: e.g.Windows 10

My code:

pain_epochs = epochs['pos']
noPain_epochs = epochs['neg']
pos_evoked = pain_epochs.average()
neg_evoked = noPain_epochs.average()
neg_evoked.plot()
# plt.show(block=True)
# pos_evoked.save('pos_ave.fif')
# neg_evoked.save('neg_ave.fif')
mne.viz.plot_compare_evokeds(dict(positive=pos_evoked, negative=neg_evoked), combine='mean', picks=np.arange(32),
                             invert_y=True, legend=True, ci=True)
plt.show()

My purpose:

When I calculated the average amplitude for each condition, I wanted to save it in CSV

Hello @yonglongwen,

evoked objects have a .to_data_frame() method, which converts the data to a Pandas DataFrame. From there, you can export to CSV, XLSX, etc.

Please let us know if you need any further help.

Best wishes,
Richard

2 Likes