[Numpy-discussion] Managing Rolling Data

Alexander Michael lxander.m at gmail.com
Fri Feb 23 11:09:29 EST 2007


Timothy's refinement of Anne's idea will work for me:

>>> import timeit
>>> print '%.2fms/push' % (1000 * timeit.Timer(
...    "a[...,:-1] = a[...,1:]",
...    "from numpy import empty; a = empty((5000,20,1000))"
...    ).timeit(number=10)/10)

537.86ms/push

I still find the ring buffer solution appealing, but I did not see a
way to stack two arrays together without creating copies. Am I missing
a bit of numpy cleverness?

Thank you everyone for your help,
Alex



More information about the NumPy-Discussion mailing list