ktk.TimeSeries.get_ts_after_event#

TimeSeries.get_ts_after_event(name, occurrence=0, *, inclusive=False)[source]#

Get a TimeSeries after the specified event.

Parameters
  • name (str) – Name of the event to look for in the events list.

  • occurrence (int) – Optional. i_th occurence of the event to look for in the events list, starting at 0.

  • inclusive (bool) – Optional. True to include the given event in the comparison.

Returns

A new TimeSeries that fulfils the specified conditions.

Return type

TimeSeries

Raises

TimeSeriesRangeError – If there is no data after the specified event.

Example

>>> ts = ktk.TimeSeries(time=np.arange(10)/10)
>>> ts = ts.add_event(0.2, "event")
>>> ts = ts.add_event(0.35, "event")
>>> 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_after_event("event").time
array([0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
>>> ts.get_ts_after_event("event", inclusive=True).time
array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
>>> ts.get_ts_after_event("event", 1).time
array([0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
>>> ts.get_ts_after_event("event", 1, inclusive=True).time
array([0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])