Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ndimage.percentile_filter ignores origin argument for multidimensional inputs #2922

poolio opened this Issue · 1 comment

1 participant


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)


Error with origin=0: 0
Error with origin=-1: 8
Difference between origin=0 and origin=-1 for array: 0

Fixed in #2923

@poolio poolio closed this
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.