[Numpy-discussion] median filtering a masked array

Stefan van der Walt stefan at sun.ac.za
Thu Nov 6 04:48:51 EST 2014


On 2014-11-06 11:10:29, Daπid <davidmenhur at gmail.com> wrote:
> On 5 November 2014 19:11, Moroney, Catherine M (398E)
> <Catherine.M.Moroney at jpl.nasa.gov> wrote:
>> What is the recommended way of doing a fast median filter on an array where only
>> certain elements of the array need to be calculated?  I'm trying to avoid a
>> nested loop over all (I,J) elements.
>
> Since you are using FORTRAN, I believe the simplest way is to do this
> double loop in Cython.

If you'd prefer to stay on the Python side, have a look at

scipy.ndimage.generic_filter

Stéfan



More information about the NumPy-Discussion mailing list