[python-dtcwt] 351/497: rename Pyramid.subbands -> Pytamid.highpasses
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:25 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 75326692c90386ef7bbd20174134e729d6f12910
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Fri Feb 7 14:25:21 2014 +0000
rename Pyramid.subbands -> Pytamid.highpasses
The higpasses attribute is a sequence of highpass, each slice of which
is a subband. Fix the incorrect terminology before it gets worse.
---
docs/2dtransform.rst | 8 ++++----
docs/3dtransform.rst | 4 ++--
docs/backends.rst | 2 +-
docs/examples.rst | 4 ++--
dtcwt/keypoint.py | 20 ++++++++++----------
dtcwt/numpy/transform2d.py | 14 +++++++-------
dtcwt/opencl/transform2d.py | 18 +++++++++---------
dtcwt/plotting.py | 2 +-
dtcwt/registration.py | 34 +++++++++++++++++-----------------
dtcwt/sampling.py | 2 +-
dtcwt/transform2d.py | 4 ++--
matlab/gen_verif.m | 2 +-
tests/testxfm3.py | 2 +-
13 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/docs/2dtransform.rst b/docs/2dtransform.rst
index 528805c..63de4ec 100644
--- a/docs/2dtransform.rst
+++ b/docs/2dtransform.rst
@@ -24,13 +24,13 @@ wavelet coefficients:
# Show the absolute images for each direction in level 2.
# Note that the 2nd level has index 1 since the 1st has index 0.
figure(2)
- for slice_idx in range(lena_t.subbands[1].shape[2]):
+ for slice_idx in range(lena_t.highpasses[1].shape[2]):
subplot(2, 3, slice_idx)
- imshow(np.abs(lena_t.subbands[1][:,:,slice_idx]), cmap=cm.spectral, clim=(0, 1))
+ imshow(np.abs(lena_t.highpasses[1][:,:,slice_idx]), cmap=cm.spectral, clim=(0, 1))
# Show the phase images for each direction in level 2.
figure(3)
- for slice_idx in range(lena_t.subbands[1].shape[2]):
+ for slice_idx in range(lena_t.highpasses[1].shape[2]):
subplot(2, 3, slice_idx)
- imshow(np.angle(lena_t.subbands[1][:,:,slice_idx]), cmap=cm.hsv, clim=(-np.pi, np.pi))
+ imshow(np.angle(lena_t.highpasses[1][:,:,slice_idx]), cmap=cm.hsv, clim=(-np.pi, np.pi))
diff --git a/docs/3dtransform.rst b/docs/3dtransform.rst
index d8110b6..fe50656 100644
--- a/docs/3dtransform.rst
+++ b/docs/3dtransform.rst
@@ -35,8 +35,8 @@ subband coefficients::
>>> print(Yl.shape)
(16, 16, 16)
- >>> for subbands in Yh:
- ... print(subbands.shape)
+ >>> for highpasses in Yh:
+ ... print(highpasses.shape)
(32, 32, 32, 28)
(16, 16, 16, 28)
(8, 8, 8, 28)
diff --git a/docs/backends.rst b/docs/backends.rst
index 3e11be6..ae871da 100644
--- a/docs/backends.rst
+++ b/docs/backends.rst
@@ -56,7 +56,7 @@ example, to compute the 2D DT-CWT of the 2D real array in *X*::
>>> trans = Transform2d() # You may optionally specify which wavelets to use here
>>> Y = trans.forward(X, nlevels=4) # Perform a 4-level transform of X
>>> imshow(Y.lowpass) # Show coarsest scale low-pass image
- >>> imshow(Y.subbands[-1][:,:,0]) # Show first coarsest scale subband
+ >>> imshow(Y.highpasses[-1][:,:,0]) # Show first coarsest scale subband
In this case *Y* is an instance of a class which behaves like
:py:class:`dtcwt.Pyramid`. Backends are free to
diff --git a/docs/examples.rst b/docs/examples.rst
index 8c7d4b8..c8c4452 100644
--- a/docs/examples.rst
+++ b/docs/examples.rst
@@ -17,8 +17,8 @@ in an interactive figure using matplotlib. A screenshot is reproduced below:
There are some points to note about this diagram. Each subband is labeled sich
that '1' refers to the first subband, '5' the fifth and so forth. On this
-diagram the subbands are all four apart reflecting the fact that, for example,
-subbands 2, 3 and 4 are positioned in the other four quadrants of the upper
+diagram the highpasses are all four apart reflecting the fact that, for example,
+highpasses 2, 3 and 4 are positioned in the other four quadrants of the upper
hemisphere reflecting the position of subband 1. There are seven visible
subband directions in the +ve quadrant of the hemisphere and hence there are 28
directions in total over all four quadrants.
diff --git a/dtcwt/keypoint.py b/dtcwt/keypoint.py
index b6af794..342aa48 100644
--- a/dtcwt/keypoint.py
+++ b/dtcwt/keypoint.py
@@ -6,13 +6,13 @@ from dtcwt.sampling import upsample_highpass, upsample
__all__ = [ 'find_keypoints' ]
-def find_keypoints(highpass_subbands, method=None,
+def find_keypoints(highpass_highpasses, method=None,
alpha=1.0, beta=0.4, kappa=1.0/6.0,
threshold=None, max_points=None,
- upsample_keypoint_energy=None, upsample_subbands=None,
+ upsample_keypoint_energy=None, upsample_highpasses=None,
refine_positions=True, skip_levels=1):
"""
- :param highpass_subbands: (NxMx6) matrix of highpass subband images
+ :param highpass_highpasses: (NxMx6) matrix of highpass subband images
:param method: *(optional)* string specifying which keypoint energy method to use
:param alpha: *(optional)* scale parameter for ``'fauqueur'`` method
:param beta: *(optional)* shape parameter for ``'fauqueur'`` method
@@ -50,7 +50,7 @@ def find_keypoints(highpass_subbands, method=None,
1 or 2. If *skip_levels* is 0 then all levels will be used to compute
keypoint energy.
- The *upsample_subbands* and *upsample_keypoint_energy* parameters are used
+ The *upsample_highpasses* and *upsample_keypoint_energy* parameters are used
to control whether the individual subband coefficients and/org the keypoint
energy map are upscaled by 2 before finding keypoints. If these parameters
are None then no corresponding upscaling is performed. If non-None they
@@ -64,7 +64,7 @@ def find_keypoints(highpass_subbands, method=None,
=========== ======================================= ======================
fauqueur Geometric mean of absolute values[1] *alpha*, *beta*
bendale Minimum absolute value[2] none
- kingsbury Cross-product of orthogonal subbands *kappa*
+ kingsbury Cross-product of orthogonal highpasses *kappa*
=========== ======================================= ======================
[1] Julien Fauqueur, Nick Kingsbury, and Ryan Anderson. *Multiscale
@@ -83,20 +83,20 @@ def find_keypoints(highpass_subbands, method=None,
method = 'fauqueur'
# Skip levels
- highpass_subbands = highpass_subbands[skip_levels:]
+ highpass_highpasses = highpass_highpasses[skip_levels:]
# Compute contribution to scale from upsampling
upsample_scale = 1
- if upsample_subbands is not None:
+ if upsample_highpasses is not None:
upsample_scale <<= 1
if upsample_keypoint_energy is not None:
upsample_scale <<= 1
# Find keypoint energy map for each level
kp_energies = []
- for subband in highpass_subbands:
- if upsample_subbands is not None:
- subband = upsample_highpass(subband, upsample_subbands)
+ for subband in highpass_highpasses:
+ if upsample_highpasses is not None:
+ subband = upsample_highpass(subband, upsample_highpasses)
if method == 'fauqueur':
kp_energies.append(_keypoint_energy_fauqueur(subband, alpha, beta))
diff --git a/dtcwt/numpy/transform2d.py b/dtcwt/numpy/transform2d.py
index bd5a2ab..531ca82 100644
--- a/dtcwt/numpy/transform2d.py
+++ b/dtcwt/numpy/transform2d.py
@@ -26,7 +26,7 @@ class Pyramid(object):
A NumPy-compatible array containing the coarsest scale lowpass signal.
- .. py:attribute:: subbands
+ .. py:attribute:: highpasses
A tuple where each element is the complex subband coefficients for
corresponding scales finest to coarsest.
@@ -38,9 +38,9 @@ class Pyramid(object):
coarsest. This is not required for the inverse and may be *None*.
"""
- def __init__(self, lowpass, subbands, scales=None):
+ def __init__(self, lowpass, highpasses, scales=None):
self.lowpass = asfarray(lowpass)
- self.subbands = tuple(asfarray(x) for x in subbands)
+ self.highpasses = tuple(asfarray(x) for x in highpasses)
self.scales = tuple(asfarray(x) for x in scales) if scales is not None else None
class Transform2d(object):
@@ -231,7 +231,7 @@ class Transform2d(object):
"""
Yl = td_signal.lowpass
- Yh = td_signal.subbands
+ Yh = td_signal.highpasses
a = len(Yh) # No of levels.
@@ -292,7 +292,7 @@ class Transform2d(object):
Z = Z[:,1:-1]
if np.any(np.array(Z.shape) != S[:2]):
- raise ValueError('Sizes of subbands are not valid for DTWAVEIFM2')
+ raise ValueError('Sizes of highpasses are not valid for DTWAVEIFM2')
current_level = current_level - 1
@@ -339,7 +339,7 @@ def q2c(y):
p = y[0::2, 0::2]*j2[0] + y[0::2, 1::2]*j2[1] # p = (a + jb) / sqrt(2)
q = y[1::2, 1::2]*j2[0] - y[1::2, 0::2]*j2[1] # q = (d - jc) / sqrt(2)
- # Form the 2 subbands in z.
+ # Form the 2 highpasses in z.
z = np.dstack((p-q,p+q))
return z
@@ -348,7 +348,7 @@ def c2q(w,gain):
"""Scale by gain and convert from complex w(:,:,1:2) to real quad-numbers
in z.
- Arrange pixels from the real and imag parts of the 2 subbands
+ Arrange pixels from the real and imag parts of the 2 highpasses
into 4 separate subimages .
A----B Re Im of w(:,:,1)
| |
diff --git a/dtcwt/opencl/transform2d.py b/dtcwt/opencl/transform2d.py
index f166eb5..b4fdff4 100644
--- a/dtcwt/opencl/transform2d.py
+++ b/dtcwt/opencl/transform2d.py
@@ -24,9 +24,9 @@ def dtwavexfm2(X, nlevels=3, biort=DEFAULT_BIORT, qshift=DEFAULT_QSHIFT, include
t = Transform2d(biort=biort, qshift=qshift, queue=queue)
r = t.forward(X, nlevels=nlevels, include_scale=include_scale)
if include_scale:
- return r.lowpass, r.subbands, r.scales
+ return r.lowpass, r.highpasses, r.scales
else:
- return r.lowpass, r.subbands
+ return r.lowpass, r.highpasses
class Pyramid(object):
"""
@@ -51,7 +51,7 @@ class Pyramid(object):
The CL array containing the lowpass image.
- .. py:attribute:: cl_subbands
+ .. py:attribute:: cl_highpasses
A tuple of CL arrays containing the subband images.
@@ -61,9 +61,9 @@ class Pyramid(object):
scale.
"""
- def __init__(self, lowpass, subbands, scales=None):
+ def __init__(self, lowpass, highpasses, scales=None):
self.cl_lowpass = lowpass
- self.cl_subbands = subbands
+ self.cl_highpasses = highpasses
self.cl_scales = scales
@property
@@ -73,10 +73,10 @@ class Pyramid(object):
return self._lowpass
@property
- def subbands(self):
- if not hasattr(self, '_subbands'):
- self._subbands = tuple(to_array(x) for x in self.cl_subbands) if self.cl_subbands is not None else None
- return self._subbands
+ def highpasses(self):
+ if not hasattr(self, '_highpasses'):
+ self._highpasses = tuple(to_array(x) for x in self.cl_highpasses) if self.cl_highpasses is not None else None
+ return self._highpasses
@property
def scales(self):
diff --git a/dtcwt/plotting.py b/dtcwt/plotting.py
index 560e2a3..b5e8de0 100644
--- a/dtcwt/plotting.py
+++ b/dtcwt/plotting.py
@@ -42,7 +42,7 @@ def overlay_quiver_DTCWT(image, vectorField, level, offset):
transform2d = backend.Transform2d()
lena_t = transform2d.forward(lena, nlevels=3)
- plotting.overlay_quiver_DTCWT(lena, lena_t.subbands[-1], 3, 0.5)
+ plotting.overlay_quiver_DTCWT(lena, lena_t.highpasses[-1], 3, 0.5)
.. codeauthor:: R. Anderson, 2005 (MATLAB)
.. codeauthor:: S. C. Forshaw, 2014 (Python)
diff --git a/dtcwt/registration.py b/dtcwt/registration.py
index 20f7d52..d26a8f5 100644
--- a/dtcwt/registration.py
+++ b/dtcwt/registration.py
@@ -113,26 +113,26 @@ def qtildematrices(t_ref, t_target, levels):
corresponding level's highpass subbands.
"""
- # Extract subbands
- Yh1 = t_ref.subbands
- Yh2 = t_target.subbands
+ # Extract highpasses
+ Yh1 = t_ref.highpasses
+ Yh2 = t_target.highpasses
# A list of arrays of \tilde{Q} matrices for each level
Qt_mats = []
for level in levels:
- subbands1, subbands2 = Yh1[level], Yh2[level]
- xs, ys = np.meshgrid(np.arange(0,1,1/subbands1.shape[1]),
- np.arange(0,1,1/subbands1.shape[0]))
+ highpasses1, highpasses2 = Yh1[level], Yh2[level]
+ xs, ys = np.meshgrid(np.arange(0,1,1/highpasses1.shape[1]),
+ np.arange(0,1,1/highpasses1.shape[0]))
Qt_mat_sum = None
- for subband in xrange(subbands1.shape[2]):
- C_d = confidence(subbands1[:,:,subband], subbands2[:,:,subband])
- dy, dx, dt = phasegradient(subbands1[:,:,subband], subbands2[:,:,subband],
+ for subband in xrange(highpasses1.shape[2]):
+ C_d = confidence(highpasses1[:,:,subband], highpasses2[:,:,subband])
+ dy, dx, dt = phasegradient(highpasses1[:,:,subband], highpasses2[:,:,subband],
EXPECTED_SHIFTS[subband,:])
- dx *= subbands1.shape[1]
- dy *= subbands1.shape[0]
+ dx *= highpasses1.shape[1]
+ dy *= highpasses1.shape[0]
# This is the equivalent of the following for each member of the array
# Kt_mat = np.array(((1, 0, s*x, 0, s*y, 0, 0), (0, 1, 0, s*x, 0, s*y, 0), (0,0,0,0,0,0,1)))
@@ -262,14 +262,14 @@ def warptransform(t, avecs, levels, method=None):
deep-copied and warped.
"""
- warped_subbands = list(t.subbands)
+ warped_highpasses = list(t.highpasses)
# Warp specified levels
for l in levels:
- warped_subbands[l] = warphighpass(warped_subbands[l], avecs, method=method)
+ warped_highpasses[l] = warphighpass(warped_highpasses[l], avecs, method=method)
# Clone the transform
- return dtcwt.numpy.Pyramid(t.lowpass, tuple(warped_subbands), t.scales)
+ return dtcwt.numpy.Pyramid(t.lowpass, tuple(warped_highpasses), t.scales)
def estimatereg(source, reference, regshape=None):
"""
@@ -290,9 +290,9 @@ def estimatereg(source, reference, regshape=None):
"""
# Extract number of levels and shape of level 3 subband
- nlevels = len(source.subbands)
+ nlevels = len(source.highpasses)
if regshape is None:
- avecs_shape = source.subbands[2].shape[:2] + (6,)
+ avecs_shape = source.highpasses[2].shape[:2] + (6,)
else:
avecs_shape = tuple(regshape[:2]) + (6,)
@@ -312,7 +312,7 @@ def estimatereg(source, reference, regshape=None):
for it in xrange(2 * (nlevels - 1)):
s, e = nlevels, nlevels - 1 - it//2
levels = list(x for x in xrange(s, e-1, -1)
- if x>=2 and x<nlevels and source.subbands[x].shape[0] <= 2*avecs.shape[0] and source.subbands[x].shape[1] <= 2*avecs.shape[1])
+ if x>=2 and x<nlevels and source.highpasses[x].shape[0] <= 2*avecs.shape[0] and source.highpasses[x].shape[1] <= 2*avecs.shape[1])
if len(levels) == 0:
continue
diff --git a/dtcwt/sampling.py b/dtcwt/sampling.py
index bfb06f4..cc0dcc9 100644
--- a/dtcwt/sampling.py
+++ b/dtcwt/sampling.py
@@ -1,5 +1,5 @@
"""This module contains function for rescaling and re-sampling high- and
-low-pass subbands.
+low-pass highpasses.
.. note::
diff --git a/dtcwt/transform2d.py b/dtcwt/transform2d.py
index 49fb53d..5c627cf 100644
--- a/dtcwt/transform2d.py
+++ b/dtcwt/transform2d.py
@@ -46,9 +46,9 @@ def dtwavexfm2(X, nlevels=3, biort=DEFAULT_BIORT, qshift=DEFAULT_QSHIFT, include
res = trans.forward(X, nlevels, include_scale)
if include_scale:
- return res.lowpass, res.subbands, res.scales
+ return res.lowpass, res.highpasses, res.scales
else:
- return res.lowpass, res.subbands
+ return res.lowpass, res.highpasses
def dtwaveifm2(Yl,Yh,biort=DEFAULT_BIORT,qshift=DEFAULT_QSHIFT,gain_mask=None):
"""Perform an *n*-level dual-tree complex wavelet (DTCWT) 2D
diff --git a/matlab/gen_verif.m b/matlab/gen_verif.m
index 45a27b2..90b7466 100644
--- a/matlab/gen_verif.m
+++ b/matlab/gen_verif.m
@@ -30,7 +30,7 @@ qshift_b_bp = load('qshift_b_bp');
[lena_Ylb, lena_Yhb, lena_Yscaleb] = dtwavexfm2b(lena, 4, 'near_sym_b_bp', 'qshift_b_bp');
-%% 3x interpolation of subbands
+%% 3x interpolation of highpasses
x = lena_Yh{3};
sx = size(x);
nx = sx(2)*3; ny = sx(1)*3;
diff --git a/tests/testxfm3.py b/tests/testxfm3.py
index 372b253..850736b 100644
--- a/tests/testxfm3.py
+++ b/tests/testxfm3.py
@@ -161,7 +161,7 @@ def test_level_4_recon_discarding_level_1():
assert np.median(np.abs(ellipsoid - ellipsoid_recon)[:]) < 1e-3
def test_level_4_discarding_level_1():
- # Test that level >= 2 subbands are identical
+ # Test that level >= 2 highpasses are identical
Yl1, Yh1 = dtwavexfm3(ellipsoid, 4, discard_level_1=True)
Yl2, Yh2 = dtwavexfm3(ellipsoid, 4, discard_level_1=False)
--
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