<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p></p><div dir="ltr"><div>I am very sorry for bothering you again,</div><div>I tried both options, and got the same error message:</div><div>TypeError: unsupported operand type(s) for +: &#39;SourceMorph&#39; and &#39;SourceMorph&#39;</div><div><br></div><div>Possibly, there was a mistake in morphing procedure.<br></div><div><br></div><div>1. I downloaded individual stcs:  <br></div><div>stc = mne.read_source_estimate()</div><div>2. I computed morphed stcs:</div><div>morph = mne.compute_source_morph(stc, subject_from=subject_name, subject_to=&#39;fsaverage&#39;, subjects_dir=subjects_dir)</div><div>3. saved them as *.h5:</div><div>morph.save()</div><div>4. Then I download all morphed stcs:</div><div>morphS1 = mne.read_source_morph(fileFolderSTC_morph + &#39;S1_stc-morph.h5&#39;)</div><div>morphS2=.........</div><div>5. and then tried to average:<br></div><div>
grand_average = (morphS1 + morphS2 + morphS3 + morphS4) / 4 <br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 5, 2019 at 10:17 PM Alexandre Gramfort &lt;<a href="mailto:alexandre.gramfort@inria.fr">alexandre.gramfort@inria.fr</a>&gt; 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"><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 dir="ltr"><div>hi Irina,</div><br><div class="gmail_quote"><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"><div>I tried this:</div><div>morph_group = [morphS1, morphS2, morphS3, morphS4]<br>grand_average = mne.SourceEstimate.mean(morph_group)</div><div><br></div><div>returns error: &quot;AttributeError: &#39;list&#39; object has no attribute &#39;sum&#39;&quot;<br></div></div></blockquote><div><br></div><div>you can do arithmetic with stcs</div><div><br></div><div>you can do:</div><div><br></div><div>grand_average = (morphS1 + morphS2 + morphS3 + morphS4) / 4</div><div><br></div><div>and this should work</div><div><br></div><div>all_stcs = [morphS1, morphS2, morphS3, morphS4]</div><div>grand_average = sum(all_stcs) / len(all_stcs)<br></div><div><br></div><div>HTH</div><div>Alex</div><div> </div></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>