Skip to content

FIX: ndimage.zoom ticket #1122 #204

Closed
wants to merge 4 commits into from

3 participants

@jjhelmus
jjhelmus commented May 7, 2012

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.

@rgommers
SciPy member
rgommers commented May 7, 2012

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")
try:
    # do thing that divides by 0
finally:
    np.seterr(**old_err)
@rgommers
SciPy member
rgommers commented Jun 4, 2012

@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)?

@jjhelmus
jjhelmus commented Jun 4, 2012

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.

@stefanv
SciPy member
stefanv commented Jun 5, 2012

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))

which yields

[[1 2]
 [1 2]]

[[0 0 0 0]]

(Last seems incorrect)

@jjhelmus
jjhelmus commented Jun 6, 2012

With the latest commit I get

[[1 2]
 [1 2]]

[[1 1 2 2]]

Which with ints is the expected results.

@stefanv
SciPy member
stefanv commented Jun 6, 2012

It might help if I apply the patch before testing :)

Let's add the test example above and merge.

@jjhelmus
jjhelmus commented Jun 6, 2012

Done!

@rgommers
SciPy member
rgommers commented Jun 9, 2012

Merged as 07f84e3. Thanks Jonathan and Stefan.

@rgommers rgommers closed this Jun 9, 2012
@rgommers
SciPy member
rgommers commented Jun 9, 2012

@jjhelmus you may want to set up your editor such that it strips trailing whitespace automatically, there were some lines which had that problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.