slmsuite.holography.toolbox.unpad#
- unpad(matrix, shape)[source]#
Helper function to unpad data. The padding is assumed to be centered. This is used to get higher resolution in the \(k\)-space upon Fourier transform.
- Parameters:
matrix (numpy.ndarray OR (int, int)) – Data to unpad, if this is a matrix. If this is a shape in
numpy(h, w)form, returns the four slicing integers used to unpad that shape[pad_b:pad_t, pad_l:pad_r].shape ((int, int) OR None) – The desired shape of the
matrixinnumpy(h, w)form. IfNone, thematrixis returned unchanged.
- Returns:
Either the unpadded
matrixor the four slicing integers used to unpad such a matrix, depending what is passed asmatrix.- Return type:
numpy.ndarray OR (int, int, int, int)