import pynapple as nap
import numpy as np
times = np.arange(0, 10, 0.01)
signal = np.sin(2 * np.pi * times)
signal += 0.2 * np.random.randn(len(times))
tsd = nap.Tsd(t=times, d=signal)
above = tsd.threshold(0.5, method="above")
below = tsd.threshold(-.5, method="below")
above.time_supportindex start end
0 0.08499999999999999 0.41500000000000004
1 0.435 0.445
2 1.0350000000000001 1.045
3 1.065 1.0750000000000002
4 1.0950000000000002 1.375
5 1.3850000000000002 1.395
6 1.415 1.4449999999999998
... ... ...
37 8.225000000000001 8.395
38 8.415 8.445
39 8.455 8.465
40 9.065000000000001 9.085
41 9.105 9.125
42 9.145 9.405000000000001
43 9.415 9.425
shape: (44, 2), time unit: sec.
