Normalize numpy array shapes so they’re always expressed as a tuple, even for one-dimensional shapes.
- shape - an int, or a tuple of ints
- a shape tuple
sliding_window(a, ws, ss=None, flatten=True)¶
Return a sliding window over a in any number of dimensions
a - an n-dimensional numpy array ws - an int (a is 1D) or tuple (a is 2D or greater) representing the sizeof each dimension of the window
- ss - an int (a is 1D) or tuple (a is 2D or greater) representing the
- amount to slide the window in each dimension. If not specified, it defaults to ws.
- flatten - if True, all slices are flattened, otherwise, there is an
- extra dimension for each dimension of the input.
- an array containing each n-dimensional window from a