#NEWLINE# def make_slices( data , win_size ) : #NEWLINE# #INDENT# 'Return a list of slices given a window size.\n\n    data     - two-dimensional array to get slices from\n    win_size - tuple of (rows, columns) for the moving window\n    ' #NEWLINE# rows = ( ( data . shape [ 0 ] - win_size [ 0 ] ) + 1 ) #NEWLINE# cols = ( ( data . shape [ 1 ] - win_size [ 1 ] ) + 1 ) #NEWLINE# slices = [ ] #NEWLINE# for i in range ( win_size [ 0 ] ) : #NEWLINE# #INDENT# for j in range ( win_size [ 1 ] ) : #NEWLINE# #INDENT# slices . append ( data [ i : ( rows + i ) , j : ( cols + j ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# return slices