<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;"> External Email - Use Caution </span></p><p></p><div dir="ltr">read_evokeds returns a list. So list_evokeds will be a list of a list of evoked, rather than a list of evoked. Either do list_evokeds.extend(evoked), or list_evokeds.append(evoked[0]) and you should be good to go.<div><br></div><div>Eric</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 20, 2020 at 8:01 AM nick menger <<a href="mailto:nickmenger@hotmail.com">nickmenger@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)"> External Email - Use Caution </span></p><p></p>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dear all,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The combine_evoked() function seems to be not working in my code (using MNE 20.0 (dev) on Windows 10, Python 3.7.5). I tried reading in some saved evoked files for multiple participants with the following code:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:Consolas"><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:Consolas"><span style="color:rgb(128,128,128);font-style:italic"></span></pre></pre>
</div>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:Consolas"><span style="color:rgb(128,128,128)"># Read in evoked EEG for all participants<br></span>list_evokeds = <span style="color:rgb(0,0,128)">list</span>() <span style="color:rgb(128,128,128)"># list to append evokeds to<br></span><span style="color:rgb(0,0,128);font-weight:bold">for </span>subject <span style="color:rgb(0,0,128);font-weight:bold">in </span>subject_list: <span style="color:rgb(128,128,128)"># looping through my directory with computed evokeds (subject_list corresponds to list of strings with subject codes)<br></span><span style="color:rgb(128,128,128)"> </span>fname = pathlib.Path(<span style="color:rgb(0,128,128);font-weight:bold">f"my_path</span><span style="color:rgb(0,0,128);font-weight:bold">{</span>subject<span style="color:rgb(0,0,128);font-weight:bold">}</span><span style="color:rgb(0,128,128);font-weight:bold">-ave.fif"</span>) <span style="color:rgb(128,128,128)"># setting filename for each saved evoked file (where 'my_path' corresponds to a real path in my code obviously)<br></span><span style="color:rgb(128,128,128)"> </span>evoked = mne.read_evokeds(fname) <span style="color:rgb(128,128,128)"># reading the evoked file<br></span><span style="color:rgb(128,128,128)"> </span>list_evokeds.append(evoked) <span style="color:rgb(128,128,128)"># append it to a list</span><span style="color:rgb(128,128,128)"><br></span>combined_evoked = mne.combine_evoked(list_evokeds, <span style="color:rgb(102,0,153)">weights</span>=<span style="color:rgb(0,128,128);font-weight:bold">'nave'</span>) <span style="color:rgb(128,128,128)"># Results in AttributeError: 'list' object has no attribute 'nave'</span></pre>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The problem being the AttributeError that the list has no 'nave' attribute (same problem arises when setting 'weights' parameter to 'equal'. The problem traces back to the first line of the function's code: </div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:Consolas">line 869, in combine_evoked<br></pre>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:Consolas">naves = np.array([evk.nave <span style="color:rgb(0,0,128);font-weight:bold">for </span>evk <span style="color:rgb(0,0,128);font-weight:bold">in </span>all_evoked], <span style="color:rgb(0,0,128)">float</span>)</pre>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif;font-size:12pt">Could anyone tell me whether computing the attribute this way is necessary, or how I should modify my input to the function, so it works? If further info is needed,
please let me know!</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif;font-size:12pt"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks!</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="gmail-m_-3721731601876742011Signature">
<p>Verzonden vanuit <a href="http://aka.ms/weboutlook" target="_blank">Outlook</a><br>
</p>
</div>
</div>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>