[python-dtcwt] 02/38: replace use of Lena image with mandrill
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Mar 8 11:39:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository python-dtcwt.
commit 309f5494d1d7c17a770d571d62efe5dd4b28449a
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Mon Aug 3 12:01:15 2015 +0100
replace use of Lena image with mandrill
Re-generate verification data using the mandrill image and replace use in test
suite and dtcwt.plotting.
It turns out that Lena is non-Debian friendly.
---
dtcwt/plotting.py | 10 +++----
matlab/gen_verif.m | 24 ++++++++--------
matlab/mandrill.mat | Bin 0 -> 341820 bytes
matlab/verif_m_to_npz.py | 44 ++++++++++++++---------------
tests/datasets.py | 6 ++--
tests/mandrill.npz | Bin 0 -> 341854 bytes
tests/qbgn.npz | Bin 652796 -> 652802 bytes
tests/testagainstmatlab.py | 50 ++++++++++++++++----------------
tests/testcoldfilt.py | 28 +++++++++---------
tests/testcolfilter.py | 48 +++++++++++++++----------------
tests/testcolifilt.py | 40 +++++++++++++-------------
tests/testifm2.py | 40 +++++++++++++-------------
tests/testopenclcoldfilt.py | 46 +++++++++++++++---------------
tests/testopenclcolfilter.py | 64 ++++++++++++++++++++---------------------
tests/testopenclcolifilt.py | 66 +++++++++++++++++++++----------------------
tests/testopenclxfm2.py | 48 +++++++++++++++----------------
tests/testxfm2.py | 48 +++++++++++++++----------------
tests/verification.npz | Bin 4293123 -> 4293548 bytes
18 files changed, 281 insertions(+), 281 deletions(-)
diff --git a/dtcwt/plotting.py b/dtcwt/plotting.py
index d46882e..3017c55 100644
--- a/dtcwt/plotting.py
+++ b/dtcwt/plotting.py
@@ -38,12 +38,12 @@ def overlay_quiver(image, vectorField, level, offset):
import dtcwt
import dtcwt.plotting as plotting
- lena = datasets.lena()
+ mandrill = datasets.mandrill()
transform2d = dtcwt.Transform2d()
- lena_t = transform2d.forward(lena, nlevels=5)
+ mandrill_t = transform2d.forward(mandrill, nlevels=5)
- plotting.overlay_quiver(lena*255, lena_t.highpasses[-1], 5, 0.5)
+ plotting.overlay_quiver(mandrill*255, mandrill_t.highpasses[-1], 5, 0.5)
.. codeauthor:: R. Anderson, 2005 (MATLAB)
.. codeauthor:: S. C. Forshaw, 2014 (Python)
@@ -51,7 +51,7 @@ def overlay_quiver(image, vectorField, level, offset):
# Make sure imshow() uses the full range of greyscale values
imshow(image, cmap=cm.gray, clim=(0,255))
hold(True)
-
+
# Set up the grid for the quiver plot
g1 = np.kron(np.arange(0, vectorField[:,:,0].shape[0]).T, np.ones((1,vectorField[:,:,0].shape[1])))
g2 = np.kron(np.ones((vectorField[:,:,0].shape[0], 1)), np.arange(0, vectorField[:,:,0].shape[1]))
@@ -60,7 +60,7 @@ def overlay_quiver(image, vectorField, level, offset):
cmap = cm.spectral
scalefactor = np.max(np.max(np.max(np.max(np.abs(vectorField)))))
vectorField[-1,-1,:] = scalefactor
-
+
for sb in range(0, vectorField.shape[2]):
hold(True)
thiscolour = cmap(sb / float(vectorField.shape[2])) # Select colour for this subband
diff --git a/matlab/gen_verif.m b/matlab/gen_verif.m
index bfcf285..36e0139 100644
--- a/matlab/gen_verif.m
+++ b/matlab/gen_verif.m
@@ -15,9 +15,9 @@ strFilePath=[fileparts(which(mfilename('fullpath'))) '/'];
addpath([strFilePath 'qbgn/']);
addpath(genpath([strFilePath 'toolboxes/']));
-%% Load Lena image
-inputs = load('lena.mat');
-lena = inputs.lena;
+%% Load mandrill image
+inputs = load('mandrill.mat');
+mandrill = inputs.mandrill;
near_sym_b = load('near_sym_b');
qshift_d = load('qshift_d');
@@ -25,22 +25,22 @@ qshift_d = load('qshift_d');
h1a = qshift_d.h1a;
h1b = flipud(h1a);
-lena_coldfilt = coldfilt(lena, h1b, h1a);
+mandrill_coldfilt = coldfilt(mandrill, h1b, h1a);
g0a = qshift_d.g0a;
g0b = flipud(g0a);
-lena_colifilt = colifilt(lena, g0b, g0a);
+mandrill_colifilt = colifilt(mandrill, g0b, g0a);
-[lena_Yl, lena_Yh, lena_Yscale] = dtwavexfm2(lena, 4, 'near_sym_a', 'qshift_a');
+[mandrill_Yl, mandrill_Yh, mandrill_Yscale] = dtwavexfm2(mandrill, 4, 'near_sym_a', 'qshift_a');
near_sym_b_bp = load('near_sym_b_bp');
qshift_b_bp = load('qshift_b_bp');
-[lena_Ylb, lena_Yhb, lena_Yscaleb] = dtwavexfm2b(lena, 4, 'near_sym_b_bp', 'qshift_b_bp');
+[mandrill_Ylb, mandrill_Yhb, mandrill_Yscaleb] = dtwavexfm2b(mandrill, 4, 'near_sym_b_bp', 'qshift_b_bp');
%% 3x interpolation of highpasses
-x = lena_Yh{3};
+x = mandrill_Yh{3};
sx = size(x);
nx = sx(2)*3; ny = sx(1)*3;
scx = sx(2) / nx;
@@ -48,11 +48,11 @@ scy = sx(1) / ny;
[X, Y] = meshgrid(0.5 + ((1:nx)-0.5)*scx, 0.5 + ((1:ny)-0.5)*scy);
locs = [Y(:), X(:)];
w = [-3 -1; -3 -3; -1 -3; 1 -3; 3 -3; 3 -1]*pi/2.15;
-lena_upsample = zeros(ny, nx, 6);
+mandrill_upsample = zeros(ny, nx, 6);
for sb=1:6
tmp = zeros(ny, nx);
tmp(:) = cpxinterp2b(x(:,:,sb),locs,w(sb,:), 'linear');
- lena_upsample(:,:,sb) = tmp;
+ mandrill_upsample(:,:,sb) = tmp;
end
%% Generate quantized bandlimited gaussian noise (gbgn) phantom
@@ -65,5 +65,5 @@ qbgn_Yh = ri2c(qbgn_Yh);
save('qbgn.mat','qbgn');
-save('verification.mat', 'lena_coldfilt', 'lena_colifilt', 'lena_Yl', 'lena_Yh', 'lena_Yscale', ...
- 'lena_Ylb', 'lena_Yhb', 'lena_Yscaleb', 'lena_upsample', 'qbgn_Yl', 'qbgn_Yh', 'qbgn_Yscale');
+save('verification.mat', 'mandrill_coldfilt', 'mandrill_colifilt', 'mandrill_Yl', 'mandrill_Yh', 'mandrill_Yscale', ...
+ 'mandrill_Ylb', 'mandrill_Yhb', 'mandrill_Yscaleb', 'mandrill_upsample', 'qbgn_Yl', 'qbgn_Yh', 'qbgn_Yscale');
diff --git a/matlab/mandrill.mat b/matlab/mandrill.mat
new file mode 100644
index 0000000..9adaa07
Binary files /dev/null and b/matlab/mandrill.mat differ
diff --git a/matlab/verif_m_to_npz.py b/matlab/verif_m_to_npz.py
index 9a9c95f..0f9429e 100755
--- a/matlab/verif_m_to_npz.py
+++ b/matlab/verif_m_to_npz.py
@@ -17,12 +17,12 @@ def _mean(a, axis=None, *args, **kwargs):
def centre_indices(ndim=2,apron=8):
"""Returns the centre indices for the correct number of dimension
"""
- return tuple([slice(apron,-apron) for i in xrange(ndim)])
+ return tuple([slice(apron,-apron) for i in range(ndim)])
def summarise_mat(M, apron=8):
"""HACK to provide a 'summary' matrix consisting of the corners of the
matrix and summed versions of the sub matrices.
-
+
N.B. Keep this in sync with matlab/verif_m_to_npz.py.
"""
@@ -39,29 +39,29 @@ def summarise_cube(M, apron=4):
"""Provide a summary cube, extending summarise_mat to 3D
"""
return np.dstack(
- [summarise_mat(M[:,:,i,...], apron) for i in xrange(M.shape[-2])]
- )
-
+ [summarise_mat(M[:,:,i,...], apron) for i in range(M.shape[-2])]
+ )
+
verif_temp = loadmat('verification.mat')
-verif = dict((k,v) for k, v in verif_temp.iteritems() if (not k.startswith('_') and not k.startswith('qbgn')))
-verif_cube = dict((k,v) for k, v in verif_temp.iteritems() if (not k.startswith('_') and k.startswith('qbgn')))
+verif = dict((k,v) for k, v in verif_temp.items() if (not k.startswith('_') and not k.startswith('qbgn')))
+verif_cube = dict((k,v) for k, v in verif_temp.items() if (not k.startswith('_') and k.startswith('qbgn')))
del verif_temp
-for idx, v in enumerate(verif['lena_Yh']):
- verif['lena_Yh_{0}'.format(idx)] = v[0]
-del verif['lena_Yh']
+for idx, v in enumerate(verif['mandrill_Yh']):
+ verif['mandrill_Yh_{0}'.format(idx)] = v[0]
+del verif['mandrill_Yh']
-for idx, v in enumerate(verif['lena_Yscale']):
- verif['lena_Yscale_{0}'.format(idx)] = v[0]
-del verif['lena_Yscale']
+for idx, v in enumerate(verif['mandrill_Yscale']):
+ verif['mandrill_Yscale_{0}'.format(idx)] = v[0]
+del verif['mandrill_Yscale']
-for idx, v in enumerate(verif['lena_Yhb']):
- verif['lena_Yhb_{0}'.format(idx)] = v[0]
-del verif['lena_Yhb']
+for idx, v in enumerate(verif['mandrill_Yhb']):
+ verif['mandrill_Yhb_{0}'.format(idx)] = v[0]
+del verif['mandrill_Yhb']
-for idx, v in enumerate(verif['lena_Yscaleb']):
- verif['lena_Yscaleb_{0}'.format(idx)] = v[0]
-del verif['lena_Yscaleb']
+for idx, v in enumerate(verif['mandrill_Yscaleb']):
+ verif['mandrill_Yscaleb_{0}'.format(idx)] = v[0]
+del verif['mandrill_Yscaleb']
for idx, v in enumerate(verif_cube['qbgn_Yh']):
verif_cube['qbgn_Yh_{0}'.format(idx)] = v[0]
@@ -71,10 +71,10 @@ for idx, v in enumerate(verif_cube['qbgn_Yscale']):
verif_cube['qbgn_Yscale_{0}'.format(idx)] = v[0]
del verif_cube['qbgn_Yscale']
-summaries = dict((k, summarise_mat(v)) for k, v in verif.iteritems())
-for k,v in verif_cube.iteritems():
+summaries = dict((k, summarise_mat(v)) for k, v in verif.items())
+for k,v in verif_cube.items():
summaries[k] = summarise_cube(v)
-
+
savez_compressed('../tests/verification.npz', **summaries)
# Convert qbgn.mat -> qbgn.npz
diff --git a/tests/datasets.py b/tests/datasets.py
index 65ccf11..5a8f438 100644
--- a/tests/datasets.py
+++ b/tests/datasets.py
@@ -6,6 +6,6 @@ def regframes(name):
frames = np.load(os.path.join(os.path.dirname(__file__), name + '.npz'))
return frames['f1'], frames['f2']
-def lena():
- """Return Lena in all her glory."""
- return np.load(os.path.join(os.path.dirname(__file__), 'lena.npz'))['lena']
+def mandrill():
+ """Return the "mandrill" test image."""
+ return np.load(os.path.join(os.path.dirname(__file__), 'mandrill.npz'))['mandrill']
diff --git a/tests/mandrill.npz b/tests/mandrill.npz
new file mode 100644
index 0000000..053f204
Binary files /dev/null and b/tests/mandrill.npz differ
diff --git a/tests/qbgn.npz b/tests/qbgn.npz
index 471c851..44b3146 100644
Binary files a/tests/qbgn.npz and b/tests/qbgn.npz differ
diff --git a/tests/testagainstmatlab.py b/tests/testagainstmatlab.py
index fd73a84..09fa65d 100644
--- a/tests/testagainstmatlab.py
+++ b/tests/testagainstmatlab.py
@@ -52,67 +52,67 @@ def assert_percentile_almost_equal_to_summary_cube(a, summary, *args, **kwargs):
assert_percentile_almost_equal(summarise_cube(a), summary, *args, **kwargs)
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
global qbgn
qbgn = np.load(os.path.join(os.path.dirname(__file__), 'qbgn.npz'))['qbgn']
global verif
verif = np.load(os.path.join(os.path.dirname(__file__), 'verification.npz'))
-
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
-
-def test_lena_loaded():
+
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
+
+def test_mandrill_loaded():
assert verif is not None
- assert 'lena_coldfilt' in verif
+ assert 'mandrill_coldfilt' in verif
def test_coldfilt():
h0o, g0o, h1o, g1o = biort('near_sym_b')
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- A = coldfilt(lena, h1b, h1a)
- assert_almost_equal_to_summary(A, verif['lena_coldfilt'], tolerance=TOLERANCE)
+ A = coldfilt(mandrill, h1b, h1a)
+ assert_almost_equal_to_summary(A, verif['mandrill_coldfilt'], tolerance=TOLERANCE)
def test_coldfilt():
h0o, g0o, h1o, g1o = biort('near_sym_b')
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- A = colifilt(lena, g0b, g0a)
- assert_almost_equal_to_summary(A, verif['lena_colifilt'], tolerance=TOLERANCE)
+ A = colifilt(mandrill, g0b, g0a)
+ assert_almost_equal_to_summary(A, verif['mandrill_colifilt'], tolerance=TOLERANCE)
def test_dtwavexfm2():
- Yl, Yh, Yscale = dtwavexfm2(lena, 4, 'near_sym_a', 'qshift_a', include_scale=True)
- assert_almost_equal_to_summary(Yl, verif['lena_Yl'], tolerance=TOLERANCE)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill, 4, 'near_sym_a', 'qshift_a', include_scale=True)
+ assert_almost_equal_to_summary(Yl, verif['mandrill_Yl'], tolerance=TOLERANCE)
for idx, a in enumerate(Yh):
- assert_almost_equal_to_summary(a, verif['lena_Yh_{0}'.format(idx)], tolerance=TOLERANCE)
+ assert_almost_equal_to_summary(a, verif['mandrill_Yh_{0}'.format(idx)], tolerance=TOLERANCE)
for idx, a in enumerate(Yscale):
- assert_almost_equal_to_summary(a, verif['lena_Yscale_{0}'.format(idx)], tolerance=TOLERANCE)
+ assert_almost_equal_to_summary(a, verif['mandrill_Yscale_{0}'.format(idx)], tolerance=TOLERANCE)
def test_dtwavexfm2b():
- Yl, Yh, Yscale = dtwavexfm2b(lena, 4, 'near_sym_b_bp', 'qshift_b_bp', include_scale=True)
- assert_almost_equal_to_summary(Yl, verif['lena_Ylb'], tolerance=TOLERANCE)
+ Yl, Yh, Yscale = dtwavexfm2b(mandrill, 4, 'near_sym_b_bp', 'qshift_b_bp', include_scale=True)
+ assert_almost_equal_to_summary(Yl, verif['mandrill_Ylb'], tolerance=TOLERANCE)
for idx, a in enumerate(Yh):
- assert_almost_equal_to_summary(a, verif['lena_Yhb_{0}'.format(idx)], tolerance=TOLERANCE)
+ assert_almost_equal_to_summary(a, verif['mandrill_Yhb_{0}'.format(idx)], tolerance=TOLERANCE)
for idx, a in enumerate(Yscale):
- assert_almost_equal_to_summary(a, verif['lena_Yscaleb_{0}'.format(idx)], tolerance=TOLERANCE)
+ assert_almost_equal_to_summary(a, verif['mandrill_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')
+ Yl, Yh = dtwavexfm2b(mandrill, 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)
+ assert_percentile_almost_equal_to_summary(Xrescale, verif['mandrill_upsample'], 60, tolerance=TOLERANCE)
def test_transform3d_numpy():
transform = Transform3d(biort='near_sym_b',qshift='qshift_b')
diff --git a/tests/testcoldfilt.py b/tests/testcoldfilt.py
index 3f5dd2d..6173851 100644
--- a/tests/testcoldfilt.py
+++ b/tests/testcoldfilt.py
@@ -8,35 +8,35 @@ from nose.tools import raises
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@raises(ValueError)
def test_odd_filter():
- coldfilt(lena, (-1,2,-1), (-1,2,1))
+ coldfilt(mandrill, (-1,2,-1), (-1,2,1))
@raises(ValueError)
def test_different_size():
- coldfilt(lena, (-0.5,-1,2,1,0.5), (-1,2,-1))
+ coldfilt(mandrill, (-0.5,-1,2,1,0.5), (-1,2,-1))
@raises(ValueError)
def test_bad_input_size():
- coldfilt(lena[:511,:], (-1,1), (1,-1))
+ coldfilt(mandrill[:511,:], (-1,1), (1,-1))
def test_good_input_size():
- coldfilt(lena[:,:511], (-1,1), (1,-1))
+ coldfilt(mandrill[:,:511], (-1,1), (1,-1))
def test_good_input_size_non_orthogonal():
- coldfilt(lena[:,:511], (1,1), (1,1))
+ coldfilt(mandrill[:,:511], (1,1), (1,1))
def test_output_size():
- Y = coldfilt(lena, (-1,1), (1,-1))
- assert Y.shape == (lena.shape[0]/2, lena.shape[1])
+ Y = coldfilt(mandrill, (-1,1), (1,-1))
+ assert Y.shape == (mandrill.shape[0]/2, mandrill.shape[1])
# vim:sw=4:sts=4:et
diff --git a/tests/testcolfilter.py b/tests/testcolfilter.py
index 22074f4..907ddf6 100644
--- a/tests/testcolfilter.py
+++ b/tests/testcolfilter.py
@@ -7,46 +7,46 @@ from dtcwt.numpy.lowlevel import colfilter
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
def test_odd_size():
- y = colfilter(lena, (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill, (-1,2,-1))
+ assert y.shape == mandrill.shape
def test_even_size():
- y = colfilter(lena, (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(mandrill, (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
def test_odd_size():
- y = colfilter(lena, (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill, (-1,2,-1))
+ assert y.shape == mandrill.shape
def test_qshift():
- y = colfilter(lena, qshift('qshift_a')[0])
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(mandrill, qshift('qshift_a')[0])
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
def test_biort():
- y = colfilter(lena, biort('antonini')[0])
- assert y.shape == lena.shape
+ y = colfilter(mandrill, biort('antonini')[0])
+ assert y.shape == mandrill.shape
def test_even_size():
- y = colfilter(np.zeros_like(lena), (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(np.zeros_like(mandrill), (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
assert not np.any(y[:] != 0.0)
def test_odd_size_non_array():
- y = colfilter(lena.tolist(), (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill.tolist(), (-1,2,-1))
+ assert y.shape == mandrill.shape
def test_even_size_non_array():
- y = colfilter(lena.tolist(), (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
-
+ y = colfilter(mandrill.tolist(), (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
+
# vim:sw=4:sts=4:et
diff --git a/tests/testcolifilt.py b/tests/testcolifilt.py
index 7c0262e..1696aa0 100644
--- a/tests/testcolifilt.py
+++ b/tests/testcolifilt.py
@@ -8,48 +8,48 @@ from nose.tools import raises
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@raises(ValueError)
def test_odd_filter():
- colifilt(lena, (-1,2,-1), (-1,2,1))
+ colifilt(mandrill, (-1,2,-1), (-1,2,1))
@raises(ValueError)
def test_different_size_h():
- colifilt(lena, (-1,2,1), (-0.5,-1,2,-1,0.5))
+ colifilt(mandrill, (-1,2,1), (-0.5,-1,2,-1,0.5))
def test_zero_input():
- Y = colifilt(np.zeros_like(lena), (-1,1), (1,-1))
+ Y = colifilt(np.zeros_like(mandrill), (-1,1), (1,-1))
assert np.all(Y[:0] == 0)
@raises(ValueError)
def test_bad_input_size():
- colifilt(lena[:511,:], (-1,1), (1,-1))
+ colifilt(mandrill[:511,:], (-1,1), (1,-1))
def test_good_input_size():
- colifilt(lena[:,:511], (-1,1), (1,-1))
+ colifilt(mandrill[:,:511], (-1,1), (1,-1))
def test_output_size():
- Y = colifilt(lena, (-1,1), (1,-1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
+ Y = colifilt(mandrill, (-1,1), (1,-1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
def test_non_orthogonal_input():
- Y = colifilt(lena, (1,1), (1,1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
+ Y = colifilt(mandrill, (1,1), (1,1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
def test_output_size_non_mult_4():
- Y = colifilt(lena, (-1,0,0,1), (1,0,0,-1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
+ Y = colifilt(mandrill, (-1,0,0,1), (1,0,0,-1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
def test_non_orthogonal_input_non_mult_4():
- Y = colifilt(lena, (1,0,0,1), (1,0,0,1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
+ Y = colifilt(mandrill, (1,0,0,1), (1,0,0,1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
# vim:sw=4:sts=4:et
diff --git a/tests/testifm2.py b/tests/testifm2.py
index 7232fc5..a6d0b2d 100644
--- a/tests/testifm2.py
+++ b/tests/testifm2.py
@@ -10,45 +10,45 @@ import tests.datasets as datasets
TOLERANCE = 1e-12
def setup():
- global lena, lena_crop
- lena = datasets.lena().astype(np.float64)
- lena_crop = lena[:233, :301]
+ global mandrill, mandrill_crop
+ mandrill = datasets.mandrill().astype(np.float64)
+ mandrill_crop = mandrill[:233, :301]
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float64
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float64
@attr('transform')
def test_reconstruct():
# Reconstruction up to tolerance
- Yl, Yh = dtwavexfm2(lena)
- lena_recon = dtwaveifm2(Yl, Yh)
- assert np.all(np.abs(lena_recon - lena) < TOLERANCE)
+ Yl, Yh = dtwavexfm2(mandrill)
+ mandrill_recon = dtwaveifm2(Yl, Yh)
+ assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)
@attr('transform')
def test_reconstruct_crop():
# Reconstruction up to tolerance
- Yl_crop, Yh_crop = dtwavexfm2(lena_crop)
- lena_recon = dtwaveifm2(Yl_crop, Yh_crop)[:lena_crop.shape[0], :lena_crop.shape[1]]
- assert np.all(np.abs(lena_recon - lena_crop) < TOLERANCE)
+ Yl_crop, Yh_crop = dtwavexfm2(mandrill_crop)
+ mandrill_recon = dtwaveifm2(Yl_crop, Yh_crop)[:mandrill_crop.shape[0], :mandrill_crop.shape[1]]
+ assert np.all(np.abs(mandrill_recon - mandrill_crop) < TOLERANCE)
@attr('transform')
def test_reconstruct_custom_filter():
# Reconstruction up to tolerance
- Yl, Yh = dtwavexfm2(lena, 4, biort('legall'), qshift('qshift_06'))
- lena_recon = dtwaveifm2(Yl, Yh, biort('legall'), qshift('qshift_06'))
- assert np.all(np.abs(lena_recon - lena) < TOLERANCE)
+ Yl, Yh = dtwavexfm2(mandrill, 4, biort('legall'), qshift('qshift_06'))
+ mandrill_recon = dtwaveifm2(Yl, Yh, biort('legall'), qshift('qshift_06'))
+ assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)
def test_float32_input():
# Check that an float32 input is correctly output as float32
- Yl, Yh = dtwavexfm2(lena.astype(np.float32))
+ Yl, Yh = dtwavexfm2(mandrill.astype(np.float32))
assert np.issubsctype(Yl.dtype, np.float32)
assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh))
- lena_recon = dtwaveifm2(Yl, Yh)
- assert np.issubsctype(lena_recon.dtype, np.float32)
+ mandrill_recon = dtwaveifm2(Yl, Yh)
+ assert np.issubsctype(mandrill_recon.dtype, np.float32)
# vim:sw=4:sts=4:et
diff --git a/tests/testopenclcoldfilt.py b/tests/testopenclcoldfilt.py
index f303f98..c9fd718 100644
--- a/tests/testopenclcoldfilt.py
+++ b/tests/testopenclcoldfilt.py
@@ -11,62 +11,62 @@ from .util import assert_almost_equal, skip_if_no_cl
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@raises(ValueError)
@skip_if_no_cl
def test_odd_filter():
- coldfilt(lena, (-1,2,-1), (-1,2,1))
+ coldfilt(mandrill, (-1,2,-1), (-1,2,1))
@raises(ValueError)
@skip_if_no_cl
def test_different_size():
- coldfilt(lena, (-0.5,-1,2,1,0.5), (-1,2,-1))
+ coldfilt(mandrill, (-0.5,-1,2,1,0.5), (-1,2,-1))
@raises(ValueError)
@skip_if_no_cl
def test_bad_input_size():
- coldfilt(lena[:511,:], (-1,1), (1,-1))
+ coldfilt(mandrill[:511,:], (-1,1), (1,-1))
@skip_if_no_cl
def test_real_wavelet():
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- A = coldfilt(lena[:,:511], h1b, h1a)
- B = coldfilt_gold(lena[:,:511], h1b, h1a)
+ A = coldfilt(mandrill[:,:511], h1b, h1a)
+ B = coldfilt_gold(mandrill[:,:511], h1b, h1a)
assert_almost_equal(A, B)
@skip_if_no_cl
def test_good_input_size():
- A = coldfilt(lena[:,:511], (-1,1), (1,-1))
- B = coldfilt_gold(lena[:,:511], (-1,1), (1,-1))
+ A = coldfilt(mandrill[:,:511], (-1,1), (1,-1))
+ B = coldfilt_gold(mandrill[:,:511], (-1,1), (1,-1))
assert_almost_equal(A, B)
@skip_if_no_cl
def test_good_input_size_non_orthogonal():
- A = coldfilt(lena[:,:511], (1,1), (1,1))
- B = coldfilt_gold(lena[:,:511], (1,1), (1,1))
+ A = coldfilt(mandrill[:,:511], (1,1), (1,1))
+ B = coldfilt_gold(mandrill[:,:511], (1,1), (1,1))
assert_almost_equal(A, B)
@skip_if_no_cl
def test_output_size():
- Y = coldfilt(lena, (-1,1), (1,-1))
- assert Y.shape == (lena.shape[0]/2, lena.shape[1])
+ Y = coldfilt(mandrill, (-1,1), (1,-1))
+ assert Y.shape == (mandrill.shape[0]/2, mandrill.shape[1])
- Z = coldfilt_gold(lena, (-1,1), (1,-1))
+ Z = coldfilt_gold(mandrill, (-1,1), (1,-1))
assert_almost_equal(Y, Z)
@skip_if_no_cl
def test_qshift():
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- y = coldfilt(lena, h1b, h1b)
- z = coldfilt_gold(lena, h1b, h1a)
+ y = coldfilt(mandrill, h1b, h1b)
+ z = coldfilt_gold(mandrill, h1b, h1a)
assert_almost_equal(y, z)
# This test fails but I'm not sure if that's actually a problem. I'm not
@@ -76,8 +76,8 @@ def test_qshift():
# def test_qshift_even_input():
# h1b = np.array((-0.25, 0.5, 0.5, -0.25))
# h1a = h1b[::-1]
-# y = coldfilt(lena, h1b, h1a)
-# z = coldfilt_gold(lena, h1b, h1a)
+# y = coldfilt(mandrill, h1b, h1a)
+# z = coldfilt_gold(mandrill, h1b, h1a)
# assert_almost_equal(y, z)
# vim:sw=4:sts=4:et
diff --git a/tests/testopenclcolfilter.py b/tests/testopenclcolfilter.py
index 9d9a1e5..3eb08e4 100644
--- a/tests/testopenclcolfilter.py
+++ b/tests/testopenclcolfilter.py
@@ -9,78 +9,78 @@ from .util import assert_almost_equal, skip_if_no_cl
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@skip_if_no_cl
def test_odd_size():
- y = colfilter(lena, (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill, (-1,2,-1))
+ assert y.shape == mandrill.shape
- z = colfilter_gold(lena, (-1,2,-1))
+ z = colfilter_gold(mandrill, (-1,2,-1))
assert_almost_equal(y, z)
@skip_if_no_cl
def test_even_size():
- y = colfilter(lena, (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(mandrill, (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
- z = colfilter_gold(lena, (-1,1))
+ z = colfilter_gold(mandrill, (-1,1))
assert_almost_equal(y, z)
@skip_if_no_cl
def test_odd_size():
- y = colfilter(lena, (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill, (-1,2,-1))
+ assert y.shape == mandrill.shape
- z = colfilter_gold(lena, (-1,2,-1))
+ z = colfilter_gold(mandrill, (-1,2,-1))
assert_almost_equal(y, z)
@skip_if_no_cl
def test_qshift():
- y = colfilter(lena, qshift('qshift_a')[0])
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(mandrill, qshift('qshift_a')[0])
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
- z = colfilter_gold(lena, qshift('qshift_a')[0])
+ z = colfilter_gold(mandrill, qshift('qshift_a')[0])
assert_almost_equal(y, z)
@skip_if_no_cl
def test_biort():
- y = colfilter(lena, biort('antonini')[0])
- assert y.shape == lena.shape
+ y = colfilter(mandrill, biort('antonini')[0])
+ assert y.shape == mandrill.shape
- z = colfilter_gold(lena, biort('antonini')[0])
+ z = colfilter_gold(mandrill, biort('antonini')[0])
assert_almost_equal(y, z)
@skip_if_no_cl
def test_even_size():
- y = colfilter(np.zeros_like(lena), (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(np.zeros_like(mandrill), (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
assert not np.any(y[:] != 0.0)
- z = colfilter_gold(np.zeros_like(lena), (-1,1))
+ z = colfilter_gold(np.zeros_like(mandrill), (-1,1))
assert_almost_equal(y, z)
@skip_if_no_cl
def test_odd_size_non_array():
- y = colfilter(lena.tolist(), (-1,2,-1))
- assert y.shape == lena.shape
+ y = colfilter(mandrill.tolist(), (-1,2,-1))
+ assert y.shape == mandrill.shape
- z = colfilter_gold(lena.tolist(), (-1,2,-1))
+ z = colfilter_gold(mandrill.tolist(), (-1,2,-1))
assert_almost_equal(y, z)
@skip_if_no_cl
def test_even_size_non_array():
- y = colfilter(lena.tolist(), (-1,1))
- assert y.shape == (lena.shape[0]+1, lena.shape[1])
+ y = colfilter(mandrill.tolist(), (-1,1))
+ assert y.shape == (mandrill.shape[0]+1, mandrill.shape[1])
- z = colfilter_gold(lena.tolist(), (-1,1))
+ z = colfilter_gold(mandrill.tolist(), (-1,1))
assert_almost_equal(y, z)
-
+
# vim:sw=4:sts=4:et
diff --git a/tests/testopenclcolifilt.py b/tests/testopenclcolifilt.py
index 0abf8c9..f04a58d 100644
--- a/tests/testopenclcolifilt.py
+++ b/tests/testopenclcolifilt.py
@@ -11,74 +11,74 @@ from .util import assert_almost_equal, skip_if_no_cl
import tests.datasets as datasets
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@skip_if_no_cl
@raises(ValueError)
def test_odd_filter():
- colifilt(lena, (-1,2,-1), (-1,2,1))
+ colifilt(mandrill, (-1,2,-1), (-1,2,1))
@skip_if_no_cl
@raises(ValueError)
def test_different_size_h():
- colifilt(lena, (-1,2,1), (-0.5,-1,2,-1,0.5))
+ colifilt(mandrill, (-1,2,1), (-0.5,-1,2,-1,0.5))
@skip_if_no_cl
def test_zero_input():
- Y = colifilt(np.zeros_like(lena), (-1,1), (1,-1))
+ Y = colifilt(np.zeros_like(mandrill), (-1,1), (1,-1))
assert np.all(Y[:0] == 0)
@skip_if_no_cl
@raises(ValueError)
def test_bad_input_size():
- colifilt(lena[:511,:], (-1,1), (1,-1))
+ colifilt(mandrill[:511,:], (-1,1), (1,-1))
@skip_if_no_cl
def test_good_input_size():
- Y = colifilt(lena[:,:511], (-1,1), (1,-1))
- Z = colifilt_gold(lena[:,:511], (-1,1), (1,-1))
+ Y = colifilt(mandrill[:,:511], (-1,1), (1,-1))
+ Z = colifilt_gold(mandrill[:,:511], (-1,1), (1,-1))
assert_almost_equal(Y,Z)
@skip_if_no_cl
def test_output_size():
- Y = colifilt(lena, (-1,1), (1,-1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
- Z = colifilt_gold(lena, (-1,1), (1,-1))
+ Y = colifilt(mandrill, (-1,1), (1,-1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
+ Z = colifilt_gold(mandrill, (-1,1), (1,-1))
assert_almost_equal(Y,Z)
@skip_if_no_cl
def test_non_orthogonal_input():
- Y = colifilt(lena, (1,1), (1,1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
- Z = colifilt_gold(lena, (1,1), (1,1))
+ Y = colifilt(mandrill, (1,1), (1,1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
+ Z = colifilt_gold(mandrill, (1,1), (1,1))
assert_almost_equal(Y,Z)
@skip_if_no_cl
def test_output_size_non_mult_4():
- Y = colifilt(lena, (-1,0,0,1), (1,0,0,-1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
- Z = colifilt_gold(lena, (-1,0,0,1), (1,0,0,-1))
+ Y = colifilt(mandrill, (-1,0,0,1), (1,0,0,-1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
+ Z = colifilt_gold(mandrill, (-1,0,0,1), (1,0,0,-1))
assert_almost_equal(Y,Z)
@skip_if_no_cl
def test_non_orthogonal_input_non_mult_4():
- Y = colifilt(lena, (1,0,0,1), (1,0,0,1))
- assert Y.shape == (lena.shape[0]*2, lena.shape[1])
- Z = colifilt_gold(lena, (1,0,0,1), (1,0,0,1))
+ Y = colifilt(mandrill, (1,0,0,1), (1,0,0,1))
+ assert Y.shape == (mandrill.shape[0]*2, mandrill.shape[1])
+ Z = colifilt_gold(mandrill, (1,0,0,1), (1,0,0,1))
assert_almost_equal(Y,Z)
@skip_if_no_cl
def test_qshift():
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- y = colifilt(lena, h1b, h1b)
- z = colifilt_gold(lena, h1b, h1a)
+ y = colifilt(mandrill, h1b, h1b)
+ z = colifilt_gold(mandrill, h1b, h1a)
assert_almost_equal(y, z)
# This test fails. I'm not sure if that's expected or not because it is using
@@ -89,23 +89,23 @@ def test_qshift():
# h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
# h1a = h1a[:-2]
# h1b = h1a[::-1]
-# y = colifilt(lena, h1a, h1b)
-# z = colifilt_gold(lena, h1a, h1b)
+# y = colifilt(mandrill, h1a, h1b)
+# z = colifilt_gold(mandrill, h1a, h1b)
# assert_almost_equal(y, z)
@skip_if_no_cl
def test_qshift_odd_len_input_2():
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
- y = colifilt(lena, h1a[1:-1], h1b[1:-1])
- z = colifilt_gold(lena, h1a[1:-1], h1b[1:-1])
+ y = colifilt(mandrill, h1a[1:-1], h1b[1:-1])
+ z = colifilt_gold(mandrill, h1a[1:-1], h1b[1:-1])
assert_almost_equal(y, z)
@skip_if_no_cl
def test_qshift_even_input():
h1b = np.array((-0.25, 0.5, 0.5, -0.25))
h1a = h1b[::-1]
- y = colifilt(lena, h1b, h1a)
- z = colifilt_gold(lena, h1b, h1a)
+ y = colifilt(mandrill, h1b, h1a)
+ z = colifilt_gold(mandrill, h1b, h1a)
assert_almost_equal(y, z)
# vim:sw=4:sts=4:et
diff --git a/tests/testopenclxfm2.py b/tests/testopenclxfm2.py
index 58263b1..17fa5ba 100644
--- a/tests/testopenclxfm2.py
+++ b/tests/testopenclxfm2.py
@@ -14,14 +14,14 @@ TOLERANCE = 1e-12
GOLD_TOLERANCE = 1e-5
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
def _compare_transforms(A, B):
Yl_A, Yh_A = A
@@ -33,29 +33,29 @@ def _compare_transforms(A, B):
@skip_if_no_cl
@attr('transform')
def test_simple():
- _compare_transforms(dtwavexfm2_np(lena), dtwavexfm2_cl(lena))
+ _compare_transforms(dtwavexfm2_np(mandrill), dtwavexfm2_cl(mandrill))
@skip_if_no_cl
@attr('transform')
def test_specific_wavelet():
- a = dtwavexfm2_np(lena, biort=biort('antonini'), qshift=qshift('qshift_06'))
- b = dtwavexfm2_cl(lena, biort=biort('antonini'), qshift=qshift('qshift_06'))
+ a = dtwavexfm2_np(mandrill, biort=biort('antonini'), qshift=qshift('qshift_06'))
+ b = dtwavexfm2_cl(mandrill, biort=biort('antonini'), qshift=qshift('qshift_06'))
_compare_transforms(a, b)
@skip_if_no_cl
def test_1d():
- a = dtwavexfm2_np(lena[0,:])
- b = dtwavexfm2_cl(lena[0,:])
+ a = dtwavexfm2_np(mandrill[0,:])
+ b = dtwavexfm2_cl(mandrill[0,:])
_compare_transforms(a, b)
@skip_if_no_cl
@raises(ValueError)
def test_3d():
- Yl, Yh = dtwavexfm2_cl(np.dstack((lena, lena)))
+ Yl, Yh = dtwavexfm2_cl(np.dstack((mandrill, mandrill)))
@skip_if_no_cl
def test_simple_w_scale():
- Yl, Yh, Yscale = dtwavexfm2_cl(lena, include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2_cl(mandrill, include_scale=True)
assert len(Yscale) > 0
for x in Yscale:
@@ -64,33 +64,33 @@ def test_simple_w_scale():
@skip_if_no_cl
@skip_if_no_cl
def test_odd_rows():
- a = dtwavexfm2_np(lena[:509,:])
- b = dtwavexfm2_cl(lena[:509,:])
+ a = dtwavexfm2_np(mandrill[:509,:])
+ b = dtwavexfm2_cl(mandrill[:509,:])
_compare_transforms(a, b)
@skip_if_no_cl
def test_odd_cols():
- a = dtwavexfm2_np(lena[:,:509])
- b = dtwavexfm2_cl(lena[:,:509])
+ a = dtwavexfm2_np(mandrill[:,:509])
+ b = dtwavexfm2_cl(mandrill[:,:509])
_compare_transforms(a, b)
@skip_if_no_cl
def test_odd_rows_and_cols():
- a = dtwavexfm2_np(lena[:509,:509])
- b = dtwavexfm2_cl(lena[:509,:509])
+ a = dtwavexfm2_np(mandrill[:509,:509])
+ b = dtwavexfm2_cl(mandrill[:509,:509])
_compare_transforms(a, b)
@skip_if_no_cl
def test_0_levels():
- a = dtwavexfm2_np(lena, nlevels=0)
- b = dtwavexfm2_cl(lena, nlevels=0)
+ a = dtwavexfm2_np(mandrill, nlevels=0)
+ b = dtwavexfm2_cl(mandrill, nlevels=0)
_compare_transforms(a, b)
@skip_if_no_cl
@attr('transform')
def test_modified():
- a = dtwavexfm2_np(lena, biort=biort('near_sym_b_bp'), qshift=qshift('qshift_b_bp'))
- b = dtwavexfm2_cl(lena, biort=biort('near_sym_b_bp'), qshift=qshift('qshift_b_bp'))
+ a = dtwavexfm2_np(mandrill, biort=biort('near_sym_b_bp'), qshift=qshift('qshift_b_bp'))
+ b = dtwavexfm2_cl(mandrill, biort=biort('near_sym_b_bp'), qshift=qshift('qshift_b_bp'))
_compare_transforms(a, b)
# vim:sw=4:sts=4:et
diff --git a/tests/testxfm2.py b/tests/testxfm2.py
index b51918d..7c0f18d 100644
--- a/tests/testxfm2.py
+++ b/tests/testxfm2.py
@@ -10,68 +10,68 @@ import tests.datasets as datasets
TOLERANCE = 1e-12
def setup():
- global lena
- lena = datasets.lena()
+ global mandrill
+ mandrill = datasets.mandrill()
-def test_lena_loaded():
- assert lena.shape == (512, 512)
- assert lena.min() >= 0
- assert lena.max() <= 1
- assert lena.dtype == np.float32
+def test_mandrill_loaded():
+ assert mandrill.shape == (512, 512)
+ assert mandrill.min() >= 0
+ assert mandrill.max() <= 1
+ assert mandrill.dtype == np.float32
@attr('transform')
def test_simple():
- Yl, Yh = dtwavexfm2(lena)
+ Yl, Yh = dtwavexfm2(mandrill)
@attr('transform')
def test_specific_wavelet():
- Yl, Yh = dtwavexfm2(lena, biort=biort('antonini'), qshift=qshift('qshift_06'))
+ Yl, Yh = dtwavexfm2(mandrill, biort=biort('antonini'), qshift=qshift('qshift_06'))
def test_1d():
- Yl, Yh = dtwavexfm2(lena[0,:])
+ Yl, Yh = dtwavexfm2(mandrill[0,:])
@raises(ValueError)
def test_3d():
- Yl, Yh = dtwavexfm2(np.dstack((lena, lena)))
+ Yl, Yh = dtwavexfm2(np.dstack((mandrill, mandrill)))
def test_simple_w_scale():
- Yl, Yh, Yscale = dtwavexfm2(lena, include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill, include_scale=True)
assert len(Yscale) > 0
for x in Yscale:
assert x is not None
def test_odd_rows():
- Yl, Yh = dtwavexfm2(lena[:509,:])
+ Yl, Yh = dtwavexfm2(mandrill[:509,:])
def test_odd_rows_w_scale():
- Yl, Yh, Yscale = dtwavexfm2(lena[:509,:], include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill[:509,:], include_scale=True)
def test_odd_cols():
- Yl, Yh = dtwavexfm2(lena[:,:509])
+ Yl, Yh = dtwavexfm2(mandrill[:,:509])
def test_odd_cols_w_scale():
- Yl, Yh, Yscale = dtwavexfm2(lena[:509,:509], include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill[:509,:509], include_scale=True)
def test_odd_rows_and_cols():
- Yl, Yh = dtwavexfm2(lena[:,:509])
+ Yl, Yh = dtwavexfm2(mandrill[:,:509])
def test_odd_rows_and_cols_w_scale():
- Yl, Yh, Yscale = dtwavexfm2(lena[:509,:509], include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill[:509,:509], include_scale=True)
def test_rot_symm_modified():
# This test only checks there is no error running these functions, not that they work
- Yl, Yh, Yscale = dtwavexfm2(lena, biort='near_sym_b_bp', qshift='qshift_b_bp', include_scale=True)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill, biort='near_sym_b_bp', qshift='qshift_b_bp', include_scale=True)
Z = dtwaveifm2(Yl, Yh, biort='near_sym_b_bp', qshift='qshift_b_bp')
def test_0_levels():
- Yl, Yh = dtwavexfm2(lena, nlevels=0)
- assert np.all(np.abs(Yl - lena) < TOLERANCE)
+ Yl, Yh = dtwavexfm2(mandrill, nlevels=0)
+ assert np.all(np.abs(Yl - mandrill) < TOLERANCE)
assert len(Yh) == 0
def test_0_levels_w_scale():
- Yl, Yh, Yscale = dtwavexfm2(lena, nlevels=0, include_scale=True)
- assert np.all(np.abs(Yl - lena) < TOLERANCE)
+ Yl, Yh, Yscale = dtwavexfm2(mandrill, nlevels=0, include_scale=True)
+ assert np.all(np.abs(Yl - mandrill) < TOLERANCE)
assert len(Yh) == 0
assert len(Yscale) == 0
@@ -91,7 +91,7 @@ def test_integer_perfect_recon():
def test_float32_input():
# Check that an float32 input is correctly output as float32
- Yl, Yh = dtwavexfm2(lena.astype(np.float32))
+ Yl, Yh = dtwavexfm2(mandrill.astype(np.float32))
assert np.issubsctype(Yl.dtype, np.float32)
assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh))
diff --git a/tests/verification.npz b/tests/verification.npz
index 492a82b..4627a5e 100644
Binary files a/tests/verification.npz and b/tests/verification.npz 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