# data format problem when using mne.grand\_average

**URL:** <https://mne.discourse.group/t/data-format-problem-when-using-mne-grand-average/1548>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [June 14, 2018, 8:09am UTC](https://mne.discourse.group/t/data-format-problem-when-using-mne-grand-average/1548 "2018-06-14T08:09:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [June 14, 2018, 8:09am UTC](https://mne.discourse.group/t/data-format-problem-when-using-mne-grand-average/1548/1 "2018-06-14T08:09:02Z")

</div>

External Email - Use Caution

Hello MNE experts,

I tried to aggregate evoked data across subjects and feeded them into  
function mne.grand\_average. Although I am pretty sure that all elements in  
the list are evoked data (see attached photo), it complained about " Not  
all input elements are Evoked or AverageTFR".

Here is what I did:

# create place holder  
for exp in exps:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locals()["evoked\_"+exp]=[]

# put evoked data from all subjects in the place holder  
for exp in exps:  
for subj in subjs:  
s = mne.read\_evokeds("evoked\_"+exp+"\_"+subj+"-ave.fif")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locals()["evoked\_"+exp].append(s)

# do grand avrage  
for exp in exps:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locals()["group\_evoked\_"+exp] =  
mne.grand\_average(locals()["evoked\_"+exp], drop\_bads=True)

Can someone pint out what was wrong with code? Thanks

Best,  
Veda  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20180614/06162418/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180614/06162418/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: Capture.JPG  
Type: image/jpeg  
Size: 76728 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20180614/06162418/attachment-0001.jpe](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180614/06162418/attachment-0001.jpe)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [June 14, 2018, 10:58am UTC](https://mne.discourse.group/t/data-format-problem-when-using-mne-grand-average/1548/2 "2018-06-14T10:58:47Z")

</div>

External Email - Use Caution

hi,

read\_evokeds returns a list. If you want one evoked take the first element  
or specify the condition you want to read.

A
