[python-dtcwt] 24/497: add very biref usage section

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:45 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 350fad0a6628f4fb156cc0d1bc32bc3419dacb79
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Wed Aug 7 16:18:31 2013 +0100

    add very biref usage section
---
 docs/gettingstarted.rst |  87 ++++++++++++++++++++++++++++++++++++++++++++++++
 docs/index.rst          |  18 +++++-----
 docs/lena-1.png         | Bin 0 -> 339768 bytes
 docs/lena-2.png         | Bin 0 -> 683386 bytes
 docs/lena-3.png         | Bin 0 -> 1563887 bytes
 5 files changed, 96 insertions(+), 9 deletions(-)

diff --git a/docs/gettingstarted.rst b/docs/gettingstarted.rst
new file mode 100644
index 0000000..8d097a3
--- /dev/null
+++ b/docs/gettingstarted.rst
@@ -0,0 +1,87 @@
+Getting Started
+===============
+
+This section will guide you through installing and using the ``dtcwt`` library.
+
+Installation
+````````````
+
+Installation is based on setuptools and follows the usual conventions for a
+Python project
+
+.. code-block:: console
+
+    $ python setup.py install
+
+A minimal test suite is provided so that you may verify the code works on your
+system
+
+.. code-block:: console
+
+    $ python setup.py nosetests
+
+This will also write test-coverage information to the ``cover/`` directory.
+
+Simple usage
+````````````
+
+Once installed, you are most likely to use one of four functions:
+
+* :py:func:`dtcwt.dtwavexfm` -- 1D DT-CWT transform.
+* :py:func:`dtcwt.dtwaveifm` -- Inverse 1D DT-CWT transform.
+* :py:func:`dtcwt.dtwavexfm2` -- 2D DT-CWT transform.
+* :py:func:`dtcwt.dtwaveifm2` -- Inverse 2D DT-CWT transform.
+
+See :doc:`reference` for full details on how to call these functions. We shall
+present some simple usage below.
+
+2D transform
+------------
+
+Using the pylab environment (part of matplotlib) we can perform a simple
+example where we transform the standard 'Lena' image and show the level 2
+wavelet coefficients::
+
+    # Load the Lena image from the Internet into a StringIO object
+    from StringIO import StringIO
+    from urllib2 import urlopen
+    LENA_URL = 'http://www.ece.rice.edu/~wakin/images/lena512.pgm'
+    lena_file = StringIO(urlopen(LENA_URL).read())
+
+    # Parse the lena file and rescale to be in the range (0,1]
+    from scipy.misc import imread
+    lena = imread(lena_file) / 255.0
+
+    from matplotlib.pyplot import *
+    import numpy as np
+
+    # Show lena on the left
+    figure(1)
+    imshow(lena, cmap=cm.gray, clim=(0,1))
+
+    import dtcwt
+
+    # Compute two levels of dtcwt with the defaul wavelet family
+    Yh, Yl = dtcwt.dtwavexfm2(lena, 2)
+
+    # Show the absolute images for each direction in level 2.
+    # Note that the 2nd level has index 1 since the 1st has index 0.
+    figure(2)
+    for slice_idx in xrange(Yl[1].shape[2]):
+        subplot(2, 3, slice_idx)
+        imshow(np.abs(Yl[1][:,:,slice_idx]), cmap=cm.spectral, clim=(0, 1))
+        
+    # Show the phase images for each direction in level 2.
+    figure(3)
+    for slice_idx in xrange(Yl[1].shape[2]):
+        subplot(2, 3, slice_idx)
+        imshow(np.angle(Yl[1][:,:,slice_idx]), cmap=cm.hsv, clim=(-np.pi, np.pi))
+
+If the library is correctly installed and you also have matplotlib installed, you should see these three figures:
+
+.. image:: lena-1.png
+.. image:: lena-2.png
+.. image:: lena-3.png
+
+.. vim:sw=4:sts=4:et
+
diff --git a/docs/index.rst b/docs/index.rst
index eb91aa4..3d07591 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,23 +1,23 @@
-.. dtcwt documentation master file, created by
-   sphinx-quickstart2 on Tue Aug  6 17:24:42 2013.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
+The dtcwt library
+=================
 
-Welcome to dtcwt's documentation!
-=================================
+This library provides support for computing 1D and 2D dual-tree complex wavelet
+transforms and their inverse in Python.
 
-Contents:
+Table of Contents
+`````````````````
 
 .. toctree::
     :maxdepth: 2
 
+    gettingstarted
     reference
 
-
 Indices and tables
-==================
+``````````````````
 
 * :ref:`genindex`
 * :ref:`modindex`
 * :ref:`search`
 
+.. vim:sw=4:sts=4:et
diff --git a/docs/lena-1.png b/docs/lena-1.png
new file mode 100644
index 0000000..92d5e46
Binary files /dev/null and b/docs/lena-1.png differ
diff --git a/docs/lena-2.png b/docs/lena-2.png
new file mode 100644
index 0000000..1a07861
Binary files /dev/null and b/docs/lena-2.png differ
diff --git a/docs/lena-3.png b/docs/lena-3.png
new file mode 100644
index 0000000..02ea4df
Binary files /dev/null and b/docs/lena-3.png differ

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