transform_image

sofia_redux.instruments.forcast.undistort.transform_image(data, xin, yin, xout, yout, header=None, variance=None, order=4, get_dxy=False, extrapolate=False)[source]

Transform an image and update header using coordinte point mapping

Transforms an image such that points in (yin, xin) are warped to (yout, xout) in the output image. If a header is supplied, any WCS information will be updated accordingly. Note that order is only important if you are doing a polynomial warp.

Parameters:
datanumpy.ndarray

input image (nrow, ncol)

xinarray-like

warping input x-coordinates

yinarray-like

warping input y-coordinates

xoutarray-like

warping output x-coordinates

youtarray-like

warping output y-coordinates

variancenumpy.ndarray, optional

variance array to update in parallel with the data array

headerastropy.io.fits.header.Header, optional

FITS header to update WCS

orderint, optional

Order of the polynomial used to warp the image.

get_dxybool, optional

If True

extrapolatebool, optional

If False, values outside of the rectangular range of xout and yout will be set to cval.

Returns:
2-tuple or 3-tuple
  • warped output image (nrow, ncol)

  • warped variance (nrow, ncol)

  • dxy, optional output from update_wcs