I\'m trying to using numpy.lib.stride_tricks.as_strided to iterate over non-overlapping blocks of an array, but I\'m having trouble finding documentation of the parameters,
Using @unutbu's answer as an example, I wrote a function that implements this tiling trick for any ND array. See below for link to source.
>>> a = numpy.arange(1,21).reshape(4,5)
>>> print a
[[ 1 2 3 4 5]
[ 6 7 8 9 10]
[11 12 13 14 15]
[16 17 18 19 20]]
>>> blocks = blockwise_view(a, blockshape=(2,2), require_aligned_blocks=False)
>>> print blocks
[[[[ 1 2]
[ 6 7]]
[[ 3 4]
[ 8 9]]]
[[[11 12]
[16 17]]
[[13 14]
[18 19]]]]
[blockwise_view.py] [test_blockwise_view.py]