Meta-issue: ndimage spline boundary handling (NumFOCUS proposal)
See original GitHub issueThis is a meta-issue to help keep track of open issues and PRs related to ndimage enhancements and bug fixes for our NumFOCUS small development grant.
PRs associated with the proposal
- gh-12721: improve numerical accuracy of rotate (thanks, @ev-br!)
- gh-12746: parameterize scipy.ndimage tests
- gh-12767: grid-wrap, reflect and updated tutorials
- gh-12776: grid-constant
- gh-12802: benchmarks for scipy.ndimage.interpolation
- gh-12812: complex-valued image support for ndimage.interpolation functions
- gh-13095: implement zoom coordinate convention consistent with the grid interpretation
- gh-13139: fix for mode=‘nearest’ when prefilter=False and order > 1
Issues related to problems with wrap and reflect boundary conditions:
gh-1323 (fixed by gh-12767) gh-2640 (reflect and wrap cases fixed by gh-12767. constant and nearest still imperfect for order > 1) gh-8131 (fixed by gh-12767) gh-8465 (fixed by gh-12767)
Issues related to problems with constant boundary condition:
gh-2640
gh-9865
Related: The following three were recently fixed, but having a grid-constant mode is probably more robust for general cases.
gh-1903 (fixed by gh-12721)
gh-10926 (fixed by gh-12721)
gh-12543 (fixed by gh-12721)
tasks related to documentation
gh-9746
misc things to review
https://github.com/scipy/scipy/pull/9537#discussion_r244550683 https://gist.github.com/jaimefrio/79ee7a9f8d7ff6ca10ae72633ec68c80 discussion in gh-8537 gh-5223 (fix proposed in gh-13095)
abandoned PR with good discussion:
gh-206 (previously abandoned PR with partial fix)
related issues/PRs in downstream libraries
scikit-image/scikit-image#1514 scikit-image/scikit-image#1583 scikit-image/scikit-image#1585 (resolved by gh-12767) scikit-image/scikit-image#1732 scikit-image/scikit-image#1789 scikit-image/scikit-image#2629 scikit-image/scikit-image#3445 scikit-image/scikit-image#4824 scikit-image/scikit-image#4279 scikit-image/scikit-image#4416 cupy/cupy#1523 google/jax#1711 google/jax#3928
other misc issues
gh-8845 (won’t fix)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:8 (8 by maintainers)

Top Related StackOverflow Question
I am going to close this meta-issue now that all PRs related to it have been merged. Thank you to everyone who reviewed and/or gave feedback!
I have spent the majority of my funded effort toward the SciPy proposal at this point and don’t plan substantial additional work here aside from finishing up the currently open PRs and tidying up some things downstream at scikit-image and CuPy once we finalize things here. I wanted to summarize some API/design choices below for consideration/comment.
cc also @sethtroisi and @larsoner as discussion participants from related PRs.
For scipy.ndimage.interpolation functions
1.) Two new modes:
grid-wrap(gh-12767) andgrid-constant(gh-12776) were introduced. I believe the consensus is to keep both the existingwrapandconstantmodes in addition to these? I would have preferred if the existingwrapandconstantmodes behaved as these grid variants from the start, but I don’t think it is very easy to change that at this point.2.) The synonym
grid-mirrorwas introduced for modereflect. I am personally not sure this is desirable and may just generate more confusion. If we do introduce it, do we deprecatereflect?3.) Better documentation of boundary handling was added to the ndimage tutorials in (see doc artifacts in gh-12767 and gh-12776). Perhaps we should also link to these from the mode docstring in the individual functions to help avoid potential user confusion?
For scipy.ndimage.filters functions
All of the convolution-based filters already operate only on a grid, so the existing
wrapmode already operates like the newgrid-wrapintroduced in the interpolation module. Likewise, there is not a distinction betweengrid-constantandconstantas there is no consideration of values at fractional offsets outside the image boundary.grid-wrapas a synonym forwrapor explicitly raise an exception if it is provided? (ditto forgrid-mirroras a synonym forreflectandgrid-constantas a synonym forconstant)I don’t really think we should deprecate use of either
'wrap'orconstantwith their current meaning for these filtering functions for two reasons: 1.) it will be an annoyance for many downstream users and 2.)wrapandconstantalready match the behavior of manually padding using these modes innumpy.pad.Given that I also don’t think it makes much sense to keep two synonymous names long-term, I am personally leaning toward NOT making changes to the mode names used by the
ndimage.filtersmodule.