[Numpy-discussion] view 1d array as overlapping segments?

Neal Becker ndbecker2 at gmail.com
Mon Mar 7 10:01:21 EST 2011


reshape can view a 1d array as non-overlapping segments.

Is there a convenient way to view a 1d array as a 2d array of overlapping 
segments?

nonoverlapping:
l: segment length
k: overlap
u is the 1d array
v is a 2d array

v[i] = u[l*i:(l+1)*i]

overlapping:
v[i] = u[l*i:(l+1)*i+k]




More information about the NumPy-Discussion mailing list