[python-dtcwt] 06/38: remove last reference to lena in examples and scripts
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 d33e32504ff1b475aec6160d3c58c08c712c714d
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Mon Aug 3 12:10:04 2015 +0100
remove last reference to lena in examples and scripts
---
examples/resampling_highpass_coefficients.py | 44 ++++++++++++++--------------
scripts/benchmark_opencl.py | 44 ++++++++++++++--------------
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/examples/resampling_highpass_coefficients.py b/examples/resampling_highpass_coefficients.py
index 36c7e8e..a781e56 100644
--- a/examples/resampling_highpass_coefficients.py
+++ b/examples/resampling_highpass_coefficients.py
@@ -16,17 +16,17 @@ matplotlib.use('agg')
import numpy as np
from matplotlib.pyplot import *
-# Get a copy of the famous 'lena' image. In the default dtcwt tree, we ship
-# one with the tests. The lena image is 512x512, floating point and has pixel
+# Get a copy of the famous 'mandrill' image. In the default dtcwt tree, we ship
+# one with the tests. The mandrill image is 512x512, floating point and has pixel
# values on the interval (0, 1].
-lena = np.load(
- os.path.join(os.path.dirname(__file__), '..', 'tests', 'lena.npz')
-)['lena']
+mandrill = np.load(
+ os.path.join(os.path.dirname(__file__), '..', 'tests', 'mandrill.npz')
+)['mandrill']
# Chop a window out
-lena = lena[224:288,224:288]
+mandrill = mandrill[224:288,224:288]
-# We will try to re-scale lena by this amount and method
+# We will try to re-scale mandrill by this amount and method
scale = 1.2
scale_method = 'lanczos'
@@ -38,44 +38,44 @@ def scale_highpass(im):
"""Scale image assuming it to be wavelet highpass coefficients."""
return dtcwt.sampling.scale_highpass(im, (im.shape[0]*scale, im.shape[1]*scale), scale_method)
-# Rescale lena directly using default (Lanczos) sampling
-lena_direct = scale_direct(lena)
+# Rescale mandrill directly using default (Lanczos) sampling
+mandrill_direct = scale_direct(mandrill)
-# Transform lena
-lena_l, lena_h = dtcwt.compat.dtwavexfm2(lena, nlevels=4)
+# Transform mandrill
+mandrill_l, mandrill_h = dtcwt.compat.dtwavexfm2(mandrill, nlevels=4)
# Re-scale each component and transform back. Do this both with and without
# shifting back to DC.
-lena_l = scale_direct(lena_l)
-lena_h_a, lena_h_b = [], []
+mandrill_l = scale_direct(mandrill_l)
+mandrill_h_a, mandrill_h_b = [], []
-for h in lena_h:
- lena_h_a.append(scale_direct(h))
- lena_h_b.append(scale_highpass(h))
+for h in mandrill_h:
+ mandrill_h_a.append(scale_direct(h))
+ mandrill_h_b.append(scale_highpass(h))
# Transform back
-lena_a = dtcwt.compat.dtwaveifm2(lena_l, lena_h_a)
-lena_b = dtcwt.compat.dtwaveifm2(lena_l, lena_h_b)
+mandrill_a = dtcwt.compat.dtwaveifm2(mandrill_l, mandrill_h_a)
+mandrill_b = dtcwt.compat.dtwaveifm2(mandrill_l, mandrill_h_b)
figure(figsize=(10,10))
subplot(2,2,1)
-imshow(lena, cmap=cm.gray, clim=(0,1), interpolation='none')
+imshow(mandrill, cmap=cm.gray, clim=(0,1), interpolation='none')
axis('off')
title('Original')
subplot(2,2,2)
-imshow(lena_direct, cmap=cm.gray, clim=(0,1), interpolation='none')
+imshow(mandrill_direct, cmap=cm.gray, clim=(0,1), interpolation='none')
axis('off')
title('Directly up-sampled')
subplot(2,2,3)
-imshow(lena_a, cmap=cm.gray, clim=(0,1), interpolation='none')
+imshow(mandrill_a, cmap=cm.gray, clim=(0,1), interpolation='none')
axis('off')
title('Up-sampled in the wavelet domain')
subplot(2,2,4)
-imshow(lena_b, cmap=cm.gray, clim=(0,1), interpolation='none')
+imshow(mandrill_b, cmap=cm.gray, clim=(0,1), interpolation='none')
axis('off')
title('Up-sampled in the wavelet domain with shifting')
diff --git a/scripts/benchmark_opencl.py b/scripts/benchmark_opencl.py
index 45fda79..4b32368 100644
--- a/scripts/benchmark_opencl.py
+++ b/scripts/benchmark_opencl.py
@@ -14,7 +14,7 @@ import numpy as np
from dtcwt.coeffs import biort, qshift
from dtcwt.opencl.lowlevel import NoCLPresentError, get_default_queue
-lena = np.load(os.path.join(os.path.dirname(__file__), '..', 'tests', 'lena.npz'))['lena']
+mandrill = np.load(os.path.join(os.path.dirname(__file__), '..', 'tests', 'mandrill.npz'))['mandrill']
h0o, g0o, h1o, g1o = biort('near_sym_b')
h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
@@ -32,7 +32,7 @@ def format_time(t):
def benchmark(statement='pass', setup='pass'):
number, repeat = (1, 3)
min_time = 0
-
+
try:
while min_time < 0.2:
number *= 10
@@ -55,47 +55,47 @@ def main():
print('Skipping OpenCL benchmark since OpenCL is not present')
print('Running NumPy colfilter...')
- a = benchmark('colfilter(lena, h1o)',
- 'from dtcwt.numpy.lowlevel import colfilter; from __main__ import lena, h1o')
+ a = benchmark('colfilter(mandrill, h1o)',
+ 'from dtcwt.numpy.lowlevel import colfilter; from __main__ import mandrill, h1o')
print('Running OpenCL colfilter...')
- b = benchmark('colfilter(lena, h1o)',
- 'from dtcwt.opencl.lowlevel import colfilter; from __main__ import lena, h1o')
+ b = benchmark('colfilter(mandrill, h1o)',
+ 'from dtcwt.opencl.lowlevel import colfilter; from __main__ import mandrill, h1o')
print('Speed up: x{0:.2f}'.format(a/b))
print('=====')
print('Running NumPy coldfilt...')
- a = benchmark('coldfilt(lena, h0b, h0a)',
- 'from dtcwt.numpy.lowlevel import coldfilt; from __main__ import lena, h0b, h0a')
+ a = benchmark('coldfilt(mandrill, h0b, h0a)',
+ 'from dtcwt.numpy.lowlevel import coldfilt; from __main__ import mandrill, h0b, h0a')
print('Running OpenCL coldfilt...')
- b = benchmark('coldfilt(lena, h0b, h0a)',
- 'from dtcwt.opencl.lowlevel import coldfilt; from __main__ import lena, h0b, h0a')
+ b = benchmark('coldfilt(mandrill, h0b, h0a)',
+ 'from dtcwt.opencl.lowlevel import coldfilt; from __main__ import mandrill, h0b, h0a')
print('Speed up: x{0:.2f}'.format(a/b))
print('=====')
print('Running NumPy colifilt...')
- a = benchmark('colifilt(lena, h0b, h0a)',
- 'from dtcwt.numpy.lowlevel import colifilt; from __main__ import lena, h0b, h0a')
+ a = benchmark('colifilt(mandrill, h0b, h0a)',
+ 'from dtcwt.numpy.lowlevel import colifilt; from __main__ import mandrill, h0b, h0a')
print('Running OpenCL colifilt...')
- b = benchmark('colifilt(lena, h0b, h0a)',
- 'from dtcwt.opencl.lowlevel import colifilt; from __main__ import lena, h0b, h0a')
+ b = benchmark('colifilt(mandrill, h0b, h0a)',
+ 'from dtcwt.opencl.lowlevel import colifilt; from __main__ import mandrill, h0b, h0a')
print('Speed up: x{0:.2f}'.format(a/b))
print('=====')
print('Running NumPy dtwavexfm2...')
- a = benchmark('dtwavexfm2(lena)',
- 'from dtcwt.compat import dtwavexfm2; from __main__ import lena')
+ a = benchmark('dtwavexfm2(mandrill)',
+ 'from dtcwt.compat import dtwavexfm2; from __main__ import mandrill')
print('Running OpenCL dtwavexfm2...')
- b = benchmark('dtwavexfm2(lena)',
- 'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import lena')
+ b = benchmark('dtwavexfm2(mandrill)',
+ 'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import mandrill')
print('Speed up: x{0:.2f}'.format(a/b))
print('=====')
print('Running NumPy dtwavexfm2 (non-POT)...')
- a = benchmark('dtwavexfm2(lena[:510,:480])',
- 'from dtcwt.compat import dtwavexfm2; from __main__ import lena')
+ a = benchmark('dtwavexfm2(mandrill[:510,:480])',
+ 'from dtcwt.compat import dtwavexfm2; from __main__ import mandrill')
print('Running OpenCL dtwavexfm2 (non-POT)...')
- b = benchmark('dtwavexfm2(lena[:510,:480])',
- 'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import lena')
+ b = benchmark('dtwavexfm2(mandrill[:510,:480])',
+ 'from dtcwt.opencl.transform2d import dtwavexfm2; from __main__ import mandrill')
print('Speed up: x{0:.2f}'.format(a/b))
print('=====')
--
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