Your Linux Data Center Experts

After some great comments related to my previous release, I've completely re-worked the movingaverage module and released it on PyPi (with the development still going on over at github.

I ended up switching all the results to use floating-points, because that really is what makes sense. I also found that my original algorithm, if I didn't do the full sum of the subset every time, was quite a lot faster than the deque version, but at the cost of not working with iterables, only with lists.

So in the end I have both algorithms, and also the ability to do a full re-sum, or use a rolling sum (the default is to re-sum because I know it's going to be as accurate as the computer can make it, with no chance for floating point drift). I may be being over-careful here, but I know that to some people this matters a lot and I know that I don't know enough about floating-point math to know how big a problem it may be.

So my one-line function is now over 200 lines, and around 5 hours of development, tuning and testing. :-) Admittedly, most of that is tests, but it's still grown quite a lot. I sure was glad to have the tests today when I re-wrote it.

comments powered by Disqus

Join our other satisfied clients. Contact us today.