Add docstring comment about flat peaks.

This commit is contained in:
Tony S Yu
2012-04-16 00:02:45 -04:00
parent ae6ef22a69
commit 0b33dd5811
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -10,6 +10,9 @@ def peak_local_max(image, min_distance=10, threshold='deprecated',
Peaks are the local maxima in a region of `2 * min_distance + 1`
(i.e. peaks are separated by at least `min_distance`).
NOTE: If peaks are flat (i.e. multiple pixels have exact same intensity),
the coordinates of all pixels are returned.
Parameters
----------
image: ndarray of floats
+7
View File
@@ -43,6 +43,13 @@ def test_constant_image():
assert len(peaks) == 0
def test_flat_peak():
image = np.zeros((5, 5), dtype=np.uint8)
image[1:3, 1:3] = 10
peaks = peak.peak_local_max(image, min_distance=1)
assert len(peaks) == 4
if __name__ == '__main__':
from numpy import testing
testing.run_module_suite()