[med-svn] [python-mne] 136/376: fix one more bug and make function _pval_from_histogram more readable

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:22:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

yoh pushed a commit to annotated tag v0.1
in repository python-mne.

commit 59b801f0c2de8f3f1d515923917aedf1d34b3c0e
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Tue Mar 15 13:51:53 2011 -0400

    fix one more bug and make function _pval_from_histogram more readable
---
 examples/stats/plot_cluster_1samp_test_time_frequency.py |  6 +++---
 mne/stats/cluster_level.py                               | 13 +++++--------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/examples/stats/plot_cluster_1samp_test_time_frequency.py b/examples/stats/plot_cluster_1samp_test_time_frequency.py
index 711c187..39fc9c8 100644
--- a/examples/stats/plot_cluster_1samp_test_time_frequency.py
+++ b/examples/stats/plot_cluster_1samp_test_time_frequency.py
@@ -75,10 +75,10 @@ epochs_power /= np.mean(epochs_power[:,:,times < 0], axis=2)[:,:,None]
 epochs_power -= 1.0
                                    ###############################################################################
 # Compute statistic
-threshold = 6.0
+threshold = 5.0
 T_obs, clusters, cluster_p_values, H0 = \
                    permutation_cluster_t_test(epochs_power,
-                               n_permutations=100, threshold=threshold, tail=0)
+                               n_permutations=100, threshold=threshold, tail=1)
 
 ###############################################################################
 # View time-frequency plots
@@ -92,7 +92,7 @@ pl.title('Evoked response (%s)' % ch_name)
 pl.xlabel('time (ms)')
 pl.ylabel('Magnetic Field (fT/cm)')
 pl.xlim(times[0], times[-1])
-pl.ylim(-100, 200)
+pl.ylim(-100, 250)
 
 pl.subplot(2, 1, 2)
 
diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py
index 452c85c..599da57 100644
--- a/mne/stats/cluster_level.py
+++ b/mne/stats/cluster_level.py
@@ -8,7 +8,7 @@
 
 import numpy as np
 from scipy import ndimage
-from scipy.stats import percentileofscore, ttest_1samp
+from scipy.stats import ttest_1samp
 
 from .parametric import f_oneway
 
@@ -72,17 +72,14 @@ def _pval_from_histogram(T, H0, tail):
     if not tail in [-1, 0, 1]:
         raise ValueError('invalid tail parameter')
 
-    pval = np.array([percentileofscore(H0, t) for t in T])
-
     # from pct to fraction
     if tail == -1: # up tail
-        pval =  pval / 100.0
+        pval =  np.array([np.mean(H0 <= t) for t in T])
     elif tail == 1: # low tail
-        pval = (100.0 - pval) / 100.0
+        pval = np.array([np.mean(H0 >= t) for t in T])
     elif tail == 0: # both tails
-        pval = 100.0 - pval
-        pval += np.array([percentileofscore(H0, -t) for t in T])
-        pval /= 100.0
+        pval = np.array([np.mean(H0 >= abs(t)) for t in T])
+        pval += np.array([np.mean(H0 <= -abs(t)) for t in T])
 
     return pval
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git



More information about the debian-med-commit mailing list