[Mne_analysis] issue with TFCE and permutation_cluster_1samp_test

Fleur GAUDFERNAU fleur.gaudfernau at pasteur.fr
Fri Apr 17 10:49:08 EDT 2020
Search archives:

        External Email - Use Caution        

I tried that, it solved the problem. I'm sorry, I'm not sure how to make a PR (I'm a M2 student).

Fleur



________________________________
De : mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> de la part de Eric Larson <larson.eric.d at gmail.com>
Envoyé : jeudi 16 avril 2020 15:11
À : Discussion and support forum for the users of MNE Software
Objet : Re: [Mne_analysis] issue with TFCE and permutation_cluster_1samp_test


        External Email - Use Caution

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!

Eric


On Thu, Apr 16, 2020 at 8:35 AM Fleur GAUDFERNAU <fleur.gaudfernau at pasteur.fr<mailto:fleur.gaudfernau at pasteur.fr>> wrote:

        External Email - Use Caution

Hello,

I encountered a mistake when running permutation_cluster_1samp_test with TFCE.

clu = permutation_cluster_1samp_test(X, n_permutations = n_permutations,
                                            connectivity = connectivity,
                                            threshold=threshold, tail=tails,
                                            out_type = 'indices')
=> File "C:\Users\XX\Anaconda3\lib\site-packages\mne\stats\cluster_level.py", line 385, in _find_clusters

    threshold['step'], float)
ValueError: arange: cannot compute length


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 :

  t = np.mean(X, axis=0) / np.sqrt(var / X.shape[0])

with var =[8.09150634e-43 5.30338813e-43 5.90491142e-43 ... 0.00000000e+00

0.00000000e+00 0.00000000e+00]

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:
thresholds = np.arange(threshold['start'], stop, threshold['step'], float)

Does anyone has a solution for this issue?
Thanks in advance,
Fleur

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200417/0a4b0b63/attachment.html 


More information about the Mne_analysis mailing list