webbpsf_ext.image_manip.fourier_imshift

webbpsf_ext.image_manip.fourier_imshift(image, xshift, yshift, pad=False, cval=0.0, window_func=None, **kwargs)[source]

Fourier shift image

Shift an image by use of Fourier shift theorem

Parameters:
  • image (ndarray) – 2D image or 3D image cube [nz,ny,nx].

  • xshift (float) – Number of pixels to shift image in the x direction.

  • yshift (float) – Number of pixels to shift image in the y direction.

  • pad (bool) – Should we pad the array before shifting, then truncate? Otherwise, the image is wrapped.

  • cval (sequence or float, optional) – The values to set the padded values for each axis. Default is 0. ((before_1, after_1), … (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or int is a shortcut for before = after = constant for all axes.

  • window_func (string, float, or tuple) – Name of window function from scipy.signal.windows to use before Fourier shifting. The idea is to reduce artifacts from high frequency information during sub-pixel shifting. This effectively acts as a low-pass filter applied to the Fourier transform of the image prior to shifting. Uses skimage.filters.window() to generate the window. For example:

    window_func=’hann’ window_func=(‘tukey’, 0.25) # alpha=0.25 window_func=(‘gaussian’, 5) # std dev of 5 pixels

    Available options can be found:

    https://docs.scipy.org/doc/scipy-1.12.0/reference/signal.windows.html

Returns:

ndarray – Shifted image