[Numpy-discussion] Overlapping time series

Daniele Nicolodi daniele at grinta.net
Tue Feb 11 17:54:28 EST 2014


On 11/02/2014 18:18, Sturla Molden wrote:
> Daniele Nicolodi <daniele at grinta.net> wrote:
> 
>> That's more or less my current approach (except that I use the fact that
>> the data is evenly samples to use np.where(np.diff(t1) != dt) to detect
>> the regions of continuous data, to avoid the loop.
> 
> I hope you realize that np.where(np.diff(t1) != dt) generates three loops,
> as well as two temporary arrays and one output array. If you do what I
> suggested, you get one loop and no temporaries. But you will need Numba or
> Cython to get full speed.

Sure, I realize that, thank for the clarification.  The arrays are quite
small, then the three loops and the temporary take negligible time and
memory in the overall processing.  I was lazy and I did not want to
write in Cython, however I didn't benchmark the exact solution you
propose written in pure python...

Cheers,
Daniele





More information about the NumPy-Discussion mailing list