Notes on CD format

This WCS can be installed in the header usig a CD matrx.


% hcards_wcs.sh --help 
Notes on deriving CD_matrix WCS for acm 
Notes originally in:  /home/sco/HET_work/acam/acm_aug2017_wcs

Good image:   20170824T072832.1_acm_sci.fits

WCS part of header: 
CUNIT1  = 'DEGREES '
CUNIT2  = 'DEGREES '
CTYPE1  = 'RA---TAN'
CRPIX1  =                  176 / reference pixel
CRVAL1  =            298.56459
CTYPE2  = 'DEC--TAN'
CRPIX2  =                  379 / reference pixel
CRVAL2  =            48.578936
CD1_1   = 7.20412863302045E-05
CD1_2   = 2.18356672121445E-05
CD2_1   = -2.1835667212144E-05
CD2_2   = 7.20412863302045E-05
PARANGLE=           286.162022 / Parallactic angle
STRUCTAZ=           312.450344 / Azimuth of the structure
PIXSCALE=                0.271
PIXSCL_X=                0.271
PIXSCL_Y=                0.271

=================================================
Here is the small bit of code I could get from Randy:
>>>     const float CD1_2 = -sin(-tcs_math::degrees_to_radians(data.parallactic_angle_deg - data.current_orientation_deg)) *
>>>                          tcs_math::arcsecs_to_degrees(plateScaleX);
>>>     const float CD1_1 = tcs_math::arcsecs_to_degrees(plateScaleX) *
>>>                          cos(-tcs_math::degrees_to_radians(data.parallactic_angle_deg - data.current_orientation_deg));
>>>     const float CD2_1 = sin(-tcs_math::degrees_to_radians(data.parallactic_angle_deg - data.current_orientation_deg)) *
>>>                          tcs_math::arcsecs_to_degrees(plateScaleY);
>>>     const float CD2_2 =  tcs_math::arcsecs_to_degrees(plateScaleY) *
>>>                          cos(-tcs_math::degrees_to_radians(data.parallactic_angle_deg - data.current_orientation_deg));

From an STSCI doc (fits_wcs_hst.pdf) I also see: 
where pa = position angle (of Y axis?) 
   CD1_1 =  scale*cos(pa) 
   CD1_2 = scale*sin(pa) 
   CD2_1 = -scale*sin(pa) 
   CD2_2 =  scale*cos(pa)   
**** Bit, the coding above by RB (and MS) includes the acm flip.  

In another doc from Frankf Valdez: 
u,v = coordinates in the image pixel frame 
x,y = worlrd x,y (I think) 
  x = CD1_1*u + CD1_2*v
  y = CD2_1*u + CD2_2*v
   





Back to SCO CODES page