[Numpy-discussion] Rolling window (moving average, moving std, and more)

Erik Rigtorp erik at rigtorp.com
Mon Jan 3 11:32:07 EST 2011

On Mon, Jan 3, 2011 at 11:26, Eric Firing <efiring at hawaii.edu> wrote:
> Instead of calculating statistics independently each time the window is
> advanced one data point, the statistics are updated.  I have not done
> any benchmarking, but I expect this approach to be quick.

This might accumulate numerical errors. But could be fine for many applications.

> The code is old; I have not tried to update it to take advantage of
> cython's advances over pyrex.  If I were writing it now, I might not
> bother with the C level at all; it could all be done in cython, probably
> with no speed penalty, and maybe even with reduced overhead.

No doubt this would be faster, I just wanted to offer a general way to
this in NumPy.

More information about the NumPy-Discussion mailing list