<div dir="ltr">hi yvonne,<div><br></div><div><span style="font-size:12.8px">connectivity must be a sparse matrix not a numpy array</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">from scipy import sparse</span></div><div><span style="font-size:12.8px">connectivity = sparse.eye(</span><span style="font-size:12.8px">numChan</span><span style="font-size:12.8px">)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">HTH</span></div><div><span style="font-size:12.8px">Alex</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 10:00 PM, Yvonne Fonken <span dir="ltr">&lt;<a href="mailto:yfonken@berkeley.edu" target="_blank">yfonken@berkeley.edu</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">Hi Alex, <div><br></div><div>Thank you for your reply. </div><div><br></div><div>This is my code, with two versions of a diagonal connectivity matrix (using version 14.1 of MNE): </div><div><div># Implement cluster permutation</div><div>numChan = Data.shape[1] # Data is shaped: Trials (115) x channels (217) x timepoints (30) numpy array</div><div>#connectivity =  np.diagflat( range(0,numChan), k = 0)</div><div>connectivity =  np.diagflat( np.ones((1,numChan)), k = 0) # N x N diagonal matrix with N being # of electrodes</div><div>TestData = np.swapaxes(Data, 1,2) # trials x time x space (electrodes)</div><div>T_obs, clusters, p_values, H0 = mne.stats.permutation_cluster_<wbr>1samp_test(TestData, n_permutations = 500, tail = 0, connectivity = connectivity)</div></div><div><br></div><div>Both versions of the connectivity matrix now give me the following error: </div><div>&#39;numpy.ndarray&#39; object has no attribute &#39;tocsr&#39;<br></div><div><br></div><div>Thanks,</div><div>Yvonne</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Tue, Sep 19, 2017 at 1:02 AM, Alexandre Gramfort <span dir="ltr">&lt;<a href="mailto:alexandre.gramfort@inria.fr" target="_blank">alexandre.gramfort@inria.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yvonne<br>
<br>
I would have said that a sparse diagonal matrix should work.<br>
<br>
can you share the code snippet you used?<br>
<br>
Alex<br>
<div><div class="m_-5055594899142456954h5"><br>
<br>
On Tue, Sep 19, 2017 at 3:17 AM, Yvonne Fonken &lt;<a href="mailto:yfonken@berkeley.edu" target="_blank">yfonken@berkeley.edu</a>&gt; wrote:<br>
&gt; Hi all,<br>
&gt;<br>
&gt; I am trying to apply the cluster permutation function in MNE on intracranial<br>
&gt; data (electrodes by time points), either by using<br>
&gt; mne.stats.permutation_cluster_<wbr>test, or<br>
&gt; mne.stats.permutation_cluster_<wbr>1samp_test. In this case, I do not want to<br>
&gt; cluster across electrodes, but I want to include this dimension in order to<br>
&gt; correct for multiple comparisons.<br>
&gt;<br>
&gt; My question is: how do I specify to only cluster over time, and not<br>
&gt; electrodes? Can I do this using the connectivity matrix, and if yes, what<br>
&gt; would a connectivity matrix look like when all electrodes do not have<br>
&gt; neighbors? I&#39;ve tried using diagonal matrices already, but I still get<br>
&gt; clusters spanning multiple electrodes.<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Yvonne<br>
&gt;<br>
&gt; --<br>
&gt; Yvonne Fonken<br>
&gt; PhD Candidate<br>
&gt; Helen Wills Neuroscience Institute<br>
&gt; University of California, Berkeley<br>
&gt;<br>
</div></div>&gt; ______________________________<wbr>_________________<br>
&gt; Mne_analysis mailing list<br>
&gt; <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</a><br>
&gt;<br>
&gt;<br>
&gt; The information in this e-mail is intended only for the person to whom it is<br>
&gt; addressed. If you believe this e-mail was sent to you in error and the<br>
&gt; e-mail<br>
&gt; contains patient information, please contact the Partners Compliance<br>
&gt; HelpLine at<br>
&gt; <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</a> . If the e-mail was sent to you in<br>
&gt; error<br>
&gt; but does not contain patient information, please contact the sender and<br>
&gt; properly<br>
&gt; dispose of the e-mail.<br>
&gt;<br>
______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br></font></span><div class="m_-5055594899142456954gmail_signature" data-smartmail="gmail_signature"><span class="HOEnZb"><font color="#888888">Yvonne Fonken<br>Graduate student</font></span><span class=""><br>Helen Wills Neuroscience Institute<br>University of California, Berkeley<br></span></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>