Conversation
update docs and gallery to use rescale_to_*
|
Hello @grlee77! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2022-04-05 17:52:16 UTC |
There was a problem hiding this comment.
Thanks @grlee77. I'm not through yet but I have a few comments.
Also there still is a lonely img_as_float in doc/CONTRIBUTING.rst under "Stylistic Guidelines".
skimage/util/dtype.py
Outdated
| return _img_as_float(image, force_copy, preserve_range=False) | ||
|
|
||
|
|
||
| def _img_as_float(image, force_copy=False, *, preserve_range=True, dtype=None): |
There was a problem hiding this comment.
I think _rescale_to_float would be the clearer and more consistent name.
There was a problem hiding this comment.
_img_as_float has been removed and _convert is just used directy now.
skimage/util/dtype.py
Outdated
| return _convert(image, np.floating, force_copy) | ||
| return _img_as_float(image, force_copy, preserve_range=False) |
There was a problem hiding this comment.
I don't understand this change. Why did you wrap _convert with the new function _img_as_float?
Also one could argue that it would be more explicit to use dtype=np.floating here and not rely on _img_as_float's implicit behavior for dtype=None. Or rather use np.floating as the default in the function signature?
There was a problem hiding this comment.
not sure why I did that, will take a look again.
There was a problem hiding this comment.
_img_as_float has been removed and _convert is just used directy now.
|
Per #1234 (comment), we need to decide on Also, we do already have a private |
|
We will need to hold off on merging this PR until after we branch 1.0 |
This comment was marked as outdated.
This comment was marked as outdated.
Why? I'm assuming that 1.0 was the former "breaking API" milestone. This seems like a deprecation that doesn't require a major version or namespace change. If this was decided on I would like to pick it up again. I'm also +1 on |
Description
This PR implements a prior suggestion to rename
img_as_floattorescale_to_float, etc. This is done primarily to make it clearer that these function rescale the range of the inputs. This change has been discussed a few of times in the past (#1234, #3009 (comment) and #5439)At the moment,
img_as_float,img_as_float32andimg_as_float64are also still here, but no longer rescale the range. We can likely just go ahead and remove this asastypecan already be used to convert dtypes without scaling.Checklist
./doc/examples(new features only)./benchmarks, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py.doc/release/release_dev.rst.example, to backport to v0.19.x after merging, add the following in a PR
comment:
@meeseeksdev backport to v0.19.xrun-benchmarklabel. To rerun, the labelcan be removed and then added again. The benchmark output can be checked in
the "Actions" tab.