sliding metrics

apply_multiple_to_sliding_windows(array, window_size, funcs, slices=None)

Apply multiple functions to sliding windows of an array.

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

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

  • funcs (Iterable[Callable]) – The functions to apply.

  • slices (Iterable[slice] | None, default: None) – The slices to apply the functions to (slicing the moving window).

Return type:

ndarray

sliding_max(array, window_size)

Calculate the sliding maximum of an array.

Parameters:
  • array (ndarray) – The input array

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

Return type:

ndarray

sliding_mean(array, window_size)

Calculate the sliding mean of an array.

Parameters:
  • array (ndarray) – The input array

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

Return type:

ndarray

sliding_median(array, window_size)

Calculate the sliding median of an array.

Parameters:
  • array (ndarray) – The input array

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

Return type:

ndarray

sliding_min(array, window_size)

Calculate the sliding minimum of an array.

Parameters:
  • array (ndarray) – The input array

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

Return type:

ndarray

sliding_quantile(array, window_size, q)

Calculate a sliding quantile of an array.

Parameters:
  • array (ndarray) – The input array

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

  • q (float) – The quantile to calculate

Return type:

ndarray

sliding_quantiles(array, window_size, quantiles)

Calculate sliding quantiles of an array.

Parameters:
  • array (ndarray) – The input array

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

  • quantiles (Iterable[float]) – The quantiles to calculate

Return type:

ndarray