[python-dtcwt] 343/497: move MATLAB-style API into dtcwt.compat module
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:24 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 60645848209bb1f34c9ccd37b2f86f9325749d89
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Thu Feb 6 23:47:24 2014 +0000
move MATLAB-style API into dtcwt.compat module
Strongly encourage use of new-style API.
---
docs/3dtransform.rst | 2 +-
docs/reference.rst | 24 ++++++++++++------------
dtcwt/__init__.py | 19 -------------------
dtcwt/coeffs.py | 3 +++
dtcwt/compat.py | 30 ++++++++++++++++++++++++++++++
dtcwt/opencl/transform2d.py | 2 +-
dtcwt/transform1d.py | 2 +-
dtcwt/transform2d.py | 2 +-
dtcwt/transform3d.py | 2 +-
examples/3d_dtcwt_directionality.py | 3 ++-
scripts/benchmark_opencl.py | 4 ++--
tests/testagainstmatlab.py | 3 ++-
tests/testcoeffs.py | 2 +-
tests/testcolfilter.py | 2 +-
tests/testifm1.py | 2 +-
tests/testifm2.py | 3 ++-
tests/testopenclcolfilter.py | 2 +-
tests/testopenclxfm2.py | 4 ++--
tests/testxfm1.py | 3 ++-
tests/testxfm2.py | 3 ++-
tests/testxfm3.py | 3 ++-
21 files changed, 70 insertions(+), 50 deletions(-)
diff --git a/docs/3dtransform.rst b/docs/3dtransform.rst
index b7145e4..d8110b6 100644
--- a/docs/3dtransform.rst
+++ b/docs/3dtransform.rst
@@ -6,7 +6,7 @@ the ``dtcwt`` library itself::
import numpy as np
from matplotlib.pyplot import *
- from dtcwt import *
+ from dtcwt.compat import *
We can demonstrate the 3D transform by generating a 64x64x64 array which
contains the image of a sphere::
diff --git a/docs/reference.rst b/docs/reference.rst
index 9dc898d..d71dec2 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -1,17 +1,8 @@
API Reference
=============
-Computing the DT-CWT
-````````````````````
-
-These functions provide API-level compatibility with MATLAB.
-
-.. note::
-
- The functionality of ``dtwavexfm2b`` and ``dtwaveifm2b`` have been folded
- into ``dtwavexfm2`` and ``dtwaveifm2``. For convenience of porting MATLAB
- scripts, the original function names are available in the :py:mod:`dtcwt`
- module as aliases but they should not be used in new code.
+Main interface
+``````````````
.. automodule:: dtcwt
:members:
@@ -53,14 +44,23 @@ Plotting functions
.. automodule:: dtcwt.plotting
:members:
+Compatibility with MATLAB
+`````````````````````````
+
+.. automodule:: dtcwt.compat
+ :members:
+
Miscellaneous and low-level support functions
`````````````````````````````````````````````
A normal user should not need to call these functions but they are documented
here just in case you do.
-.. automodule:: dtcwt.utils
+.. automodule:: dtcwt.coeffs
:members:
.. automodule:: dtcwt.lowlevel
:members:
+
+.. automodule:: dtcwt.utils
+ :members:
diff --git a/dtcwt/__init__.py b/dtcwt/__init__.py
index 70bf254..0e38839 100644
--- a/dtcwt/__init__.py
+++ b/dtcwt/__init__.py
@@ -1,26 +1,7 @@
-from .coeffs import biort, qshift
-from .transform1d import dtwavexfm, dtwaveifm
-from .transform2d import dtwavexfm2, dtwaveifm2, dtwavexfm2b, dtwaveifm2b
-from .transform3d import dtwavexfm3, dtwaveifm3
-
from .numpy import Transform2d, TransformDomainSignal, ReconstructedSignal
__all__ = [
'Transform2d',
'TransformDomainSignal',
'ReconstructedSignal',
-
- 'dtwavexfm',
- 'dtwaveifm',
-
- 'dtwavexfm2',
- 'dtwaveifm2',
- 'dtwavexfm2b',
- 'dtwaveifm2b',
-
- 'dtwavexfm3',
- 'dtwaveifm3',
-
- 'biort',
- 'qshift',
]
diff --git a/dtcwt/coeffs.py b/dtcwt/coeffs.py
index 58460cf..dfa07c9 100644
--- a/dtcwt/coeffs.py
+++ b/dtcwt/coeffs.py
@@ -1,3 +1,6 @@
+"""Functions to load standard wavelet coefficients.
+
+"""
from __future__ import absolute_import
import os
diff --git a/dtcwt/compat.py b/dtcwt/compat.py
new file mode 100644
index 0000000..eec1f09
--- /dev/null
+++ b/dtcwt/compat.py
@@ -0,0 +1,30 @@
+"""Functions for compatibility with MATLAB scripts. These functions are
+intentionally similar in name and behaviour to the original functions from the
+DTCWT MATLAB toolbox. They are included in the library to ease the porting of
+MATLAB scripts but shouldn't be used in new projects.
+
+.. note::
+
+ The functionality of ``dtwavexfm2b`` and ``dtwaveifm2b`` has been folded
+ into ``dtwavexfm2`` and ``dtwaveifm2``. For convenience of porting MATLAB
+ scripts, the original function names are available in the :py:mod:`dtcwt`
+ module as aliases but they should not be used in new code.
+
+"""
+from dtcwt.transform1d import dtwavexfm, dtwaveifm
+from dtcwt.transform2d import dtwavexfm2, dtwaveifm2, dtwavexfm2b, dtwaveifm2b
+from dtcwt.transform3d import dtwavexfm3, dtwaveifm3
+
+__all__ = [
+ 'dtwavexfm',
+ 'dtwaveifm',
+
+ 'dtwavexfm2',
+ 'dtwaveifm2',
+ 'dtwavexfm2b',
+ 'dtwaveifm2b',
+
+ 'dtwavexfm3',
+ 'dtwaveifm3',
+]
+
diff --git a/dtcwt/opencl/transform2d.py b/dtcwt/opencl/transform2d.py
index 54d2a54..121e729 100644
--- a/dtcwt/opencl/transform2d.py
+++ b/dtcwt/opencl/transform2d.py
@@ -4,7 +4,7 @@ import logging
import numpy as np
from six.moves import xrange
-from dtcwt import biort as _biort, qshift as _qshift
+from dtcwt.coeffs import biort as _biort, qshift as _qshift
from dtcwt.defaults import DEFAULT_BIORT, DEFAULT_QSHIFT
from dtcwt.utils import appropriate_complex_type_for, asfarray, memoize
from dtcwt.opencl.lowlevel import colfilter, coldfilt, colifilt
diff --git a/dtcwt/transform1d.py b/dtcwt/transform1d.py
index 7985918..6bb74a6 100644
--- a/dtcwt/transform1d.py
+++ b/dtcwt/transform1d.py
@@ -5,7 +5,7 @@ import logging
from six.moves import xrange
-from dtcwt import biort as _biort, qshift as _qshift
+from dtcwt.coeffs import biort as _biort, qshift as _qshift
from dtcwt.defaults import DEFAULT_BIORT, DEFAULT_QSHIFT
from dtcwt.lowlevel import colfilter, coldfilt, colifilt
from dtcwt.utils import as_column_vector, asfarray
diff --git a/dtcwt/transform2d.py b/dtcwt/transform2d.py
index 74208ee..c2b26a8 100644
--- a/dtcwt/transform2d.py
+++ b/dtcwt/transform2d.py
@@ -5,7 +5,7 @@ import logging
from six.moves import xrange
-from dtcwt import biort as _biort, qshift as _qshift
+from dtcwt.coeffs import biort as _biort, qshift as _qshift
from dtcwt.defaults import DEFAULT_BIORT, DEFAULT_QSHIFT
from dtcwt.lowlevel import colfilter, coldfilt, colifilt
from dtcwt.utils import appropriate_complex_type_for, asfarray
diff --git a/dtcwt/transform3d.py b/dtcwt/transform3d.py
index 9102f99..0f233f4 100644
--- a/dtcwt/transform3d.py
+++ b/dtcwt/transform3d.py
@@ -5,7 +5,7 @@ import logging
from six.moves import xrange
-from dtcwt import biort as _biort, qshift as _qshift
+from dtcwt.coeffs import biort as _biort, qshift as _qshift
from dtcwt.defaults import DEFAULT_BIORT, DEFAULT_QSHIFT
from dtcwt.lowlevel import colfilter, coldfilt, colifilt
from dtcwt.utils import asfarray
diff --git a/examples/3d_dtcwt_directionality.py b/examples/3d_dtcwt_directionality.py
index 7142f8e..ca45be2 100644
--- a/examples/3d_dtcwt_directionality.py
+++ b/examples/3d_dtcwt_directionality.py
@@ -16,7 +16,8 @@ from matplotlib.pyplot import *
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
-from dtcwt import dtwavexfm3, dtwaveifm3, biort, qshift
+from dtcwt.compat import dtwavexfm3, dtwaveifm3
+from dtcwt.coeffs import biort, qshift
# Specify details about sphere and grid size
GRID_SIZE = 128
diff --git a/scripts/benchmark_opencl.py b/scripts/benchmark_opencl.py
index b9db840..d6e3fef 100644
--- a/scripts/benchmark_opencl.py
+++ b/scripts/benchmark_opencl.py
@@ -84,7 +84,7 @@ def main():
print('Running NumPy dtwavexfm2...')
a = benchmark('dtwavexfm2(lena)',
- 'from dtcwt import dtwavexfm2; from __main__ import lena')
+ 'from dtcwt.compat import dtwavexfm2; from __main__ import lena')
print('Running OpenCL dtwavexfm2...')
b = benchmark('dtwavexfm2(lena)',
'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import lena')
@@ -93,7 +93,7 @@ def main():
print('Running NumPy dtwavexfm2 (non-POT)...')
a = benchmark('dtwavexfm2(lena[:510,:480])',
- 'from dtcwt import dtwavexfm2; from __main__ import lena')
+ 'from dtcwt.compat import dtwavexfm2; from __main__ import lena')
print('Running OpenCL dtwavexfm2 (non-POT)...')
b = benchmark('dtwavexfm2(lena[:510,:480])',
'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import lena')
diff --git a/tests/testagainstmatlab.py b/tests/testagainstmatlab.py
index 175709e..14c7231 100644
--- a/tests/testagainstmatlab.py
+++ b/tests/testagainstmatlab.py
@@ -3,7 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm2, dtwaveifm2, dtwavexfm2b, dtwaveifm2b, biort, qshift
+from dtcwt.compat import dtwavexfm2, dtwaveifm2, dtwavexfm2b, dtwaveifm2b
+from dtcwt.coeffs import biort, qshift
from dtcwt.lowlevel import coldfilt, colifilt
from dtcwt.sampling import rescale_highpass
diff --git a/tests/testcoeffs.py b/tests/testcoeffs.py
index 36e2719..186be3b 100644
--- a/tests/testcoeffs.py
+++ b/tests/testcoeffs.py
@@ -1,4 +1,4 @@
-from dtcwt import biort, qshift
+from dtcwt.coeffs import biort, qshift
from nose.tools import raises
diff --git a/tests/testcolfilter.py b/tests/testcolfilter.py
index 37e900b..9241788 100644
--- a/tests/testcolfilter.py
+++ b/tests/testcolfilter.py
@@ -1,7 +1,7 @@
import os
import numpy as np
-from dtcwt import biort, qshift
+from dtcwt.coeffs import biort, qshift
from dtcwt.lowlevel import colfilter
import tests.datasets as datasets
diff --git a/tests/testifm1.py b/tests/testifm1.py
index d208e98..0e10d1d 100644
--- a/tests/testifm1.py
+++ b/tests/testifm1.py
@@ -3,7 +3,7 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm, dtwaveifm
+from dtcwt.compat import dtwavexfm, dtwaveifm
TOLERANCE = 1e-12
diff --git a/tests/testifm2.py b/tests/testifm2.py
index 37bf3fd..7232fc5 100644
--- a/tests/testifm2.py
+++ b/tests/testifm2.py
@@ -3,7 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm2, dtwaveifm2, biort, qshift
+from dtcwt.compat import dtwavexfm2, dtwaveifm2
+from dtcwt.coeffs import biort, qshift
import tests.datasets as datasets
TOLERANCE = 1e-12
diff --git a/tests/testopenclcolfilter.py b/tests/testopenclcolfilter.py
index d5c969b..be3660a 100644
--- a/tests/testopenclcolfilter.py
+++ b/tests/testopenclcolfilter.py
@@ -1,7 +1,7 @@
import os
import numpy as np
-from dtcwt import biort, qshift
+from dtcwt.coeffs import biort, qshift
from dtcwt.opencl.lowlevel import colfilter
from dtcwt.lowlevel import colfilter as colfilter_gold
diff --git a/tests/testopenclxfm2.py b/tests/testopenclxfm2.py
index 8e9d5b6..58263b1 100644
--- a/tests/testopenclxfm2.py
+++ b/tests/testopenclxfm2.py
@@ -3,8 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import biort, qshift
-from dtcwt import dtwavexfm2 as dtwavexfm2_np, dtwaveifm2
+from dtcwt.coeffs import biort, qshift
+from dtcwt.compat import dtwavexfm2 as dtwavexfm2_np, dtwaveifm2
from dtcwt.opencl.transform2d import dtwavexfm2 as dtwavexfm2_cl
from .util import assert_almost_equal, skip_if_no_cl
diff --git a/tests/testxfm1.py b/tests/testxfm1.py
index 15265ed..0832186 100644
--- a/tests/testxfm1.py
+++ b/tests/testxfm1.py
@@ -3,7 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm, dtwaveifm, biort, qshift
+from dtcwt.compat import dtwavexfm, dtwaveifm
+from dtcwt.coeffs import biort, qshift
TOLERANCE = 1e-12
diff --git a/tests/testxfm2.py b/tests/testxfm2.py
index 7867ddd..b51918d 100644
--- a/tests/testxfm2.py
+++ b/tests/testxfm2.py
@@ -3,7 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm2, dtwaveifm2, biort, qshift
+from dtcwt.compat import dtwavexfm2, dtwaveifm2
+from dtcwt.coeffs import biort, qshift
import tests.datasets as datasets
TOLERANCE = 1e-12
diff --git a/tests/testxfm3.py b/tests/testxfm3.py
index 08569ab..372b253 100644
--- a/tests/testxfm3.py
+++ b/tests/testxfm3.py
@@ -3,7 +3,8 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm3, dtwaveifm3, biort, qshift
+from dtcwt.compat import dtwavexfm3, dtwaveifm3
+from dtcwt.coeffs import biort, qshift
GRID_SIZE=32
SPHERE_RAD=0.4 * GRID_SIZE
--
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