From 0fde67bb568e972224e7dfd70ba39bfd366e4f2d Mon Sep 17 00:00:00 2001 From: Malcolm Reynolds Date: Mon, 18 Mar 2013 15:13:18 +0000 Subject: [PATCH] TEST: added test for num_peaks kwarg in peak_local_max. --- skimage/feature/tests/test_corner.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index a7ee01ff..9c59f704 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -100,6 +100,19 @@ def test_subpix(): assert_array_equal(subpix[0], (24.5, 24.5)) +def test_num_peaks(): + """For a bunch of different values of num_peaks, check that + peak_local_max returns exactly the right amount of peaks. Test + is run on Lena in order to produce a sufficient number of corners""" + + lena = data.lena() + + for i in xrange(20): + n = np.random.random_integers(20) + results = peak_local_max(corner_harris(lena), num_peaks=n) + assert (results.shape[0] == n) + + def test_corner_peaks(): response = np.zeros((5, 5)) response[2:4, 2:4] = 1