ktk.TimeSeries.count_events

ktk.TimeSeries.count_events#

TimeSeries.count_events(name)[source]#

Count the number of occurrence of a given event name.

Parameters:

name (str) – The name of the events to count.

Returns:

The number of occurrences.

Return type:

int

Example

>>> # Instanciate a timeseries with some events
>>> ts = ktk.TimeSeries()
>>> ts = ts.add_event(5.5, "event1")
>>> ts = ts.add_event(10.8, "event2")
>>> ts = ts.add_event(20.3, "event2")
>>> ts.count_events("event2")
2