<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">As a first step, we could do `np.max(np.abs(tvalues[np.isfinite(tvalues)]))`. Can you try it with your data? If you could make a PR to implement this it would be great!<div><br></div><div>Eric</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 16, 2020 at 8:35 AM Fleur  GAUDFERNAU &lt;<a href="mailto:fleur.gaudfernau@pasteur.fr">fleur.gaudfernau@pasteur.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">




<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 id="gmail-m_1585853461690779928divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,EmojiSymbols">
<p>Hello,</p>
<p>I encountered a mistake when running <span>permutation_cluster_1samp_test</span> with TFCE.</p>
<p></p>
<div>clu = permutation_cluster_1samp_test(X, n_permutations = n_permutations,<br>
<div>                                            connectivity = connectivity,<br>
                                            threshold=threshold, tail=tails,<br>
                                            out_type = &#39;indices&#39;)</div>
</div>
=&gt;<span style="color:rgb(255,0,0)"> File &quot;C:\Users\XX\Anaconda3\lib\site-packages\mne\stats\cluster_level.py&quot;, line 385, in _find_clusters</span><br>
<p></p>
<p></p>
<div><span style="color:rgb(255,0,0)">    threshold[&#39;step&#39;], float)</span><br>
<span style="color:rgb(255,0,0)">ValueError: arange: cannot compute length</span></div>
<p></p>
<p><br>
</p>
<p>X is shape (n subjects x n sources). This mistake actually comes from the T-value computation. It seems that the activity of some of the sources is 0 for all subjects, hence creating nans when computing the t value :</p>
<p><span>  t = np.mean(X, axis=0) / np.sqrt(var / X.shape[0])</span></p>
<p>with var =[8.09150634e-43 5.30338813e-43 5.90491142e-43 ... 0.00000000e+00<br>
</p>
<p></p>
<div>0.00000000e+00 0.00000000e+00]</div>
<div><br>
</div>
<div>Then, in function _find_clusters, mne tries to set the stop limit of TFCE as np.max(np.abs(tvalues)), hence generating the error at this line:<br>
</div>
<div>thresholds = np.arange(threshold[&#39;start&#39;], stop, threshold[&#39;step&#39;], float)</div>
<div><br>
</div>
<div>Does anyone has a solution for this issue?</div>
<div>Thanks in advance,</div>
<div>Fleur<br>
</div>
<p></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>