series operations

This module contains various utility functions for working with time series data represented as ndarray

filter_sliding_quantile_range(series, window_size, q_lower, q_upper, copy=True)

Filters a time series by sliding quantile range.

Parameters:
  • series (ndarray) – The time series data.

  • window_size (int) – The size of the sliding window.

  • q_lower (float) – The lower quantile.

  • q_upper (float) – The upper quantile.

  • copy (bool, default: True) – Whether to copy the series.

Return type:

ndarray

Returns:

The filtered time series data.

filter_sliding_quantile_range_1d(array, window_size, q_lower, q_upper)

Filter values of a 1D array within a sliding quantile range.

Parameters:
  • array (ndarray) – The input array.

  • window_size (int) – The size of the sliding window.

  • q_lower (float) – The lower quantile.

  • q_upper (float) – The upper quantile.

Return type:

ndarray

Returns:

The filtered array.

sample(series, timestamps_series, timestamps, *, keep_dtype)

Samples a time series at specified timestamps.

This function interpolates values from a time series at given timestamps. It uses linear interpolation to estimate values between the known data points.

Parameters: series: The time series data to sample. timestamps_series: The timestamps corresponding to the time series data. timestamps: The timestamps at which to sample the time series. keep_dtype: Whether to preserve the original data type of the series.

Return type:

ndarray

Returns:

The sampled time series data.

Parameters:
sample_1d(array, timestamps_array, timestamps, *, keep_dtype)

Sample a 1D array at specified timestamps, can be used for interpolation.

Parameters:
  • array (ndarray) – The input array.

  • timestamps_array (ndarray) – The timestamps corresponding to the input array.

  • timestamps (ndarray) – The timestamps at which to sample the array.

  • keep_dtype (bool) – Whether to keep the original data type of the array.

Return type:

ndarray

Returns:

The sampled array.

sign_change_latency(series)

Calculates the latency of sign changes in a time series.

Parameters:

series (ndarray) – The time series data.

Return type:

ndarray

Returns:

The latency of sign changes in the time series.

sign_change_latency_1d(array)

Calculate the latency between sign changes in a 1D array.

Parameters:

array (ndarray) – The input array.

Return type:

ndarray

Returns:

The latency between sign changes.

smooth(series, filter_funcs, copy=True)

Smooths a time series using a set of smoothing functions.

Parameters:
Return type:

ndarray

Returns:

The smoothed time series data.

smooth_1d(array, filter_funcs)

Smooth a 1D array using a series of smoothing functions.

Parameters:
Return type:

ndarray

Returns:

The smoothed array.