[python-dtcwt] 223/497: verify rescale_highpass against cpxinterp2b.m

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:07 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 5f0bafe91e41f6c9184f1b1f039f3a9d28f8347d
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Wed Dec 4 15:29:13 2013 +0000

    verify rescale_highpass against cpxinterp2b.m
---
 tests/testagainstmatlab.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/testagainstmatlab.py b/tests/testagainstmatlab.py
index da05d62..c7ad694 100644
--- a/tests/testagainstmatlab.py
+++ b/tests/testagainstmatlab.py
@@ -5,8 +5,9 @@ from nose.plugins.attrib import attr
 import numpy as np
 from dtcwt import dtwavexfm2, dtwaveifm2, dtwavexfm2b, dtwaveifm2b, biort, qshift
 from dtcwt.lowlevel import coldfilt, colifilt
+from dtcwt.sampling import rescale_highpass
 
-from .util import assert_almost_equal, summarise_mat
+from .util import assert_almost_equal, summarise_mat, assert_percentile_almost_equal
 
 ## IMPORTANT NOTE ##
 
@@ -37,6 +38,9 @@ TOLERANCE = 1e-5
 def assert_almost_equal_to_summary(a, summary, *args, **kwargs):
     assert_almost_equal(summarise_mat(a), summary, *args, **kwargs)
 
+def assert_percentile_almost_equal_to_summary(a, summary, *args, **kwargs):
+    assert_percentile_almost_equal(summarise_mat(a), summary, *args, **kwargs)
+
 def setup():
     global lena
     lena = np.load(os.path.join(os.path.dirname(__file__), 'lena.npz'))['lena']
@@ -86,4 +90,15 @@ def test_dtwavexfm2b():
     for idx, a in enumerate(Yscale):
         assert_almost_equal_to_summary(a, verif['lena_Yscaleb_{0}'.format(idx)], tolerance=TOLERANCE)
 
+def test_rescale_highpass():
+    # N.B we can only test bilinear rescaling since cpxinterb2b doesn't support Lanczos
+    Yl, Yh = dtwavexfm2b(lena, 3, 'near_sym_a', 'qshift_a')
+    X = Yh[2]
+    Xrescale = rescale_highpass(X, (X.shape[0]*3, X.shape[1]*3), 'bilinear')
+
+    # Almost equal in the rescale case is a hard thing to quantify. Due to the
+    # slight differences in interpolation method the odd pixel can very by
+    # quite an amount. Use a percentile approach to look at the bigger picture.
+    assert_percentile_almost_equal_to_summary(Xrescale, verif['lena_upsample'], 60, tolerance=TOLERANCE)
+
 # vim:sw=4:sts=4:et

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