[python-dtcwt] 114/497: rename scale -> rescale in sampling

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:55 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 ba88e6ef4ae6a44d5ed2f7a377236e95620739e5
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Tue Aug 20 16:39:16 2013 +0100

    rename scale -> rescale in sampling
---
 dtcwt/sampling.py     |  9 +++++----
 tests/testsampling.py | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/dtcwt/sampling.py b/dtcwt/sampling.py
index c348933..7d21dae 100644
--- a/dtcwt/sampling.py
+++ b/dtcwt/sampling.py
@@ -3,7 +3,8 @@
 """
 
 __all__ = (
-    'sample', 'sample_highpass', 'scale', 'scale_highpass',
+    'sample', 'sample_highpass',
+    'rescale', 'rescale_highpass',
     'upsample', 'upsample_highpass',
 )
 
@@ -115,7 +116,7 @@ def sample(im, xs, ys, method=None):
     
     raise NotImplementedError('Sampling method "{0}" is not implemented.'.format(method))
 
-def scale(im, shape, method=None):
+def rescale(im, shape, method=None):
     """Return a resampled version of *im* scaled to *shape*.
 
     Since the centre of pixel (x,y) has co-ordinate (x,y) the extent of *im* is
@@ -176,8 +177,8 @@ def sample_highpass(im, xs, ys, method=None):
     # re-wrap
     return _phase_image(xs, ys, False) * im_sampled
 
-def scale_highpass(im, shape, method=None):
-    """As :py:func:`sample` except that the highpass image is first phase
+def rescale_highpass(im, shape, method=None):
+    """As :py:func:`rescale` except that the highpass image is first phase
     shifted to be centred on approximately DC.
 
     """
diff --git a/tests/testsampling.py b/tests/testsampling.py
index 883b972..514e1d0 100644
--- a/tests/testsampling.py
+++ b/tests/testsampling.py
@@ -1,47 +1,47 @@
-from dtcwt.sampling import scale
+from dtcwt.sampling import rescale
 
 import numpy as np
 
-def test_scale_lanczos():
+def test_rescale_lanczos():
     # Create random 100x120 image
     X = np.random.rand(100,120)
 
     # Re size up
-    Xrs = scale(X, (300, 210), 'lanczos')
+    Xrs = rescale(X, (300, 210), 'lanczos')
     assert Xrs.shape == (300, 210)
 
     # And down
-    Xrecon = scale(Xrs, X.shape, 'lanczos')
+    Xrecon = rescale(Xrs, X.shape, 'lanczos')
     assert Xrecon.shape == X.shape
 
     # Got back roughly the same thing to within 5%?
     assert np.all(np.abs(X-Xrecon) < 5e-2)
 
-def test_scale_bilinear():
+def test_rescale_bilinear():
     # Create random 100x120 image
     X = np.random.rand(100,120)
 
     # Re size up
-    Xrs = scale(X, (300, 210), 'bilinear')
+    Xrs = rescale(X, (300, 210), 'bilinear')
     assert Xrs.shape == (300, 210)
 
     # And down
-    Xrecon = scale(Xrs, X.shape, 'bilinear')
+    Xrecon = rescale(Xrs, X.shape, 'bilinear')
     assert Xrecon.shape == X.shape
 
     # Got back roughly the same thing to within 30% (bilinear sucks)
     assert np.all(np.abs(X-Xrecon) < 3e-1)
 
-def test_scale_nearest():
+def test_rescale_nearest():
     # Create random 100x120 image
     X = np.random.rand(100,120)
 
     # Re size up
-    Xrs = scale(X, (200, 240), 'nearest')
+    Xrs = rescale(X, (200, 240), 'nearest')
     assert Xrs.shape == (200, 240)
 
     # And down
-    Xrecon = scale(Xrs, X.shape, 'nearest')
+    Xrecon = rescale(Xrs, X.shape, 'nearest')
     assert Xrecon.shape == X.shape
 
     # Got back roughly the same thing to within 1% (nearest neighbour should be exact)

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