frame_image

sofia_redux.instruments.forcast.undistort.frame_image(image, shape, header=None, variance=None, border=0, wcs=True)[source]

Frame an image in the center of a new image and add border

The size of the new image must be larger than the original in both dimensions. There is a hard-coded border minimum of 5 pixels. Unfilled pixels are set to NaN.

Parameters:
imagenumpy.ndarray

input data array (nrow, ncol) to be inserted in the center of the output image

headerastropy.io.fits.header.Header

input FITS header. WCS will be updated and HISTORY messages will be added.

shape2-tuple of int

shape of the output image without the border (nrow, ncol) NOTE - Python (y, x) order please

variancenumpy.ndarray

variance array (nrow, ncol) to update in parallel with image.

borderint, optional

default border to add around image. This will only be applied if ‘BORDER’ is in neither the header nor the drip configuration. The minimum border allowed is 5.

wcsbool, optional

If True update the WCS in the header. Will only update keywords that already exist.

Returns:
2-tuple

numpy.ndarray : output data (nrow?, ncol?) numpy.ndarray : output variance (nrow?, ncol?)

Notes

The output array shapes are not definitively predicted beforehand. border merely indicates the minimum size of the output arrays. If the distortion results in an output image that is larger than (ny, nx) + 2*border, the border will be expanded to ensure that no errors are encountered. border should be set in the drip configuration file as that value will override any value supplied to sofia_redux.instruments.forcast.undistort or extracted from the header.