From 2585a323ac57004179b0ba643f953162650f39ee Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sun, 15 Apr 2012 23:48:27 -0400 Subject: [PATCH] Change threshold test from >= to >. --- skimage/feature/peak.py | 2 +- skimage/feature/tests/test_peak.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/skimage/feature/peak.py b/skimage/feature/peak.py index 3471381b..30e1a84b 100644 --- a/skimage/feature/peak.py +++ b/skimage/feature/peak.py @@ -51,7 +51,7 @@ def peak_local_max(image, min_distance=10, threshold='deprecated', threshold_rel = threshold # find top corner candidates above a threshold corner_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs) - image_t = (image >= corner_threshold) * 1 + image_t = (image > corner_threshold) * 1 # get coordinates of peaks coordinates = np.transpose(image_t.nonzero()) diff --git a/skimage/feature/tests/test_peak.py b/skimage/feature/tests/test_peak.py index 7f54b7cd..7f960e3b 100644 --- a/skimage/feature/tests/test_peak.py +++ b/skimage/feature/tests/test_peak.py @@ -22,7 +22,7 @@ def test_noisy_peaks(): def test_relative_threshold(): image = np.zeros((5, 5), dtype=np.uint8) image[1, 1] = 10 - image[3, 3] = 21 + image[3, 3] = 20 peaks = peak.peak_local_max(image, min_distance=1, threshold_rel=0.5) assert len(peaks) == 1 assert_close(peaks, [(3, 3)]) @@ -31,8 +31,8 @@ def test_relative_threshold(): def test_absolute_threshold(): image = np.zeros((5, 5), dtype=np.uint8) image[1, 1] = 10 - image[3, 3] = 21 - peaks = peak.peak_local_max(image, min_distance=1, threshold_abs=11) + image[3, 3] = 20 + peaks = peak.peak_local_max(image, min_distance=1, threshold_abs=10) assert len(peaks) == 1 assert_close(peaks, [(3, 3)])