-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Make boundary mode names consistent and improve their documentation #6364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
many names are the same, but default of 'reflect' for numpy.pad corresponds to 'mirror' for ndimage
…nstant' legacy Cython interpolation code in skimage behaves like 'grid-constant' in ndimage. this avoids scipy.ndimage warnings recommending 'grid-constant' over 'constant'.
may need to revert 4b63878 unless we update to SciPy >=1.6.0 |
Co-authored-by: Alexandre de Siqueira <alex.desiqueira@igdore.org>
Updating to scipy 1.6 feels like the more future-proof solution. We don't really have the bandwidth to baby-sit older versions of SciPy, so I am +1 on doing that. |
Agreed that changing interpolation modes to be consistent may need to wait for skimage2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Is edge and nearest the same? I'd expect them to differ in some cases.
Description
This PR makes edge modes consistent as discussed previously in #5439 (comment).
closes #6345: cross-links to documentation illustrating the edge modes
I went with the
scipy.ndimage
mode names because those were more common across the library. The only exception that still usesnumpy.pad
mode names isskimage.features.match_template
as this function explicitly documents that the mode is passed directly to an internalnumpy.pad
call.This PR is a good example of a case where deprecation isn't really feasible as the default of
mode='reflect'
exists both fornumpy.pad
andscipy.ndimage
but the behavior is subtly different (scipy.ndimage
repeats the edge value whilenumpy.pad
's'reflect'
behaves like ndimage's'mirror'
). Thus I propose we only introduce this change forskimage2
and delay merging this PR until after1.0.x
has been branched off ofmain
.Summary of the change for existing
skimage.transforms
code:mode='wrap'
andmode='constant'
continue to behave the samemode='reflect'
was being used it now behaves slightly differently (the edge value is duplicated). To get the old behavior, the user would have to passmode='mirror'
instead.mode='symmetric'
will now raise aRuntimeError
and require replacement withmode='reflect'
for equivalent behaviormode='edge'
will now raise aRuntimeError
and require replacement withmode='nearest'
for equivalent behaviorChecklist
./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.x
run-benchmark
label. To rerun, the labelcan be removed and then added again. The benchmark output can be checked in
the "Actions" tab.