stringertheory / traces

A Python library for unevenly-spaced time series analysis
http://traces.readthedocs.io
MIT License
530 stars 58 forks source link

sample at some time vs sample on some interval (~ moving_average) #43

Open sdementen opened 8 years ago

sdementen commented 8 years ago

I would like to prepare a PR to improve the efficiency of moving_average with pandas=True. I have already the code but I am wondering how to call the function that does this.

More generally, when converting the traces to some regularly spaced pandas time-series, we can either:

What name could be use for this "sample on an interval through an 'aggregation' function" ? Would sample_interval makes sense ? would the sample be renamed to sample_instant ?

stringertheory commented 8 years ago

Having a pandas keyword argument on moving_average is another good idea! Thanks for making these issues and pull requests.

On the more general case, I think this might be accomplished by making a function that can do arbitrary convolutions (of which moving average is a special case). That was something that @vlsd mentioned at some point, but we decided against it for the time being since it started to seem too "heavy" for traces in it's current state.

If you're interesting in taking a crack, I think this article is a good resource.

sdementen commented 8 years ago

The need is much more basic than convolutions (which are relatively expensive operations AFAIK). It is just to transform (without moving averages) the TimeSeries to the equivalent pandas Series in a very efficient way. I'll give a shot on a PR on a sample_interval function.