Improve docstring for rolling_ball function.#7682
Improve docstring for rolling_ball function.#7682jarrodmillman merged 8 commits intoscikit-image:mainfrom
Conversation
| kernel : ndarray, optional | ||
| The kernel to be rolled/translated in the image. It must have the | ||
| same number of dimensions as ``image``. Kernel is filled with the | ||
| intensity of the kernel at that position. |
There was a problem hiding this comment.
@FirefoxMetzger I originally tried fixing the sentence "Kernel is filled with the intensity of the kernel" but then I thought these details would fit better in the Notes.
stefanv
left a comment
There was a problem hiding this comment.
Thanks @mkcor!
I started reading the docstring, and was immediately confused by things you explain later in the notes. I think it would be helpful to give a short, intuitive explanation as part of the function description (it doesn't require that much!). But also fine to add a forward reference to the notes, if you prefer.
skimage/restoration/_rolling_ball.py
Outdated
| This function estimates the background intensity of an n-dimensional | ||
| image. Typically, it is useful for background subtraction in case of | ||
| uneven exposure. It is a generalization of the well-known rolling-ball | ||
| algorithm [1]_. |
There was a problem hiding this comment.
| This function estimates the background intensity of an n-dimensional | |
| image. Typically, it is useful for background subtraction in case of | |
| uneven exposure. It is a generalization of the well-known rolling-ball | |
| algorithm [1]_. | |
| This function is a generalization of the rolling-ball algorithm [1]_ | |
| to estimate the background intensity of an N-dimensional | |
| image. This is useful for background subtraction in case of | |
| uneven exposure. Think of the image as a landscape | |
| (where altitude is determined by intensity), under which | |
| a ball of given radius is rolled. At each position, the ball's | |
| apex determines the resulting background intensity. |
There was a problem hiding this comment.
There was a problem hiding this comment.
No problem; we should strive to get it uniform eventually, either n/N fine.
Co-authored-by: Stefan van der Walt <[email protected]>
|
Totally fine to hyphenate however you see fit, by the way! |
|
Sorry @mkcor, I had to cancel your CI checks on macos because I need the runners. But, I will have that situation under control soon. Happy to merge your changes when you're ready (wasn't sure whether you had addressed my comments or not 😅). |
|
(Added new GH runners and restarted tests; but the rolling ball is the culprit in making them so slow!) |
Not entirely yet! 🙏 |
…mage into improve-rolling-docstring
Co-authored-by: Stefan van der Walt <[email protected]>
|
I used the term 'doctest' in a commit message although no check is performed in these docstring examples. They just illustrate how the function may be used. Btw, this is now ready for final review! |
skimage/restoration/_rolling_ball.py
Outdated
|
|
||
| def rolling_ball(image, *, radius=100, kernel=None, nansafe=False, num_threads=None): | ||
| """Estimate background intensity by rolling/translating a kernel. | ||
| """Estimate background intensity using the rolling ball algorithm. |
There was a problem hiding this comment.
| """Estimate background intensity using the rolling ball algorithm. | |
| """Estimate background intensity using the rolling-ball algorithm. |
As long as its consistent :)
There was a problem hiding this comment.
The gallery example will soon be consistent :)
skimage/restoration/_rolling_ball.py
Outdated
| This function estimates the background intensity of an n-dimensional | ||
| image. Typically, it is useful for background subtraction in case of | ||
| uneven exposure. It is a generalization of the well-known rolling-ball | ||
| algorithm [1]_. |
There was a problem hiding this comment.
No problem; we should strive to get it uniform eventually, either n/N fine.
|
Looks good! The failure is related, however. |
…ailure * origin/main: Add zizmor to pre-commit; address GH workflow issues raised (scikit-image#7662) Reenable test marked as flaky on Azure. (scikit-image#7694) Simultaneously resolve all dependencies; add pip caching (scikit-image#7690) Copy keypoints if necessary to preserve contiguity (scikit-image#7692) CI cleanup (scikit-image#7693) Port CI testing from Azure to GitHub (scikit-image#7687) Lower CI build verbosity Use pytest config in pyproject.toml in CI (scikit-image#7555) Improve docstring for rolling_ball function. (scikit-image#7682)
Description
As I started tackling #7680, I had to refresh my memory and remember what the rolling-ball algorithm was about. I found there was room for improvement with the function's docstring, in spite of the multiple reviews back in the days! This PR is an attempt at providing clearer descriptions. Then I'll go through the gallery example.
Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.