[python-dtcwt] 89/497: add perfect reconstruction test for integer input
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:52 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 afc53eac302fa14670c85de706785df51f75f1dd
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Fri Aug 9 13:26:14 2013 +0100
add perfect reconstruction test for integer input
---
tests/testxfm1.py | 8 ++++++++
tests/testxfm2.py | 10 +++++++++-
tests/testxfm3.py | 8 ++++++++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/testxfm1.py b/tests/testxfm1.py
index 0d709eb..d45d62e 100644
--- a/tests/testxfm1.py
+++ b/tests/testxfm1.py
@@ -57,4 +57,12 @@ def test_integer_input():
Yl, Yh = dtwavexfm([1,2,3,4])
assert np.any(Yl != 0)
+def test_integer_perfect_recon():
+ # Check that an integer input is correctly coerced into a floating point
+ # array and reconstructed
+ A = np.array([1,2,3,4], dtype=np.int32)
+ Yl, Yh = dtwavexfm(A)
+ B = dtwaveifm(Yl, Yh)
+ assert np.max(np.abs(A-B)) < 1e-12
+
# vim:sw=4:sts=4:et
diff --git a/tests/testxfm2.py b/tests/testxfm2.py
index dbf05b4..c5f64d5 100644
--- a/tests/testxfm2.py
+++ b/tests/testxfm2.py
@@ -3,7 +3,7 @@ from nose.tools import raises
from nose.plugins.attrib import attr
import numpy as np
-from dtcwt import dtwavexfm2, biort, qshift
+from dtcwt import dtwavexfm2, dtwaveifm2, biort, qshift
def setup():
global lena
@@ -67,4 +67,12 @@ def test_integer_input():
Yl, Yh = dtwavexfm2([[1,2,3,4], [1,2,3,4]])
assert np.any(Yl != 0)
+def test_integer_perfect_recon():
+ # Check that an integer input is correctly coerced into a floating point
+ # array and reconstructed
+ A = np.array([[1,2,3,4], [5,6,7,8]], dtype=np.int32)
+ Yl, Yh = dtwavexfm2(A)
+ B = dtwaveifm2(Yl, Yh)
+ assert np.max(np.abs(A-B)) < 1e-5
+
# vim:sw=4:sts=4:et
diff --git a/tests/testxfm3.py b/tests/testxfm3.py
index 5149acb..cca6070 100644
--- a/tests/testxfm3.py
+++ b/tests/testxfm3.py
@@ -128,4 +128,12 @@ def test_integer_input():
Yl, Yh = dtwavexfm3(np.ones((4,4,4), dtype=np.int))
assert np.any(Yl != 0)
+def test_integer_perfect_recon():
+ # Check that an integer input is correctly coerced into a floating point
+ # array and reconstructed
+ A = (np.random.random((4,4,4)) * 5).astype(np.int32)
+ Yl, Yh = dtwavexfm3(A)
+ B = dtwaveifm3(Yl, Yh)
+ assert np.max(np.abs(A-B)) < 1e-12
+
# 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