From 7f5b9327facf26508fb3b117e9b8a32349355cdb Mon Sep 17 00:00:00 2001 From: Shaun Singh Date: Wed, 24 Feb 2016 16:54:22 -0800 Subject: [PATCH 1/3] Update docstring for profile_line --- skimage/measure/profile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/skimage/measure/profile.py b/skimage/measure/profile.py index 9dbc2d7a..45a01c96 100644 --- a/skimage/measure/profile.py +++ b/skimage/measure/profile.py @@ -16,6 +16,8 @@ def profile_line(img, src, dst, linewidth=1, The start point of the scan line. dst : 2-tuple of numeric scalar (float or int) The end point of the scan line. + Note: The final destination point is INCLUDED in the profile, + in constrast to standard numpy indexing. linewidth : int, optional Width of the scan, perpendicular to the line order : int in {0, 1, 2, 3, 4, 5}, optional @@ -44,11 +46,18 @@ def profile_line(img, src, dst, linewidth=1, [0, 0, 0, 0, 0, 0]]) >>> profile_line(img, (2, 1), (2, 4)) array([ 1., 1., 2., 2.]) + >>> profile_line(img, (1, 0), (1, 6), cval=4) + array([ 1., 1., 1., 2., 2., 2., 4.]) Notes ----- The destination point is included in the profile, in contrast to standard numpy indexing. + + For example: + >>> img = np.array([1,1,2,2]) + >>> profile_line(img, (0, 0), (0, 4)) # The final point is out of bounds + >>> profile_line(img, (0, 0), (0, 3)) # This accesses the full first row """ perp_lines = _line_profile_coordinates(src, dst, linewidth=linewidth) if img.ndim == 3: From f6618ef8b22b055e4135f053070059865264466b Mon Sep 17 00:00:00 2001 From: Shaun Singh Date: Wed, 24 Feb 2016 17:38:21 -0800 Subject: [PATCH 2/3] Clean up profile-line docstring --- skimage/measure/profile.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/skimage/measure/profile.py b/skimage/measure/profile.py index 45a01c96..e3891aec 100644 --- a/skimage/measure/profile.py +++ b/skimage/measure/profile.py @@ -15,9 +15,8 @@ def profile_line(img, src, dst, linewidth=1, src : 2-tuple of numeric scalar (float or int) The start point of the scan line. dst : 2-tuple of numeric scalar (float or int) - The end point of the scan line. - Note: The final destination point is INCLUDED in the profile, - in constrast to standard numpy indexing. + The end point of the scan line. The destination point is *included* + in the profile, in constrast to standard numpy indexing. linewidth : int, optional Width of the scan, perpendicular to the line order : int in {0, 1, 2, 3, 4, 5}, optional @@ -49,15 +48,13 @@ def profile_line(img, src, dst, linewidth=1, >>> profile_line(img, (1, 0), (1, 6), cval=4) array([ 1., 1., 1., 2., 2., 2., 4.]) - Notes - ----- The destination point is included in the profile, in contrast to standard numpy indexing. - For example: - >>> img = np.array([1,1,2,2]) - >>> profile_line(img, (0, 0), (0, 4)) # The final point is out of bounds - >>> profile_line(img, (0, 0), (0, 3)) # This accesses the full first row + >>> profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds + array([ 1., 1., 1., 2., 2., 2., 0.]) + >>> profile_line(img, (1, 0), (1, 5)) # This accesses the full first row + array([ 1., 1., 1., 2., 2., 2.]) """ perp_lines = _line_profile_coordinates(src, dst, linewidth=linewidth) if img.ndim == 3: From 7a2c80e70f34c3f9a5d6bbaa0c5e7f77a6ce9ad4 Mon Sep 17 00:00:00 2001 From: Shaun Singh Date: Thu, 25 Feb 2016 17:24:29 -0800 Subject: [PATCH 3/3] Fix spacing for inline comments --- skimage/measure/profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skimage/measure/profile.py b/skimage/measure/profile.py index e3891aec..473b4113 100644 --- a/skimage/measure/profile.py +++ b/skimage/measure/profile.py @@ -51,9 +51,9 @@ def profile_line(img, src, dst, linewidth=1, The destination point is included in the profile, in contrast to standard numpy indexing. For example: - >>> profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds + >>> profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds array([ 1., 1., 1., 2., 2., 2., 0.]) - >>> profile_line(img, (1, 0), (1, 5)) # This accesses the full first row + >>> profile_line(img, (1, 0), (1, 5)) # This accesses the full first row array([ 1., 1., 1., 2., 2., 2.]) """ perp_lines = _line_profile_coordinates(src, dst, linewidth=linewidth)