This transformation converts pixel coordinates fitsX, fitsY from an astronomical
image to celestial coordinates α, δ
(right ascension and declination) using
the WCS (World Coordinate System). The reference position α0, δ
0
is the celestial
position of the reference pixel crpix1,crpix2 stored in the header
as crval1, crval2. The transformation matrix is cd1_1, cd1_2, cd2_1,
cd2_2. Assuming TAN
projection.
are calculated using the SIP coefficients (A_i_j
, B_i_j
) asu:=fitsX -crpix1
v:=fitsY -crpix2
U =
u +
Σ A_i_j * u^i * v^j
V =
v +
Σ B_i_j * u^i * v^j
// Apply the CD
matrix transformation to get the intermediate standard coordinates
ξ
= (cd1_1 * U + cd1_2 * V
η
= (cd2_1 * U + cd2_2 * V
//
Step3, conversion from standard coordinates to celestial coordinates.
Assume Gnomonic (Tangent Plane) Projection ( CTYPE1= 'RA---TAN') ξ
=
ξ
*
π/180
η
=
η
*
π/180
α0 = crval1
δ0 = crval2
sincos(δ0, sinδ0,cosδ0)
delta = cosδ0 -
η
* sinδ0
α = α0 + arctan2(
ξ
, delta)
δ = arctan((sinδ0 +
η
* cosδ0) /
sqrt(
ξ
^2 + delta^2)
)
α = α * 180/π
δ = δ * 180/π
Alternative formulas 2:
sincos(δ0,sinδ0,cosδ0)
α = α0 + arctan2(ξ,cosδ0 - V*sinδ0);
δ = arcsin((sinδ0 +
η
* cosδ0) / sqrt( 1 +
ξ
^2 +
η
^2))
α = α * 180/π
δ = δ * 180/π
Alternative formulas 3:
sincos(δ0,sinδ0,cosδ0);
delta_α = arctan2(
η
,cosδ0 -
ξ
*sinδ0)
α = α0 + delta_α
δ = arctan2((
η
*cosδ0+cosδ0) * sin( delta_α),
ξ
)
This transformation converts celestial coordinates α, δ
(right ascension
and declination) to pixel coordinates fitsX, fitsY in an image. The reference position α0, dec0 is the celestial
position of the reference pixel at crpix1,crpix2 and stored in the header as crval1, crval2. he transformation matrix is cd1_1, cd1_2, cd2_1, cd2_2.. Assuming TAN
projection.
ξ
, η
) using the gnomonic (tangent) projection formula.:
α0 = crval1
δ0 = crval2
sincos(δ,sinδ,cosδ)
sincos(δ0,sinδ0,cosδ0)
sincos(α-α0,sin_delta_α,cos_delta_α)
cosc =
(sinδ * sinδ0 + cosδ * cosδ0 * cosdelta_α)
ξ = (cosδ * sin_delta_α) / cosc
)
η = (cosδ0 * sinδ - sinδ0 * cosδ * cos_delta_α) /
cosc
ξ =
ξ *
180/π
η =
η
*
180
/ π
detCD = cd1_1 * cd2_2 - cd1_2 * cd2_1
crpix1
, crpix2
).
u = (cd2_2 * ξ - cd1_2 * η) / detCD + crpix1
v = (-cd2_1 * ξ + cd1_1 * η) / detCD + crpix2
are calculated using the SIP coefficients (AP_i_j
, BP_i_j
) as follows:fitsX = u + Σ AP_i_j * u^i * v^j
fitsY = v + Σ BP_i_j * u^i * v^j
Note1: The summations are carried over the orders of the SIP coefficients.x' = x + a1x + a2y + a3x2 + a4xy + a5y2 + a6x3 + a7x2y + a8xy2 + a9y3
y' = y + b1x + b2y + b3x2 + b4xy + b5y2 + b6x3 + b7x2y + b8xy2 + b9y3
The SIP coefficients are stored in the FITS header and labeled according to their order and the axis they correspond to. For example:
A_2_1
is the coefficient of x2y for the X-coordinate correction (pixel-to-sky).BP_1_2
is the coefficient of x'1y'2 for the Y-coordinate correction (sky-to-pixel).The A_ORDER and B_ORDER specify the order of the polynomial for the pixel-to-sky correction. The AP_ORDER and BP_ORDER keywords specify the order of the polynomial for the sky-to-pixel correction.
ASTAP will provide the SIP coefficient up to the 3th order.
More information: https://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf