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

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 bc6dace644a1a690cd4d72b117c3b60375cbea2e
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Thu Jul 7 13:32:48 2011 +0200

    DOC: capturing mayavi for doc generation for real
---
 doc/sphinxext/gen_rst.py                      | 12 ++++++++++--
 examples/plot_from_raw_to_epochs_to_evoked.py |  2 +-
 examples/plot_whitened_evoked_data.py         |  2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py
index 1eea660..35cb2cc 100755
--- a/doc/sphinxext/gen_rst.py
+++ b/doc/sphinxext/gen_rst.py
@@ -165,6 +165,12 @@ def generate_file_rst(fname, target_dir, src_dir, plot_gallery):
             import matplotlib.pyplot as plt
             plt.close('all')
             try:
+                from enthought.mayavi import mlab
+                mlab.close(all=True)
+            except:
+                pass
+
+            try:
                 execfile(example_file, {'pl' : plt})
                 facecolor = plt.gcf().get_facecolor() # hack to keep black bg
                 if facecolor == (0.0, 0.0, 0.0, 1.0):
@@ -174,8 +180,10 @@ def generate_file_rst(fname, target_dir, src_dir, plot_gallery):
 
                 try:
                     from enthought.mayavi import mlab
-                    mlab.savefig(image_file)
-                except Exception, e:
+                    e = mlab.get_engine()
+                    if len(e.scenes) > 0:
+                        mlab.savefig(image_file)
+                except:
                     pass
 
             except:
diff --git a/examples/plot_from_raw_to_epochs_to_evoked.py b/examples/plot_from_raw_to_epochs_to_evoked.py
index e8b37f1..0e8564f 100644
--- a/examples/plot_from_raw_to_epochs_to_evoked.py
+++ b/examples/plot_from_raw_to_epochs_to_evoked.py
@@ -40,7 +40,7 @@ picks = fiff.pick_types(raw.info, meg=False, eeg=True, stim=False, eog=True,
                                             include=include, exclude=exclude)
 # Read epochs
 epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks,
-                    baseline=(None, 0), reject=dict(eeg=40e-6, eog=150e-6))
+                    baseline=(None, 0), reject=dict(eeg=80e-6, eog=150e-6))
 evoked = epochs.average()  # average epochs and get an Evoked dataset.
 
 evoked.save('sample_audvis_eeg-ave.fif')  # save evoked data to disk
diff --git a/examples/plot_whitened_evoked_data.py b/examples/plot_whitened_evoked_data.py
index 50432f3..dff4394 100644
--- a/examples/plot_whitened_evoked_data.py
+++ b/examples/plot_whitened_evoked_data.py
@@ -38,7 +38,7 @@ exclude = raw.info['bads'] + ['EEG 053']  # bads + 1 more
 picks = fiff.pick_types(raw.info, meg=False, eeg=True, stim=False, eog=True,
                         exclude=exclude)
 epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks,
-                    baseline=(None, 0), reject=dict(eeg=40e-6, eog=150e-6))
+                    baseline=(None, 0), reject=dict(eeg=80e-6, eog=150e-6))
 evoked = epochs.average()  # average epochs and get an Evoked dataset.
 
 cov = mne.Covariance(cov_fname)

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