Merging Of The Conventions
The full implementation of all these elements ends up merging the SIP, DET2IM and FITS Distortion Paper conventions to create a new version of the figure from the FITS Distortion Paper which illustrates the conversion of detector coordinates to world coordinates. This implementation works in the following way:
Apply detector to image correction (DET2IM) to input pixel values
Apply SIP coefficients to DET2IM-corrected pixel values
Apply lookup table correction to DET2IM-corrected pixel values
Add the results of the SIP and lookup table corrections
Apply the WCS transformation in the CD matrix to the summed results to get the intermediate world coordinates
Add the CRVAL keyword values to the transformed positions to get the final world coordinates
The computations to perform these steps can be described approximately using:
(1)
(2)
(3)
where f(u’,v’) and g(u’,v’) represent the polynomial distortion correction specified as
(4)
where
x’, y’ are the initial coordinates x,y with the 68th column correction applied through the DET2IM convention
u’,v’ are the DET2IM-corrected coordinates relative to CRPIX1,CRPIX2
is the residual distortion in the lookup tables written to the header using the FITS Distortion Paper lookup table convention
A, B are the SIP coefficients specified using the SIP convention
These equations do not take into account the deprojection from the tangent plane to sky coordinates. The complete Detector To Sky Coordinate Transformation is based on the CTYPE keyword.