ktk.TimeSeries.get_index_after_time#
- TimeSeries.get_index_after_time(time, *, inclusive=False)[source]#
Get the time index that is just after the specified time.
- Parameters:
time (float) – Time to look for in the TimeSeries’ time attribute.
inclusive (bool) – Optional. True to include the given time in the comparison.
- Returns:
The index in the time attribute.
- Return type:
int
- Raises:
TimeSeriesRangeError – If the resulting index would be outside the TimeSeries range.
See also
ktk.TimeSeries.get_index_before_time
,ktk.TimeSeries.get_index_at_time
,ktk.TimeSeries.get_index_before_event
,ktk.TimeSeries.get_index_at_event
,ktk.TimeSeries.get_index_after_event
Example
>>> ts = ktk.TimeSeries(time=np.array([0, 0.5, 1, 1.5, 2]))
>>> ts.get_index_after_time(0.9) 2
>>> ts.get_index_after_time(0.9, inclusive=True) 2
>>> ts.get_index_after_time(1) 3
>>> ts.get_index_after_time(1, inclusive=True) 2