I'm approximating a first order derivative of an array in numpy using np.ediff1d:
x=array([ 1,  2,  5, 10])
np.ediff1d(x) # = array([1, 3, 5])
np.ediff1d uses consecutive elements of the array. Is there a way to control the spacing i.e. is there a numpy function that calculates the difference between every n-th element, as sliding window?
example: newdiff(x, window=2) would be: [5-1, 10-2] or [4, 8].