TEST: added test for num_peaks kwarg in peak_local_max.

This commit is contained in:
Malcolm Reynolds
2013-03-18 15:13:18 +00:00
parent 44095eef81
commit 0fde67bb56
+13
View File
@@ -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