ktk.TimeSeries.get_ts_between_indexes#
- TimeSeries.get_ts_between_indexes(index1, index2, *, inclusive=False)[source]#
Get a TimeSeries between two specified time indexes.
- Parameters:
index1 (int) – Time indexes
index2 (int) – Time indexes
inclusive (bool | tuple[bool, bool]) –
Optional. Either a bool or a tuple of two bools. Used to specify which indexes are returned:
False or (False, False) (default): index1 < index < index2
True or (True, True): index1 <= index <= index2
(True, False): index1 <= index < index2
(False, True): index1 < index <= index2
- Returns:
A new TimeSeries that fulfils the specified conditions.
- Return type:
- Raises:
TimeSeriesRangeError – If there is no data between the specified indexes.
See also
ktk.TimeSeries.get_ts_between_times
,ktk.TimeSeries.get_ts_between_events
,ktk.TimeSeries.get_ts_before_index
,ktk.TimeSeries.get_ts_after_index
Example
>>> ts = ktk.TimeSeries(time=np.arange(10)/10) >>> ts.time array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
>>> ts.get_ts_between_indexes(2, 5).time array([0.3, 0.4])
>>> ts.get_ts_between_indexes(2, 5, inclusive=True).time array([0.2, 0.3, 0.4, 0.5])
>>> ts.get_ts_between_indexes(2, 5, inclusive=[True, False]).time array([0.2, 0.3, 0.4])