JuliaStats / TimeSeries.jl

Time series toolkit for Julia
Other
349 stars 69 forks source link

Extend TimeSeries functionality for multi-rate series and fixed sampling rates? #376

Open sairus7 opened 5 years ago

sairus7 commented 5 years ago

Is it possible to extend TimeSeries functionality for multi-rate time series and time series with no time array?

I do not need to store array of time values, if I have start timestamp and fixed sampling rate, because I can simply calculate time value at given array index. In that case, start time and sampling rate together can be treated as a sort of "Time Grid".

For multi-rate time series data, I can define:

I want to be able to synchronize these datasets with each other (automatically "map" their time indices with each other) and build streaming processing algorithms on their basis. Schematically this can be shown as follows:

time_series_data

ssfrr commented 5 years ago

For fixed samplerate data you may want to look at SampledSignals.jl or AxisArrays.jl, both of which are designed for regularly-sampled data.

They don't have any special handling for data that's sampled at a decimated version of some shared higher-frequency clock, but they do allow you to index using time, which makes it easier to compare data at different sampling rates.

iblislin commented 5 years ago

Maybe you can check the SimpleTime example here? https://github.com/JuliaStats/TimeSeries.jl/pull/363#issue-177456913

And creating a WIP PR is welcomed, than we can co-work on your multi-rate time series type.

femtotrader commented 5 years ago

I personally don't understand if there is an order relationship between index1, index2 and index3. Maybe you should consider using a PriorityQueue (from Heaps.jl or DataStructures.jl ) for the streaming approach you are looking for. You will probably need to create a function dequeues!(pq) to remove (all) the lowest priority keys from a priority queue and return an array which contains those keys.

sairus7 commented 5 years ago

For fixed samplerate data you may want to look at SampledSignals.jl or AxisArrays.jl

Maybe you can check the SimpleTime example here? #363 (comment)

Thank you for examples!

I personally don't understand if there is an order relationship between index1, index2 and index3.

The order between indices is defined by the processing steps, that generate one time series from another. This particular figure above shows decimation, then event detection on decimated series. (What is not shown here is data delays from processing steps.)

Of course, all these indices can be converted to times or indices in base frequency. Maybe, this is some kind of "interval mapping" and intersection, where each data point is bound through continuous sample time interval with a set of other points with other sample times.

The problem is, for streaming processing I want to ask "last 30-sec average centered to this point", "nearest time event up to this point", "all time events inside last 30-sec window" etc. Every time I want to do that, I should write additional loops to look for correct indices, then save last look position until next data chunk.

Probably, once I create WIP PR, it should be clearer.