Re: [Numpy-discussion] best way of speeding up a filtering-like algorithm

2018-03-29 Thread Jaime Fernández del Río
Hi Catherine, One problem with sliding window algorithms is that the straightforward approach can be very inefficient. Ideally you would want to not recompute your windowed quantity from all points in the window, but to reuse the result from an overlapping window and only take into account the poi

Re: [Numpy-discussion] best way of speeding up a filtering-like algorithm

2018-03-29 Thread Chris Barker
one other note: As a rule, using numpy array operations from Cython doesn't buy you much, as you discovered. YOu need to use numpy arrays as n-d containers, and write the loops yourself. You may want to check out numba as another alternative -- it DOES optimize numpy operations. -CHB On Wed,

Re: [Numpy-discussion] best way of speeding up a filtering-like algorithm

2018-03-29 Thread Chris Barker
sorry, not enough time to look closely, but a couple general comments: On Wed, Mar 28, 2018 at 5:56 PM, Moroney, Catherine M (398E) < catherine.m.moro...@jpl.nasa.gov> wrote: > I have the following sample code (pretty simple algorithm that uses a > rolling filter window) and am wondering what the

Re: [Numpy-discussion] best way of speeding up a filtering-like algorithm

2018-03-29 Thread Stuart Reynolds
Install snakeviz to visualize what’s taking all the time. You might want to check out numba.jit(nopython) for optimizing specific sections. On Wed, Mar 28, 2018 at 9:10 PM Joseph Fox-Rabinovitz < jfoxrabinov...@gmail.com> wrote: > It looks like you are creating a coastline mask (or a coastline