From 593a7d63cec47ff60871667d2337fdb2f98e4135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= Date: Tue, 16 Jul 2013 13:12:18 +0200 Subject: [PATCH] unwrap: Change 1D unwrapper from float to double. --- skimage/exposure/_unwrap_1d.pyx | 4 ++-- skimage/exposure/unwrap.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/skimage/exposure/_unwrap_1d.pyx b/skimage/exposure/_unwrap_1d.pyx index d39f9e57..f23e5f40 100644 --- a/skimage/exposure/_unwrap_1d.pyx +++ b/skimage/exposure/_unwrap_1d.pyx @@ -6,11 +6,11 @@ from libc.math cimport M_PI -def unwrap_1d(float[::1] image, float[::1] unwrapped_image): +def unwrap_1d(double[::1] image, double[::1] unwrapped_image): '''Phase unwrapping using the naive approach.''' cdef: Py_ssize_t i - float difference + double difference long periods = 0 unwrapped_image[0] = image[0] for i in range(1, image.shape[0]): diff --git a/skimage/exposure/unwrap.py b/skimage/exposure/unwrap.py index 0f0d4ae4..3c52acde 100644 --- a/skimage/exposure/unwrap.py +++ b/skimage/exposure/unwrap.py @@ -90,6 +90,8 @@ def unwrap_phase(image, wrap_around=False): image_unwrapped = np.empty_like(image, dtype=np.float32, order='C') if image.ndim == 1: + image_not_masked = np.asarray(image, dtype=np.float64, order='C') + image_unwrapped = np.empty_like(image, dtype=np.float64, order='C') unwrap_1d(image_not_masked, image_unwrapped) elif image.ndim == 2: image_not_masked = np.asarray(image, dtype=np.float64, order='C')