webbpsf_ext.image_manip.image_rescale

webbpsf_ext.image_manip.image_rescale(HDUlist_or_filename, pixscale_out, pixscale_in=None, dist_in=None, dist_out=None, cen_star=True, shape_out=None)[source]

Rescale image flux

Scale the flux and rebin an image to some new pixel scale and distance. The object’s physical units (AU) are assumed to be constant, so the total angular size changes if the distance to the object changes.

IT IS RECOMMENDED THAT UNITS BE IN PHOTONS/SEC/PIXEL (not mJy/arcsec)

Parameters
  • HDUlist_or_filename (HDUList or str) – Input either an HDUList or file name.

  • pixscale_out (float) – Desired pixel scale (asec/pix) of returned image. Will be saved in header info.

Keyword Arguments
  • pixscale_in (float or None) – Input image pixel scale. If None, then tries to grab info from the header.

  • dist_in (float) – Input distance (parsec) of original object. If not set, then we look for the header keywords ‘DISTANCE’ or ‘DIST’.

  • dist_out (float) – Output distance (parsec) of object in image. Will be saved in header info. If not set, then assumed to be same as input distance.

  • cen_star (bool) – Is the star placed in the central pixel? If so, then the stellar flux is assumed to be a single pixel that is equal to the maximum flux in the image. Rather than rebinning that pixel, the total flux is pulled out and re-added to the central pixel of the final image.

  • shape_out (tuple, int, or None) – Desired size for the output array (ny,nx). If a single value, then will create a 2-element tuple of the same value.

Returns

HDUlist of the new image.