Problems with more 200 cards - Sep2018

In Sep2018 I discovered that the growing number of acm header cards has begun to approach 200. This is causing some problems with my routine for replacing cards. Here are the notes.



A0.fits = original version of 20180826T110433.5_acm_sci.fits
FINAL.fits = fixed up version 

I will find the position of a star that I recogize in both the images and the dss.fits image. 
Here x,y are image pixels and ra,dec are from WCS in header 

% ds9 A0.fits
x,y,ra,dec =  541.6 594.8     02:48:44.548 +65:15:47.08

% ds9 FINAL.fits (before wcsf_rough)  
x,y,ra,dec =  542.1 593.8     02:48:44.500 +65:15:47.00

Hence, the direct ds9 measures between the original and fixed images 
are nearly the same. 

What happens when I run the wcsf_rough code? I processed FINAL.fits 
From the dss image star 9 (my fiducial star):   
  Ra,Dec(ds9) = 02:48:38.470 +65:16:11.13
From catalog:   2.810684440  65.269911100  (hrs,deg) 
% sexcd 2.810684440  65.269911100  hd
 02:48:38.4640 +65:16:11.6800
Ra,Dec(catalog) = 02:48:38.464 +65:16:11.68
Ra,Dec(ds9)     = 02:48:38.470 +65:16:11.13       # These are in agreement 

When I measure the wcsf_rough-processed image: 
% ds9 FINAL.fits (After wcsf_rough)  
x,y,ra,dec =  541.9  594.2      02:48:38.470 +65:16:11.61 
Ra,Dec(catalog) =               02:48:38.464 +65:16:11.68
*** This appears to give the correct ra,dec now. 

I run usno_look_wcs to check this: 
usno_look_wcs FINAL.fits Blue 19.00 1       # Yes! This looks very good. 

======================================
Just as a check, I do the same exercsie with A0.fits:
I run usno_look_wcs to check this:
usno_look_wcs A0.fits Blue 19.00 1          # No, the points do not line up. There is 
                                              some probelm with using the original 
                                              image processed with wcsf_rough 
The #9 star position is:
ds9(A0 after wcsf_rough)    542.4 594.3   2:48:38.451 +65:17:35.40
*** This is different from the original image, but still not right. 

The original image treated with wcsf_rough 
In A0a.fits:
CTYPE1  = 'RA---TAN'           /  Gnomonic Projection
CRPIX1  =              541.990 / Axis 1 Reference
CRVAL1  =         42.160259247 / Ra  at Frame, J2000 (deg)
CTYPE2  = 'DEC--TAN'           /  Gnomonic Projection
CRPIX2  =              594.500 / Axis 2 Reference
CRVAL2  =            65.293196
% sexcd 42.160259247 65.293196 dd
 02:48:38.4624 +65:17:35.5056
 02:48:38.470  +65:16:11.13        # Star 9 from dss 

The image treated with acm_ccd_fixup: 
In FINAL.fits
CTYPE1  = 'RA---TAN'           /  Gnomonic Projection
CRPIX1  =              541.680 / Axis 1 Reference
CRVAL1  =         42.160259247 / Ra  at Frame, J2000 (deg)
CTYPE2  = 'DEC--TAN'           /  Gnomonic Projection
CRPIX2  =              594.010 / Axis 2 Reference
CRVAL2  =         65.269912720 / Dec at Frame, J2000 (deg)
% sexcd 42.160259247 65.269912720 dd
 02:48:38.4624 +65:16:11.6858
 02:48:38.470  +65:16:11.13        # Star 9 from dss 

**** It appears that when wcsf_rough processed the original image (A0.fits) 
     the DEC value (CRVAL2) was not rewritten. In the original image, not 
     yet processed with acm_ccd_fix:
CTYPE1  = 'RA---TAN'
CRPIX1  =                  176 / reference pixel
CRVAL1  =            42.160035
CTYPE2  = 'DEC--TAN'
CRPIX2  =                  379 / reference pixel
CRVAL2  =            65.293196

**** So, this is worth resolving. I have to understand why wcsf_rough does not 
     properly re-write the DEC (via CRVAL2). 

The code that does the rough WCS installation is: 
build_rough_wcs

** When I run wcsf_rough on A0.fits and I get to the 
point of:   "You have run either usno_identify or ds9_crpix_set." I see: 
% cat ds9_crpix_set.out
 Y  540.48 595.72   02:48:38.4624 +65:16:11.6858   9       # This is the correct x,y and ra,dec 

** When I run wcsf_rough on FINAL.fits and I get to the same point 
% cat ds9_crpix_set.out
 Y  545.06 595.92   02:48:38.4624 +65:16:11.6858   9 

So, the two images are treated to same to this point. 

I run the build_rough_wcs on the two different images: 
/home/sco/play/wcs2/T_final     FINAL.fits   02:48:38.412  +65:16:11.88   541.53816  594.83184    # This is correct 
/home/sco/play/wcs2/T_a0        A0.fits      02:48:38.449  +65:17:35.38   541.95708  594.72741    # This is WRONG 

So, the problem seems to be with the build_rough_wcs treatment of A0.fits. 
What is causing this incorrect treatment?  I will dig into build_rough_wcs. 

I run build_rough_wcs in stand-alone mode and I find I get the same 
header file entries to be inserted: 

% cat T_a0/ascii.WCS
CTYPE1  = 'RA---TAN'           /  Gnomonic Projection                           
CTYPE2  = 'DEC--TAN'           /  Gnomonic Projection                           
CRPIX1  =              541.460 / Axis 1 Reference                               
CRPIX2  =              594.940 / Axis 2 Reference                               
CRVAL1  =         42.160259247 / Ra  at Frame, J2000 (deg)                      
CRVAL2  =         65.269912720 / Dec at Frame, J2000 (deg)     

% cat T_final/ascii.WCS
CTYPE1  = 'RA---TAN'           /  Gnomonic Projection                           
CTYPE2  = 'DEC--TAN'           /  Gnomonic Projection                           
CRPIX1  =              542.020 / Axis 1 Reference                               
CRPIX2  =              596.110 / Axis 2 Reference                               
CRVAL1  =         42.160259247 / Ra  at Frame, J2000 (deg)                      
CRVAL2  =         65.269912720 / Dec at Frame, J2000 (deg)          

The code that does the new card insertion:    headrev.sh 
   headrev.sh A.fits ascii.WCS $finalim

So, I can run this in each T_ directory as: 
   headrev.sh A.fits ascii.WCS B.fits 

***** I see that headrev.sh does perform differently for these two images.  Why? 
Fuck!   It is the large number of cards now in the acm FITS header. 






Back to SCO CODES page