def _centered(arr, newsize):
 newsize = np.asarray(newsize)
 currsize = np.array(arr.shape)
 startind = ((currsize - newsize) // 2)
 endind = (startind + newsize)
 myslice = [slice(startind[k], endind[k]) for k in range(len(endind))]
 return arr[tuple(myslice)]

def _centered ( arr , newsize ) : newsize = np . asarray ( newsize ) currsize = np . array ( arr . shape ) startind = ( ( currsize - newsize ) // 2 ) endind = ( startind + newsize ) myslice = [ slice ( startind [ k ] , endind [ k ] ) for k in range ( len ( endind ) ) ] return arr [ tuple ( myslice ) ]
aux function to center data .