slmsuite.holography.toolbox.pad#

pad(matrix, shape)[source]#

Helper function to pad data with zeros. The padding is centered. This is used to get higher resolution in the \(k\)-space upon Fourier transform.

Parameters:
  • matrix (numpy.ndarray) – Data to pad.

  • shape ((int, int) OR None) – The desired shape of the matrix in numpy (h, w) form. If None, the matrix is returned unpadded.

Returns:

Padded matrix.

Return type:

numpy.ndarray