<div dir="ltr">After this line:<div></div><div class="markdown-here-wrapper" style=""><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">stcs=np.concatenate((stc_1.data,stc_2.data),axis=0)
</code></pre><div title="MDH:PGRpdj5gYGA8L2Rpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPnN0Y3M9
bnAuY29uY2F0ZW5hdGUoKHN0Y18xLjwvc3Bhbj48d2JyIHN0eWxlPSJmb250LXNpemU6IDEyLjhw
eDsiPjxzcGFuIHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPmRhdGEsc3RjXzIuZGF0YSksYXhp
cz0wKTwvc3Bhbj48YnI+PC9kaXY+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1zaXplOiAxMi44cHg7
Ij5gYGA8L3NwYW4+PC9kaXY+PGRpdj48L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div><div><span style="font-size:12.8px">You will have stcs.shape == (</span><span style="font-size:12.8px">40968, n_times).</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">However, for `spectral_connectivity`, the `data` argument needs to be of shape </span><span style="white-space:pre-wrap">(n_epochs, n_signals, n_times), i.e. you need multiple epochs/trials. Here you appear to only have 1.</span></div><div><br></div><div><span style="white-space:pre-wrap">HTH,</span></div><div><span style="white-space:pre-wrap">Eric</span></div><div><span style="white-space:pre-wrap"><br></span></div>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 15, 2017 at 11:53 AM, Maria Hakonen <span dir="ltr">&lt;<a href="mailto:maria.hakonen@gmail.com" target="_blank">maria.hakonen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear mne experts,</div><div><br></div><div>In an example “Compute coherence in source space using a MNE inverse solution” mne.connectivity.spectral_<wbr>connectivity is used to compute the coherence between a seed in the left auditory cortex and the rest of the brain based on single-trial MNE-dSPM inverse solutions. However, I would like to use mne.connectivity.spectral_<wbr>connectivity to compute the coherence between two stc files measured in two different conditions. </div><div><br></div><div>I have tried to do this as follows:</div><div>stcs=np.concatenate((stc_1.<wbr>data,stc_2.data),axis=0)</div><div>stcs=stcs.tolist()</div><div>indices=(np.arange(1,20484),<wbr>np.arange(20485,40968)) (I would like to get the coherence between each vertex in stc1 and the corresponding vertices in stc2)</div><div>coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(</div><div>    stcs, method=&#39;coh&#39;, mode=&#39;fourier&#39;, indices=indices,</div><div>    sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)</div><div><br></div><div>However, I get:</div><div><br></div><div>Connectivity computation...</div><div>------------------------------<wbr>------------------------------<wbr>---------------</div><div>AttributeError                            Traceback (most recent call last)</div><div>&lt;ipython-input-40-<wbr>139613d5f602&gt; in &lt;module&gt;()</div><div>      1 coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(</div><div>      2     stcs, method=&#39;coh&#39;, mode=&#39;fourier&#39;, indices=indices,</div><div>----&gt; 3     sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)</div><div><br></div><div>/share/apps/mne/mne-python/<wbr>python2.7/lib/python2.7/site-<wbr>packages/mne-0.11.dev0-py2.7.<wbr>egg/mne/connectivity/spectral.<wbr>pyc in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax, fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias, cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)</div><div><br></div><div>/share/apps/mne/mne-python/<wbr>python2.7/lib/python2.7/site-<wbr>packages/mne-0.11.dev0-py2.7.<wbr>egg/mne/utils.pyc in verbose(function, *args, **kwargs)</div><div>    549         finally:</div><div>    550             set_log_level(old_level)</div><div>--&gt; 551     return function(*args, **kwargs)</div><div>    552</div><div>    553</div><div><br></div><div>/share/apps/mne/mne-python/<wbr>python2.7/lib/python2.7/site-<wbr>packages/mne-0.11.dev0-py2.7.<wbr>egg/mne/connectivity/spectral.<wbr>pyc in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax, fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias, cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)</div><div>    772             # get the data size and time scale</div><div>    773             n_signals, n_times_in, times_in = \</div><div>--&gt; 774                 _get_and_verify_data_sizes(<wbr>first_epoch)</div><div>    775</div><div>    776             if times_in is None:</div><div><br></div><div>/share/apps/mne/mne-python/<wbr>python2.7/lib/python2.7/site-<wbr>packages/mne-0.11.dev0-py2.7.<wbr>egg/mne/connectivity/spectral.<wbr>pyc in _get_and_verify_data_sizes(<wbr>data, n_signals, n_times, times)</div><div>    479     n_signals_tot = 0</div><div>    480     for this_data in data:</div><div>--&gt; 481         this_n_signals, this_n_times = this_data.shape</div><div>    482         if n_times is not None:</div><div>    483             if this_n_times != n_times:</div><div><br></div><div>AttributeError: &#39;float&#39; object has no attribute &#39;shape&#39;</div><div><br></div><div>Could someone please let me know what I am doing wrong?</div><div><br></div><div>Best,</div><div>Maria</div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>analysis</a><br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/<wbr>complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br></blockquote></div><br></div>