mne.write_evokeds throws AttributeError: 'dict' object has no attribute 'info'

  • MNE version: 1.7.0
  • operating system: Ubuntu 22.04

This is the code:

events_from_annot, event_dict = mne.events_from_annotations(raw_clean)
epochs = mne.Epochs(raw_clean, 
              events = None, 
              event_id=event_dict,
              tmin=tmin,
              tmax=tmax,
              baseline= (None,0),
              reject = dict(eeg=200e-6), 
              event_repeated = 'drop'
              ) 
 evokeds = {cond:epochs[cond].average() for cond in event_dict}
 mne.write_evokeds(erp_dir + ID + '_ave.fif', evokeds, overwrite = True)

This is the error message:

File ~/mne-python/1.7.0_0/lib/python3.12/site-packages/mne/evoked.py:2001 in _write_evokeds
    if evoked[0].info["meas_id"] is not None:

AttributeError: 'dict' object has no attribute 'info'

The evokeds structure seems to be fine. Some help will be very appreciated

fval

Hello @fval, you need to pass a list of Evoked, not a dictionary.

Best wishes,
Richard

2 Likes

Thank you, Richard

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.