Skip to content
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

ndimage.percentile_filter ignores origin argument for multidimensional inputs #2922

Closed
poolio opened this issue Sep 24, 2013 · 1 comment
Closed
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.ndimage
Milestone

Comments

@poolio
Copy link
Contributor

poolio commented Sep 24, 2013

The percentile_filter seems to ignore the origin argument when the input is not a vector. Here is a test example that compares the result of a percentile_filter on a vector vs. an Nx1 array. I would expect the results to be identical, but using non-zero origins yields the same result as using zero origins on the Nx1 array.

import numpy as np
from scipy.ndimage.filters import percentile_filter
x = np.arange(10).reshape(10,1)
y = x.flatten()
x0 = percentile_filter(x, 0, size=(3,1), origin=(0,0)).flatten()
x1 = percentile_filter(x, 0, size=(3,1), origin=(-1,0)).flatten()
y0 = percentile_filter(y, 0, size=3, origin=0)
y1 = percentile_filter(y, 0, size=3, origin=-1)
print 'Error with origin=0:', np.sum((y0-x0)**2)
print 'Error with origin=-1:', np.sum((y1-x1)**2)
print 'Difference between origin=0 and origin=-1 for array:', np.sum((x1 -x0)**2)

Output:

Error with origin=0: 0
Error with origin=-1: 8
Difference between origin=0 and origin=-1 for array: 0
@poolio
Copy link
Contributor Author

poolio commented Sep 24, 2013

Fixed in #2923

@poolio poolio closed this as completed Sep 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.ndimage
Projects
None yet
Development

No branches or pull requests

1 participant