How to determine CD matrix
From Tauwiki
Contents |
[edit] Underlying Code
[edit] Calling Sequence
pro starast,ra,dec,x,y,cd, righthanded=right,hdr=hdr, projection=projection
[edit] IDL Description
NAME: STARAST
PURPOSE: Compute astrometric solution using positions of 2 or 3 reference stars
EXPLANATION:
Computes an exact astrometric solution using the positions and coordinates from 2 or 3 reference stars and assuming a tangent (gnomonic) projection. If 2 stars are used, then the X and Y plate scales are assumed to be identical, and the axis are assumed to be orthogonal. Use of three stars will allow a unique determination of each element of the CD matrix.
CALLING SEQUENCE:
starast, ra, dec, x, y, cd, [/Righthanded, HDR = h, PROJECTION=]
INPUTS:
RA - 2 or 3 element vector containing the Right Ascension in DEGREES
DEC- 2 or 3 element vector containing the Declination in DEGREES
X - 2 or 3 element vector giving the X position of reference stars
Y - 2 or 3 element vector giving the Y position of reference stars
OUTPUTS:
CD - CD (Coordinate Description) matrix (DEGREES/PIXEL) determined from stellar positions and coordinates.
OPTIONAL INPUT KEYWORD:
/RightHanded - If only 2 stars are supplied, then there is an ambiguity in the orientation of the coordinate system. By default, STARAST assumes the astronomical standard left-handed system (R.A. increase to the left). If /Right is set then a righthanded coordinate is assumed. This keyword has no effect if 3 star positions are supplied.
PROJECTION - Either a 3 letter scalar string giving the projection type (e.g. 'TAN' or 'SIN') or an integer 1 - 25 specifying the projection as given in the WCSSPH2XY procedure. If not specified then a tangent projection is computed.
OPTIONAL INPUT-OUTPUT KEYWORD:
HDR - If a FITS header string array is supplied, then an astrometry solution is added to the header using the CD matrix and star 0 as the reference pixel (see example). Equinox 2000 is assumed.
EXAMPLE:
To use STARAST to add astrometry to a FITS header H; IDL> starast,ra,dec,x,y,cd ;Determine CD matrix IDL> crval = [ra[0],dec[0]] ;Use Star 0 as reference star IDL> crpix = [x[0],y[0]] +1 ;FITS is offset 1 pixel from IDL IDL> putast,H,cd,crpix,crval ;Add parameters to header
This is equivalent to the following command: IDL> STARAST,ra,dec,x,y,hdr=h
METHOD:
The CD parameters are determined by solving the linear set of equations relating position to local coordinates (l,m) For highest accuracy the first star position should be the one closest to the reference pixel.
[edit] Detailed Algorithm
[edit] Input
This program requires either 2 or 3 stars. If there are only two stars, there is an ambiguity in the direction of the correction. Three stars removes that ambiguity.
[edit] Definition of the CD matrix
The purpose of this program is to derive the CD matrix which is given at this reference. Note that this program will only work for TAN projections.
[edit] Method
- Set the center to the position of the first star. We might as well use that star which is closest to the center of the field because that will simplify our own correction.
- Convert ra and dec to eta and xi where eta and xi are the angular separation of the coordinates from the center in degrees. We define the latitude of North Pole to be zero but I don't know why as yet. The IDL call is:
wcssph2xy, crval = crval1, ra[1:*], dec[1:*], eta, xi, map_type, latpole = 0.0
- Define the distance from the first star to the second:
delx1 = x[1] - crpix1[0] dely1 = y[1] - crpix1[1] a = [ [delx1,-dely1], [dely1,delx1] ]
- Take the inverse of this and multiply by the distance between them in degrees. This will give degrees/pixel.
cd = invert(a)#b
- Finally put these into the right format for the CD matrix:
cd1_1 = cd[0] cd1_2 = cd[1] cd2_1 = cd[1] cd2_2 = -cd[0]
[edit] Three star method
- Define the new matrix:
a = ([delx1, 0, delx2, 0],
[dely1, 0, dely2,0],
[0., delx1, 0, delx2],
[0., dely1, 0, dely2])
where delx2 = x[2] - crpix1[0] and
dely2 = y[2] - crpix1[1]
b = [eta[0], xi[0], eta[1], xi[1]]
- cd = invert(a)#b immediately gives us the CD matrix.
