Using patch submitted by russel fixed Ticket #1122. Added a unit test to catch error. With my numpy error setup the test still raises a RuntimeWarning because of the division by zero but passes.
FIX: ndimage.zoom ticket #1122
If the divide by zero is supposed to happen (I haven't checked), you can suppress the warning with
old_err = np.seterr(divide="ignore")
# do thing that divides by 0
changes to unit test
@stefanv : would you be able to have a look at this in the next couple of days (branching 0.11.x on Wed is the plan, but may be a few days later)?
FIX: better fix for ndimage.zoom ticket #1122
The latest commit is a better fix for the problem (both inf and nan should be filtered from zoom). The unit test error is now ignored.
I think we're almost there, but what about:
import numpy as np
import scipy.ndimage as ndi
x = np.array([[1, 2]])
print ndi.zoom(x, (2, 1))
print ndi.zoom(x, (1, 2))
[[0 0 0 0]]
(Last seems incorrect)
With the latest commit I get
[[1 1 2 2]]
Which with ints is the expected results.
It might help if I apply the patch before testing :)
Let's add the test example above and merge.
additional unit test for ndimage.zoom
Merged as 07f84e3. Thanks Jonathan and Stefan.
@jjhelmus you may want to set up your editor such that it strips trailing whitespace automatically, there were some lines which had that problem.