ktk.TimeSeries.shift#

TimeSeries.shift(time, *, in_place=False)[source]#

Shift time and events.time.

Parameters
  • time (float) – Time to be added to time and events.time.

  • in_place (bool) – Optional. True to modify and return the original TimeSeries. False to return a modified copy of the TimeSeries while leaving the original TimeSeries intact. Default is False.

Returns

The TimeSeries with the time being shifted.

Return type

TimeSeries

Example

>>> ts = ktk.TimeSeries(time=np.arange(10)/10)
>>> ts = ts.add_event(0.35, "start")
>>> ts.time
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
>>> ts.events
[TimeSeriesEvent(time=0.35, name='start')]
>>> ts = ts.shift(0.2)
>>> ts.time
array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1])
>>> ts.events
[TimeSeriesEvent(time=0.55, name='start')]