register

sofia_redux.instruments.forcast.register.register(data, header, reference=None, variance=None, crpix=None, position=None, get_offsets=False, missing=nan, algorithm=None)[source]

Use dither data to shift_image input image to a reference image.

This function shifts dithered observations of the same object into the same pixel coordinate system, in preparation for coaddition of the images. No rotation or scaling is performed. The method for determining the shift_image is read from the configuration file.

In the configuration file, if CORCOADD is set to to CENTROID, then a centroiding algorithm is used to determine the shift_image. If CORCOADD is XCOR, a cross-correlation algorithm is used. If CORCOADD is HEADER, ir no reference data is provided, then dither information from the FITS header is used to determine the shift_image. If CORCOADD is NOSHIFT, then no shift_image is performed. If the centroiding algorithm is selected and it fails for any reason, then a header shift_image algorithm is used instead. If a reference source position and new source position are provided in <parameter: reference> and <parameter: position>, they will be used to determine the shift_image, regardless of the value of CORCOADD.

The order of the interpolation used to shift_image the data is determined by the SHIFTORD keyword in the configuration file. SHIFTORD=1 or 3 will interpolate to perform sub-pixel shifts; SHIFTORD=0 will shift_image by integer pixels (no interpolation).

Parameters:
datanumpy.ndarray

The image to register (nrow, ncol)

headerastropy.io.fits.header.Header

The FITS header of the input data file

referencenumpy.ndarray or 2-tuple, optional

The reference image or data to register to. May be an image array (for centroiding or cross-correlation) or a source position (x, y). If a reference source position is provided in REFDATA, a new source position must be provided in <parameter: position>. If <parameter: reference> is not specified, and the algorithm is not NOSHIFT, then header data will be used to register the image.

variancenumpy.ndarray, optional

Variance array (nrow, ncol) to update in parallel with the data array.

crpixarray_like, optional

2-element (x, y) array to update

position2-tuple, optional

Position (x, y) to register to a reference position provided in <parameter: reference>, used with the interactive USER registration algorithm.

get_offsetsbool, optional

If True, only return the (x, y) shift. Headers will still be updated

missingfloat, optional

Value to represent missing data during shift

algorithmstr, optional

Algorithm to use when registering images. Default is to read from the configuration.

Returns:
2-tuple

numpy.ndarray : Registered image array (nrow, ncol) numpy.ndarray : Registered variance array (nrow, ncol)