webbpsf_ext.image_manip.frebin

webbpsf_ext.image_manip.frebin(image, dimensions=None, scale=None, total=True)[source]

Fractional rebin

Python port from the IDL frebin.pro Shrink or expand the size of a 1D or 2D array by an arbitary amount using bilinear interpolation. Conserves flux by ensuring that each input pixel is equally represented in the output array. Can also input an image cube.

Parameters
  • image (ndarray) – Input image ndarray (1D, 2D). Can also be an image cube assumed to have shape [nz,ny,nx].

  • dimensions (tuple or None) – Desired size of output array (take priority over scale).

  • scale (tuple or None) – Factor to scale output array size. A scale of 2 will increase the number of pixels by 2 (ie., finer pixel scale).

  • total (bool) – Conserves the surface flux. If True, the output pixels will be the sum of pixels within the appropriate box of the input image. Otherwise, they will be the average.

Returns

ndarray – The binned ndarray