I understand that similar questions have been posted here before, but I can't seem to wrap my head around how np.lib_stride_tricks.as_strided
works. I would like to know if there is a numpy function that lets me do the following mapping from a -> b
efficiently:
import numpy as np
a = np.random.rand(100000,3)
window_length = 200;
spacing = 20;
b = []
for i in range(0,a.shape[0] - window_length,spacing):
b.append(a[i:i+window_length,:])
b = np.asarray(b);
print(b.shape)
Which outputs (4490,200,3)
.