kappa_sdk.trunc_vector#

kappa_sdk.trunc_vector(vector, min_elapsed_time, max_elapsed_time=None)[source]#

Truncates the provided vector based on the specified elapsed time constraints.

This function returns a new vector containing only the portion of the original vector’s data that falls within the range specified by min_elapsed_time and max_elapsed_time. The function identifies the indices corresponding to these elapsed time constraints, and slices the original vector’s dates and values arrays accordingly. If max_elapsed_time is not provided, all entries with elapsed time greater than min_elapsed_time are included.

Parameters:
  • vector (Vector) – The input vector containing time series data with attributes dates, values, and elapsed_times.

  • min_elapsed_time (float) – The minimum elapsed time for truncating the vector. Only data with elapsed time greater than this value will be included in the output.

  • max_elapsed_time (float, optional) – The maximum elapsed time for truncating the vector. If provided, only data with elapsed time within the range of min_elapsed_time and max_elapsed_time will be included in the output. If not provided, all data beyond min_elapsed_time will be included.

Returns:

Vector – A new Vector instance containing truncated dates, values, and their corresponding elapsed times within the specified range.

Return type:

Vector