def strided_app(a, L, S):
    nrows = (a.size - L) // S + 1
n = a.strides[0]
return np.lib.stride_tricks.as_strided(a, shape=(nrows, L), strides=(S * n, n))
Taking subarrays from numpy array with given stride/stepsize