def cal_event_count(timestamps):
"""Calculate event count based on timestamps.
Parameters
----------
timestamps : numpy.ndarray
timestamps array in 1D array
Returns
-------
event_arr : numpy.ndarray
array has 2 rows, first row contains timestamps,
second row consists of corresponding event count at particular
timestep
"""
event_ts, event_count = np.unique(timestamps, return_counts=True)
return np.asarray((event_ts, event_count))
评论列表
文章目录