why -ave.fif save data as a list

Hello,

I create evokeds data averaging epochs:
PreprocessedEvoked_5_Baselined_Averaged = Epochs_5_Baselined.average()

Then I want to save these evoked data:

PreprocessedEvoked_5_Baselined_Averaged_List_File = FolderPath + "/Stim5FileBaselinedAveragedList" + Subject + "-ave.fif"
PreprocessedEvoked_5_Baselined_Averaged.save(fname = PreprocessedEvoked_5_Baselined_Averaged_List_File, overwrite = False)

Then, later I just load the saved data:
PreprocessedEvoked_5_Baselined_Averaged_List = mne.read_evokeds(PreprocessedEvoked_5_Baselined_Averaged_List_File)

But then, when I want to use this file to work on it through this command line:
Diff_5_10 = mne.combine_evoked([PreprocessedEvoked_5_Baselined_Averaged_List_File, PreprocessedEvoked_10_Baselined_Averaged_List_File], [1, -1])

I got this error:
AttributeError: 'list' object has no attribute 'nave'

but everything worksTexte préformaté fine if I work directly to data before saving them : PreprocessedEvoked_5_Baselined_Averaged

So I am wondering to know why I can not work on the saved evoked file?

mne.read_evokeds will return a list instead of an Evoked object if you don’t pass the condition parameter. So either do mne.read_evokeds(fname, condition="my condition") or do mne.read_evokeds(fname)[0]

2 Likes

aaaaahh! Great!
Thank you so much for your help, things are clearer for me now!!
I did not get the interest of savings if I was not able tu use them after! Each time I had to run the entire process! it will be way better now!

Thank you so so much!

Hugues

2 Likes

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