[med-svn] [python-mne] 202/376: ENH : faster complete_source_space_info

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:22:37 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 6b0d529d3003ad4169f68385d37c71987743d3cd
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Sun Apr 17 18:49:13 2011 -0400

    ENH : faster complete_source_space_info
---
 mne/source_space.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mne/source_space.py b/mne/source_space.py
index c224a2c..48322a1 100755
--- a/mne/source_space.py
+++ b/mne/source_space.py
@@ -234,12 +234,9 @@ def complete_source_space_info(this):
     r3 = this['rr'][this['tris'][:, 2], :]
     this['tri_cent'] = (r1 + r2 + r3) / 3.0
     this['tri_nn'] = np.cross((r2 - r1), (r3 - r1))
-
-    for p in range(this['ntri']):  # XXX : can do better
-        size = sqrt(np.sum(this['tri_nn'][p, :] ** 2))
-        this['tri_area'][p] = size / 2.0
-        this['tri_nn'][p, :] = this['tri_nn'][p, :] / size
-
+    size = np.sqrt(np.sum(this['tri_nn'] ** 2, axis=1))
+    this['tri_area'] = size / 2.0
+    this['tri_nn'] /= size[:, None]
     print '[done]'
 
     #   Selected triangles

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