0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

Error when conducting non-parametric t-test #181

Closed EmblaJ closed 2 years ago

EmblaJ commented 2 years ago

Hi,

Sometimes I have a problem when conducting a non-parametric t-test in spm (sometimes I don't have this problem). A screen shot of the error is attached.

error_snpm

Can I fix this somehow?

Thank you in advance!

0todd0000 commented 2 years ago

That error can arise if there are no supra-threhold clusters. To fix the error, check whether supra-clusters exist when attempting to access cluster details, like this:

if len( snpmi.clusters ) > 0:
    cluster = snpmi.clusters[0]

Equivalently, you can instead check whether the null hypothesis is rejected, like this:

if snpmi.h0reject:
    cluster = snpmi.clusters[0]
EmblaJ commented 2 years ago

Thanks.

And what do I do when this comes up?

Snpm_Cluster_2
0todd0000 commented 2 years ago

Try moving the print statement into the if statement like this:

if len( snpmi.clusters ) > 0:
    cluster = snpmi.clusters[0]
    print( cluster )
EmblaJ commented 2 years ago

Great, it works now. Thank you!