unwrap_phase returns masked array when image is masked

With commit e3b84ed the unwrap_phase function would always return an ndarray
even when image was masked.  This restores the pre-e3b84ed behavior of
returning a masked array when the image is masked.
This commit is contained in:
Jonathan Helmus
2015-01-21 16:23:50 -06:00
parent eef3734bfe
commit de01ea56ae
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -131,6 +131,7 @@ def test_mask():
# The end of the unwrapped array should have value equal to the
# endpoint of the unmasked ramp
assert_array_almost_equal_nulp(image_unwrapped[:, -1], image[i, -1])
assert np.ma.isMaskedArray(image_unwrapped)
# Same tests, but forcing use of the 3D unwrapper by reshaping
with expected_warnings(['length 1 dimension']):
+2 -2
View File
@@ -89,11 +89,11 @@ def unwrap_phase(image, wrap_around=False, seed=None):
if np.ma.isMaskedArray(image):
mask = np.require(np.ma.getmaskarray(image), np.uint8, ['C'])
image = np.ma.getdata(image)
else:
mask = np.zeros_like(image, dtype=np.uint8, order='C')
image_not_masked = np.asarray(image, dtype=np.double, order='C')
image_not_masked = np.asarray(
np.ma.getdata(image), dtype=np.double, order='C')
image_unwrapped = np.empty_like(image, dtype=np.double, order='C')
if image.ndim == 1: