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)
averaged = tsd.bin_average(0.2)
averagedTime (s)
------------------- -----------
0.1 0.573978
0.30000000000000004 0.962575
0.5 0.00361431
0.7 -0.861522
0.9 -0.531668
1.1 0.524144
1.3 0.957296
...
8.7 -0.928359
8.9 -0.665632
9.1 0.603838
9.299999999999999 0.82521
9.5 0.00247119
9.7 -0.788964
9.9 -0.498428
dtype: float64, shape: (50,)
