tsdownsample icon indicating copy to clipboard operation
tsdownsample copied to clipboard

Is a constant sampling rate required?

Open lcs-crr opened this issue 1 year ago • 2 comments

In your Usage window, it says that a constant sampling rate is assumed. Is that generally the case, or just in the example? Under Limitations and Assumptions nothing is mentioned, hence the question :)

lcs-crr avatar Jul 02 '24 10:07 lcs-crr

Nope, this is not required :)

This library assumes a constant sampling rate if only y is passed to the downsample function. If both x and y are passed, the x data is used to determine the bin sizes / find gaps when downsampling.

Hope this answers your question!

  • Jeroen

jvdd avatar Jul 02 '24 14:07 jvdd

Hi Jeroen, but the output data remains variably sampled right? Is there a way to convert to a fixed sample rate when remapling?

lcs-crr avatar Jul 09 '24 15:07 lcs-crr

Yes, you can do that with resampling functions - which is not part of this library (as the focus of tsdownsample is shape-preserving data point selection; in other words, tsdownsample selects point from the original time series).

More information about resampling functions:

  • pandas documentation: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.resample.html
  • polars documentation: https://docs.pola.rs/user-guide/transformations/time-series/resampling/

jvdd avatar Jan 31 '25 06:01 jvdd