ptypy.utils.array_utils.grids#

ptypy.utils.array_utils.grids(sh, psize=None, center='geometric', FFTlike=True)#

q0,q1,... = grids(sh) returns centered coordinates for a N-dimensional array of shape sh (pixel units)

q0,q1,... = grids(sh,psize) gives the coordinates scaled according to the given pixel size psize.

q0,q1,... = grids(sh,center='fftshift') gives the coordinates shifted according to fftshift convention for the origin

q0,q1,... = grids(sh,psize,center=(c0,c1,c2,...)) gives the coordinates according scaled with psize having the origin at (c0,c1,..)

Parameters:
  • sh (tuple of int) – The shape of the N-dimensional array

  • psize (float or tuple of float) – Pixel size in each dimensions

  • center (tupel of int) – Tuple of pixel, or use center='fftshift' for fftshift-like grid and center='geometric' for the matrix center as grid origin

  • FFTlike (bool) – If False, grids ar not bound by the interval [-sh//2:sh//2[

Returns:

The coordinate grids

Return type:

ndarray