Reading evokeds in a list does not work

Hi all,

I am trying to run a cluster test as in this example but on previously created evoked data. However, I cannot read the data together with my two experimental conditions with the read_evoked function. Below please see my code. How should I read the data?

Thanks for your time and help!
PS: I would also love to join tomorrow’s office hour to find a solution.

Best,
Gözem

file_names = fnmatch.filter(os.listdir(evoked_folder), "*ave.fif")

all_evoked = []

for file_counter in file_names[0:len(file_names)]:
    #file_counter = file_names[1]
    #participant_name = file_counter.split("_")[0] 
    temp = mne.read_evokeds(evoked_folder + file_counter, condition = None)
    all_evoked.append(temp)

Hello, what exactly is not working?

Sorry, forgot to mention. For the later steps, I got this error message:
“All elements must be an instance of Evoked or AverageTFR, got <class ‘list’> instead.”

Could you please share all the relevant parts of your code and the complete traceback (the many lines produced by an error)? Otherwise it’s hard for others to really know what’s going wrong.
Thanks!

Richard

For example, following the mne.grand_average() function can result in the previously mentioned error message. Anyhow, thanks to you, Richard, here I find the solution: