[med-svn] [python-mne] 125/353: FIX : cluster problem with ndimage on some version of scipy

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:24:42 UTC 2015


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

yoh pushed a commit to tag 0.4
in repository python-mne.

commit 46faf7fe74523456979ac1403a49caf6a581637f
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Wed Mar 21 16:13:23 2012 +0100

    FIX : cluster problem with ndimage on some version of scipy
---
 mne/stats/cluster_level.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py
index a12e085..d2d873e 100755
--- a/mne/stats/cluster_level.py
+++ b/mne/stats/cluster_level.py
@@ -78,8 +78,11 @@ def _find_clusters(x, threshold, tail=0, connectivity=None):
 
         if x.ndim == 1:
             clusters = ndimage.find_objects(labels, n_labels)
-            sums = ndimage.measurements.sum(x, labels,
-                                            index=range(1, n_labels + 1))
+            if len(clusters) == 0:
+                sums = []
+            else:
+                sums = ndimage.measurements.sum(x, labels,
+                                                index=range(1, n_labels + 1))
         else:
             clusters = list()
             sums = np.empty(n_labels)
@@ -103,7 +106,7 @@ def _find_clusters(x, threshold, tail=0, connectivity=None):
                 clusters.append(c)
                 sums.append(np.sum(x[c]))
         sums = np.array(sums)
-    return clusters, sums
+    return clusters, np.atleast_1d(sums)
 
 
 def _pval_from_histogram(T, H0, tail):
@@ -340,8 +343,8 @@ def permutation_cluster_1samp_test(X, threshold=1.67, n_permutations=1000,
     clusters, cluster_stats = _find_clusters(T_obs, threshold, tail,
                                              connectivity)
 
-    parallel, my_one_1samp_permutation, _ = parallel_func(_one_1samp_permutation,
-                                                       n_jobs, verbose)
+    parallel, my_one_1samp_permutation, _ = parallel_func(
+                                _one_1samp_permutation, n_jobs, verbose)
 
     # Step 2: If we have some clusters, repeat process on permuted data
     # -------------------------------------------------------------------

-- 
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