Given a series of event times v, I can create their interval durations using np.diff(v). Is there a way to have np.diff assume the ser
As of 2019, np.diff has the arguments prepend and append that can add a certain value to the array before differentiation. See the docs
This would append the first value to the array, hence the diff operation would return something of len(t) that starts with 0.
>>> t = np.array([1.1, 2.0, 4.5, 4.9, 5.2])
>>> np.diff(t, prepend=t[0])
array([0. , 0.9, 2.5, 0.4, 0.3])
The prepend argument can take other values.