[med-svn] [python-mne] 320/376: DOC: capturing mayavi for doc generation

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:23:15 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 31a64f7aec68bb230627abb204a92392f46bd843
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Thu Jul 7 13:13:49 2011 +0200

    DOC: capturing mayavi for doc generation
---
 doc/sphinxext/gen_rst.py                                     | 7 +++++++
 examples/{read_inverse.py => inverse/plot_read_inverse.py}   | 9 +++------
 examples/{read_bem_surfaces.py => plot_read_bem_surfaces.py} | 0
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py
index 91cf3e6..1eea660 100755
--- a/doc/sphinxext/gen_rst.py
+++ b/doc/sphinxext/gen_rst.py
@@ -171,6 +171,13 @@ def generate_file_rst(fname, target_dir, src_dir, plot_gallery):
                     plt.savefig(image_file, facecolor='black')
                 else:
                     plt.savefig(image_file)
+
+                try:
+                    from enthought.mayavi import mlab
+                    mlab.savefig(image_file)
+                except Exception, e:
+                    pass
+
             except:
                 print 80*'_'
                 print '%s is not compiling:' % fname
diff --git a/examples/read_inverse.py b/examples/inverse/plot_read_inverse.py
similarity index 89%
rename from examples/read_inverse.py
rename to examples/inverse/plot_read_inverse.py
index 2c71692..d7b2843 100644
--- a/examples/read_inverse.py
+++ b/examples/inverse/plot_read_inverse.py
@@ -9,14 +9,14 @@ Reading an inverse operator and view source space in 3D
 
 print __doc__
 
-import mne
 from mne.datasets import sample
+from mne.minimum_norm import read_inverse_operator
 
 data_path = sample.data_path('.')
 fname = data_path
 fname += '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
 
-inv = mne.read_inverse_operator(fname)
+inv = read_inverse_operator(fname)
 
 print "Method: %s" % inv['methods']
 print "fMRI prior: %s" % inv['fmri_prior']
@@ -24,9 +24,7 @@ print "Number of sources: %s" % inv['nsource']
 print "Number of channels: %s" % inv['nchan']
 
 ###############################################################################
-# Show result
-
-# 3D source space
+# Show result on 3D source space
 lh_points = inv['src'][0]['rr']
 lh_faces = inv['src'][0]['use_tris']
 rh_points = inv['src'][1]['rr']
@@ -36,4 +34,3 @@ mlab.triangular_mesh(lh_points[:, 0], lh_points[:, 1], lh_points[:, 2],
                      lh_faces)
 mlab.triangular_mesh(rh_points[:, 0], rh_points[:, 1], rh_points[:, 2],
                      rh_faces)
-mlab.show()
diff --git a/examples/read_bem_surfaces.py b/examples/plot_read_bem_surfaces.py
similarity index 100%
rename from examples/read_bem_surfaces.py
rename to examples/plot_read_bem_surfaces.py

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