sigpy.array_to_blocks¶
-
sigpy.
array_to_blocks
(input, blk_shape, blk_strides)[source]¶ Extract blocks from an array in a sliding window manner.
Parameters: - input (array) – input array of shape […, N_1, …, N_ndim]
- blk_shape (tuple) – block shape of length ndim, with ndim={1, 2, 3}.
- blk_strides (tuple) – block strides of length ndim.
Returns: - array of shape […] + num_blks + blk_shape, where
num_blks = (N - blk_shape + blk_strides) // blk_strides.
Return type: array
Example
>>> input = np.array([0, 1, 2, 3, 4, 5]) >>> print(array_to_blocks(input, [2], [2])) [[0, 1], [2, 3], [4, 5]]