[python-dtcwt] 318/497: docs: construct variant figures on the fly

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:20 UTC 2015


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

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 03cd38ea30f0d61afc223ae52b8c58a772d19b75
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Sat Feb 1 12:04:37 2014 +0000

    docs: construct variant figures on the fly
---
 docs/conf.py           |   8 ++++++++
 docs/lena_error.png    | Bin 107265 -> 0 bytes
 docs/lena_no_error.png | Bin 127809 -> 0 bytes
 docs/variant.rst       |  26 +++++++++++++++-----------
 4 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index f646e46..bf8089a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -45,6 +45,7 @@ extensions = [
     'sphinx.ext.coverage',
     'sphinx.ext.mathjax',
     'matplotlib.sphinxext.ipython_directive',
+    'matplotlib.sphinxext.plot_directive',
     'IPython.sphinxext.ipython_console_highlighting',
 ]
 
@@ -257,3 +258,10 @@ texinfo_documents = [
 
 # How to display URL addresses: 'footnote', 'no', or 'inline'.
 #texinfo_show_urls = 'footnote'
+
+# -- Plotting -------------------------------------------------------------------
+plot_pre_code = '''
+from pylab import *
+import datasets
+import dtcwt
+'''
diff --git a/docs/lena_error.png b/docs/lena_error.png
deleted file mode 100644
index 2df8d2e..0000000
Binary files a/docs/lena_error.png and /dev/null differ
diff --git a/docs/lena_no_error.png b/docs/lena_no_error.png
deleted file mode 100644
index 53591a7..0000000
Binary files a/docs/lena_no_error.png and /dev/null differ
diff --git a/docs/variant.rst b/docs/variant.rst
index e639510..d988e72 100644
--- a/docs/variant.rst
+++ b/docs/variant.rst
@@ -50,35 +50,39 @@ Example
 
 Working on the Lena image, the standard 2-D DTCWT achieves perfect reconstruction:
 
-.. code-block:: console
+.. plot::
+    :include-source: true
+
+    image = datasets.lena()
 
     # Perform the standard 2-D DTCWT
-    Yl, Yh = dtcwt.dtwavexfm2(image, tfmlevel, 'near_sym_b', 'qshift_b')
+    Yl, Yh = dtcwt.dtwavexfm2(image, nlevels=4, biort='near_sym_b', qshift='qshift_b')
 
     # Perform the inverse transform
     Z = dtcwt.dtwaveifm2(Yl, Yh, biort='near_sym_b', qshift='qshift_b')
 
     # Show the error
     imshow(Z-image, cmap=cm.gray)
-
-.. figure:: lena_no_error.png
+    colorbar()
 
 The error signal appears to be just noise, which we can attribute to floating-point precision.
 
 
 Using the modified wavelets yields the following result:
 
-.. code-block:: console
+.. plot::
+    :include-source: true
+
+    image = datasets.lena()
+
+    # Perform the standard 2-D DTCWT
+    Yl, Yh = dtcwt.dtwavexfm2(image, nlevels=4, biort='near_sym_b_bp', qshift='qshift_b_bp')
 
-    # Perform the symmetry-modified 2-D DTCWT
-    Yl, Yh = dtcwt.dtwavexfm2b(image, tfmlevel, 'near_sym_b_bp', 'qshift_b_bp')
-    
     # Perform the inverse transform
-    Z = dtcwt.dtwaveifm2b(Yl, Yh, biort='near_sym_b_bp', qshift='qshift_b_bp')
+    Z = dtcwt.dtwaveifm2(Yl, Yh, biort='near_sym_b_bp', qshift='qshift_b_bp')
 
     # Show the error
     imshow(Z-image, cmap=cm.gray)
-
-.. figure:: lena_error.png
+    colorbar()
 
 As we would expect, the error is more significant, but only near 45 and 135 degree edge features.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list