From 781ead2c9f136f088eeb0e6f316df506fddaa7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= Date: Mon, 15 Jul 2013 17:47:48 +0200 Subject: [PATCH] unwrap: Rename function unwrap() -> unwrap_phase(). --- doc/examples/plot_phase_unwrap.py | 2 +- skimage/exposure/__init__.py | 4 ++-- skimage/exposure/tests/test_unwrap.py | 12 ++++++------ skimage/exposure/unwrap.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/examples/plot_phase_unwrap.py b/doc/examples/plot_phase_unwrap.py index 85be5fde..c2aecdb5 100644 --- a/doc/examples/plot_phase_unwrap.py +++ b/doc/examples/plot_phase_unwrap.py @@ -22,7 +22,7 @@ image = exposure.rescale_intensity(image, out_range=(0, 4 * np.pi)) # Create a phase-wrapped image in the interval [-pi, pi) image_wrapped = np.angle(np.exp(1j * image)) # Perform phase unwrapping -image_unwrapped = exposure.unwrap(image_wrapped) +image_unwrapped = exposure.unwrap_phase(image_wrapped) # Plotting plt.figure() diff --git a/skimage/exposure/__init__.py b/skimage/exposure/__init__.py index 390d042b..c8f7b1be 100644 --- a/skimage/exposure/__init__.py +++ b/skimage/exposure/__init__.py @@ -3,7 +3,7 @@ from .exposure import histogram, equalize, equalize_hist, \ adjust_gamma, adjust_sigmoid, adjust_log from ._adapthist import equalize_adapthist -from .unwrap import unwrap +from .unwrap import unwrap_phase __all__ = ['histogram', 'equalize', @@ -14,4 +14,4 @@ __all__ = ['histogram', 'adjust_gamma', 'adjust_sigmoid', 'adjust_log', - 'unwrap'] + 'unwrap_phase'] diff --git a/skimage/exposure/tests/test_unwrap.py b/skimage/exposure/tests/test_unwrap.py index 74e84aee..a465cd2c 100644 --- a/skimage/exposure/tests/test_unwrap.py +++ b/skimage/exposure/tests/test_unwrap.py @@ -5,7 +5,7 @@ from numpy.testing import (run_module_suite, assert_array_almost_equal, assert_almost_equal, assert_array_equal) import warnings -from skimage.exposure import unwrap +from skimage.exposure import unwrap_phase def assert_phase_almost_equal(a, b, *args, **kwargs): @@ -36,7 +36,7 @@ def check_unwrap(image, mask=None): print('Testing a masked image') image = np.ma.array(image, mask=mask) image_wrapped = np.ma.array(image_wrapped, mask=mask) - image_unwrapped = unwrap(image_wrapped) + image_unwrapped = unwrap_phase(image_wrapped) assert_phase_almost_equal(image_unwrapped, image) @@ -70,7 +70,7 @@ def check_wrap_around(ndim, axis): index_first = tuple([0] * ndim) index_last = tuple([-1 if n == axis else 0 for n in range(ndim)]) # unwrap the image without wrap around - image_unwrap_no_wrap_around = unwrap(image_wrapped) + image_unwrap_no_wrap_around = unwrap_phase(image_wrapped) print('endpoints without wrap_around:', image_unwrap_no_wrap_around[index_first], image_unwrap_no_wrap_around[index_last]) @@ -79,7 +79,7 @@ def check_wrap_around(ndim, axis): - image_unwrap_no_wrap_around[index_last]) > np.pi # unwrap the image with wrap around wrap_around = [n == axis for n in range(ndim)] - image_unwrap_wrap_around = unwrap(image_wrapped, wrap_around) + image_unwrap_wrap_around = unwrap_phase(image_wrapped, wrap_around) print('endpoints with wrap_around:', image_unwrap_wrap_around[index_first], image_unwrap_wrap_around[index_last]) @@ -108,7 +108,7 @@ def test_mask(): mask |= mask_1d.reshape(1, -1) mask[i, :] = False # unmask i'th ramp image_wrapped = np.ma.array(np.angle(np.exp(1j * image)), mask=mask) - image_unwrapped = unwrap(image_wrapped) + image_unwrapped = unwrap_phase(image_wrapped) image_unwrapped -= image_unwrapped[0, 0] # remove phase shift # The end of the unwrapped array should have value equal to the # endpoint of the unmasked ramp @@ -116,7 +116,7 @@ def test_mask(): # Same tests, but forcing use of the 3D unwrapper by reshaping image_wrapped_3d = image_wrapped.reshape((1,) + image_wrapped.shape) - image_unwrapped_3d = unwrap(image_wrapped_3d) + image_unwrapped_3d = unwrap_phase(image_wrapped_3d) image_unwrapped_3d -= image_unwrapped_3d[0, 0, 0] # remove phase shift assert_array_almost_equal(image_unwrapped_3d[:, :, -1], image[i, -1]) diff --git a/skimage/exposure/unwrap.py b/skimage/exposure/unwrap.py index e4d112bd..ab05bc5e 100644 --- a/skimage/exposure/unwrap.py +++ b/skimage/exposure/unwrap.py @@ -5,7 +5,7 @@ from ._unwrap_3d import unwrap_3d from .._shared.six import string_types -def unwrap(image, wrap_around=False): +def unwrap_phase(image, wrap_around=False): '''From ``image``, wrapped to lie in the interval [-pi, pi), recover the original, unwrapped image.