Re: [Numpy-discussion] median filtering a masked array

2014-11-06 Thread Daπid
On 5 November 2014 19:11, Moroney, Catherine M (398E)
catherine.m.moro...@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. While you are at it, if you want to squeeze
cycles, you can implement the median in Cython too. Here is some code:

http://numpy-discussion.10968.n7.nabble.com/A-faster-median-Wirth-s-method-td14267.html


/David.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] median filtering a masked array

2014-11-06 Thread Stefan van der Walt
On 2014-11-06 11:10:29, Daπid davidmen...@gmail.com wrote:
 On 5 November 2014 19:11, Moroney, Catherine M (398E)
 catherine.m.moro...@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
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion