[med-svn] [python-mne] 288/376: FIX : bug fix in cluster_level with connectivity + FIX in pval computation
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:23:07 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 da8526e8456159b6a57b0cc23f956ffbbb1c11cc
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Sun Jun 5 21:46:08 2011 -0400
FIX : bug fix in cluster_level with connectivity + FIX in pval computation
---
mne/stats/cluster_level.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py
index 5bd3e49..e95a42a 100644
--- a/mne/stats/cluster_level.py
+++ b/mne/stats/cluster_level.py
@@ -68,9 +68,16 @@ def _find_clusters(x, threshold, tail=0, connectivity=None):
mask = np.logical_and(x_in[connectivity.row], x_in[connectivity.col])
if np.sum(mask) == 0:
return [], np.empty(0)
+ mask = np.logical_and(x_in[connectivity.row], x_in[connectivity.col])
connectivity = sparse.coo_matrix((connectivity.data[mask],
(connectivity.row[mask],
- connectivity.col[mask])))
+ connectivity.col[mask])),
+ shape=connectivity.shape)
+ idx = np.where(x_in)[0]
+ data = np.ones(len(idx), dtype=connectivity.data.dtype)
+ connectivity.row = np.concatenate((connectivity.row, idx))
+ connectivity.col = np.concatenate((connectivity.col, idx))
+ connectivity.data = np.concatenate((connectivity.data, data))
_, components = cs_graph_components(connectivity)
labels = np.unique(components)
clusters = list()
@@ -95,13 +102,14 @@ def _pval_from_histogram(T, H0, tail):
# from pct to fraction
if tail == -1: # up tail
- pval = np.array([np.mean(H0 <= t) for t in T])
+ pval = np.array([np.sum(H0 <= t) for t in T])
elif tail == 1: # low tail
- pval = np.array([np.mean(H0 >= t) for t in T])
+ pval = np.array([np.sum(H0 >= t) for t in T])
elif tail == 0: # both tails
- pval = np.array([np.mean(H0 >= abs(t)) for t in T])
- pval += np.array([np.mean(H0 <= -abs(t)) for t in T])
+ pval = np.array([np.sum(H0 >= abs(t)) for t in T])
+ pval += np.array([np.sum(H0 <= -abs(t)) for t in T])
+ pval = (pval + 1.0) / (H0.size + 1.0) # the init data is one resampling
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