pynapple.TsGroup.time_diff#
- TsGroup.time_diff(align='center', epochs=None)[source]#
Computes the differences between subsequent timestamps.
- Parameters:
align (str, optional) –
- Determines the time index of the resulting time differences:
”start” : the start of the interval between two timestamps.
”center” [default]: the center of the interval between two timestamps.
”end” : the end of the interval between two timestamps.
epochs (IntervalSet, optional) – The epochs on which interspike intervals are computed. If None, the time support of the input is used.
- Returns:
A dictionary of Tsd containing the time differences for each Ts in the group.
- Return type:
dict
Examples
>>> import pynapple as nap >>> import numpy as np >>> tmp = { 0:nap.Ts(t=[1, 3, 5, 6, 8, 12], time_units='s'),1:nap.Ts(t=[2, 8, 9, 13, 14, 17], time_units='s'), 2:nap.Ts(t=[1, 2, 5, 7, 9, 12], time_units='s')} >>> tsgroup = nap.TsGroup(tmp) >>> epochs = nap.IntervalSet(start=2, end=9, time_units='s') >>> time_diffs = tsgroup.time_diff(align="center", epochs=epochs) >>> time_diffs {0: Time (s) ---------- -- 4 2 5.5 1 7 2 dtype: float64, shape: (3,), 1: Time (s) ---------- -- 5 6 8.5 1 dtype: float64, shape: (2,), 2: Time (s) ---------- -- 3.5 3 6 2 8 2 dtype: float64, shape: (3,)}