transfer_wcs_correction
- jwst.tweakreg.utils.transfer_wcs_correction(to_image, from_image, matrix=None, shift=None)[source]
Apply WCS corrections from one image to another.
Applies the same total WCS correction that was applied by
tweakreg(!) to the WCS in thefrom_imagedata model to the WCS of theto_imagedata model. In some ways this function is analogous function to thetweakbackfunction for HST available in the drizzlepac package.One fundamental difference between this function and
tweakbackis that JWST data models do not keep a history of data’s WCS via alternative WCS as it is done in HST data and so it is impossible to select and apply only one particular WCS correction if there were multiple corrections previously applied to a WCS. The tangent-plane correction in JWST WCS is cumulative/total correction. If you would like to apply a specific/custom correction, you can do that viamatrixandshiftarguments which is defined in the reference tangent plane provided by thefrom_image’s WCS.When providing your own corrections via
matrixandshiftarguments, this function is similar to theadjust_wcs()function but provides an alternative way of specifying corrections via affine transformations in a reference tangent plane.Warning
Upon return, if the
to_imageargument is anImageModelit will be modified in-place with an updatedImageModel.meta.wcsWCS model. Ifto_imageargument is a file name of anImageModel, that model will be read in, its WCS will be updated, and the updated model will be written out to the same file. BACKUP the file into_imageargument before calling this function.Warning
This function does not support input data models whose WCS were modified by
adjust_wcs(). Only WCS corrections computed by either thetweakregstep or bytweakwcspackage are supported.- Parameters:
- to_imagestr,
ImageModel Image model to which the correction should be applied/transferred to.
Warning
If it is a string file name then, upon return, this file will be overwritten with a data model with an updated WCS.
- from_imagestr,
ImageModel,gwcs.wcs.WCS A data model whose WCS was previously corrected. This data model plays two roles: 1) it is the reference WCS which provides a tangent plane in which corrections have been defined, and 2) it provides WCS corrections to be applied to
to_image’s WCS.If the WCS of the
from_imagedata model does not contain corrections, then bothmatrixandshiftarguments must be supplied.- matrixlist, ndarray, None, optional
A 2D matrix part of an affine transformation defined in the tangent plane derived from the
from_image’s WCS.Note
When provided,
shiftargument must also be provided in which casematrixandshiftarguments override the correction (if present) from thefrom_file’s WCS.- shiftlist, ndarray, None, optional
A list of length 2 representing the translational part of an affine transformation (in arcsec) defined in the tangent plane derived from the
from_image’s WCS.Note
When provided,
matrixargument must also be provided in which casematrixandshiftarguments override the correction (if present) from thefrom_file’s WCS.
- to_imagestr,