spacetelescope / drizzlepac

AstroDrizzle for HST images.
https://drizzlepac.readthedocs.io
BSD 3-Clause "New" or "Revised" License
52 stars 38 forks source link

Why is the CTYPE not updated properly for all images in the visit #1367

Closed stscijgbot-hstdp closed 2 years ago

stscijgbot-hstdp commented 2 years ago

Issue HLA-772 was created on JIRA by Michele De La Pena:

This visit is comprised of 12 images (4 images for each of three filters).  The images are part of three associations and one singleton (ie3501010, ie3501020, ie3501030, and ie3501cdq). Image ie3501buq_flt.fits does not have the same CTYPE1/CTYPE2 entries as all of the other images after the astrodrizzle step.  Why?  See Jira HLA-760 for more information.

stscijgbot-hstdp commented 2 years ago

Comment by Warren Hack on JIRA:

Fundamentally, the problem with processing 'ie3501buq' stems from problems with the a posteriori WCS solution for alignment to GAIAeDR3 provided by the astrometry database.  That specific headerlet in the database is missing a lot of information for a proper WCS solution; namely, a non-SIP solution is provided, whereas the same solution for the rest of the exposures all have a complete SIP solution.  A complete SIP solution includes all the SIP distortion keywords (A{}{}{}, B{}{*}{*}) along with a value for CTYPE of 'RA-TAN—SIP'/'DEC-TAN–-SIP'.  The headerlet from the database for 'ie3501buq' only has:

XTENSION= 'IMAGE   '           / Image extension                                 BITPIX  =                    8 / array data type                                 NAXIS   =                    0 / number of array dimensions                      PCOUNT  =                    0 / number of parameters                            GCOUNT  =                    1 / number of groups                                WCSAXES =                    2 / Number of coordinate axes                       CRPIX1  =                507.0 / Pixel coordinate of reference point             CRPIX2  =                507.0 / Pixel coordinate of reference point             CUNIT1  = 'deg'                / Units of coordinate increment and value         CUNIT2  = 'deg'                / Units of coordinate increment and value         CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection            CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection                CRVAL1  =      10.710735026267 / [deg] Coordinate value at reference point       CRVAL2  =      40.888019404297 / [deg] Coordinate value at reference point       CRDER1  =      58.843753099828 / [deg] Random error in coordinate                CRDER2  =      64.378193953688 / [deg] Random error in coordinate                WCSNAME = 'IDC_w3m18525i-FIT_REL_GAIAeDR3' / Coordinate system title             MJDREF  =                  0.0 / [d] MJD of fiducial time                        RADESYS = 'ICRS'               / Equatorial coordinate system                    ORIENTAT=   -66.11076802765093 / positions angle of image y axis (deg. e of n)   TG_ENAME= 'SCI     '           / Target science data extname                     TG_EVER =                    1 / Target science data extver                      CD1_1   = -1.5315828528647E-05 / partial of first axis coordinate w.r.t. x       CD1_2   = -3.0711151841693E-05 / partial of first axis coordinate w.r.t. y       CD2_1   = -3.4363220457108E-05 / partial of second axis coordinate w.r.t. x      CD2_2   =   1.360240460729E-05 / partial of second axis coordinate w.r.t. y      OCX10   = 0.000777297012973576 / original linear term from IDCTAB                OCX11   =   0.1354298144578934 / original linear term from IDCTAB                OCY10   =   0.1209627389907837 / original linear term from IDCTAB                OCY11   = -0.00042068894254043 / original linear term from IDCTAB                IDCSCALE=   0.1282500028610229 / pixel scale from the IDCTAB reference file      EXTNAME = 'SIPWCS  '           / extension name                                  EXTVER  =                    1 / extension value

In comparison, it should contain the same set of keywords found in the GAIAeDR3 headerlet for 'ie3501c0q' (from the same ASN):

XTENSION= 'IMAGE   '           / Image extension                                 BITPIX  =                    8 / array data type                                 NAXIS   =                    0 / number of array dimensions                      PCOUNT  =                    0 / number of parameters                            GCOUNT  =                    1 / number of groups                                WCSAXES =                    2 / Number of coordinate axes                       CRPIX1  =                507.0 / Pixel coordinate of reference point             CRPIX2  =                507.0 / Pixel coordinate of reference point             CUNIT1  = 'deg'                / Units of coordinate increment and value         CUNIT2  = 'deg'                / Units of coordinate increment and value         CTYPE1  = 'RA---TAN-SIP'       / TAN (gnomonic) projection + SIP distortions     CTYPE2  = 'DEC--TAN-SIP'       / TAN (gnomonic) projection + SIP distortions     CRVAL1  =      10.710716583382 / [deg] Coordinate value at reference point       CRVAL2  =      40.887792399172 / [deg] Coordinate value at reference point       CRDER1  =      58.843753099828 / [deg] Random error in coordinate                CRDER2  =      64.378193953688 / [deg] Random error in coordinate                WCSNAME = 'IDC_w3m18525i-FIT_REL_GAIAeDR3' / Coordinate system title             MJDREF  =                  0.0 / [d] MJD of fiducial time                        RADESYS = 'ICRS'               / Equatorial coordinate system                    A_ORDER =                    4 / SIP polynomial order, axis 0, detector to sky   A_0_2   = 5.03683559395408E-08 / SIP distortion coefficient                      A_0_3   = 3.58489019323397E-11 / SIP distortion coefficient                      A_0_4   = -1.7096030015339E-13 / SIP distortion coefficient                      A_1_1   = 2.44067589697849E-05 / SIP distortion coefficient                      A_1_2   = 2.52491804653495E-11 / SIP distortion coefficient                      A_1_3   = 5.60344668392659E-13 / SIP distortion coefficient                      A_2_0   = -2.0586281536303E-07 / SIP distortion coefficient                      A_2_1   = 1.11756131621297E-10 / SIP distortion coefficient                      A_2_2   = 9.44397763409537E-15 / SIP distortion coefficient                      A_3_0   = -2.1153064583223E-10 / SIP distortion coefficient                      A_3_1   = 5.44164224825977E-13 / SIP distortion coefficient                      A_4_0   = -2.6241913593392E-13 / SIP distortion coefficient                      B_ORDER =                    4 / SIP polynomial order, axis 1, detector to sky   B_0_2   = 2.99526910047536E-05 / SIP distortion coefficient                      B_0_3   =  -2.276184347652E-10 / SIP distortion coefficient                      B_0_4   = 7.38617646709978E-13 / SIP distortion coefficient                      B_1_1   = -1.8441031369285E-07 / SIP distortion coefficient                      B_1_2   = 5.41334217303662E-11 / SIP distortion coefficient                      B_1_3   = -2.2228484499494E-14 / SIP distortion coefficient                      B_2_0   = 6.96937375511744E-06 / SIP distortion coefficient                      B_2_1   = -3.0390505421181E-10 / SIP distortion coefficient                      B_2_2   = -2.0599022983307E-13 / SIP distortion coefficient                      B_3_0   = 3.38549135278375E-11 / SIP distortion coefficient                      B_3_1   = 1.14334174473825E-13 / SIP distortion coefficient                      B_4_0   = -6.4924382260858E-13 / SIP distortion coefficient                      ORIENTAT=   -66.11564798546388 / positions angle of image y axis (deg. e of n)   TG_ENAME= 'SCI     '           / Target science data extname                     TG_EVER =                    1 / Target science data extver                      CD1_1   = -1.5316430770876E-05 / partial of first axis coordinate w.r.t. x       CD1_2   = -3.0706450875166E-05 / partial of first axis coordinate w.r.t. y       CD2_1   = -3.4355129371857E-05 / partial of second axis coordinate w.r.t. x      CD2_2   =  1.3597194238271E-05 / partial of second axis coordinate w.r.t. y      OCX10   = 0.000777297012973576 / original linear term from IDCTAB                OCX11   =   0.1354298144578934 / original linear term from IDCTAB                OCY10   =   0.1209627389907837 / original linear term from IDCTAB                OCY11   = -0.00042068894254043 / original linear term from IDCTAB                IDCSCALE=   0.1282500028610229 / pixel scale from the IDCTAB reference file      EXTNAME = 'SIPWCS  '           / extension name                                  EXTVER  =                    1 / extension value 

This ultimately needs to be fixed in the astrometry database.  It is not clear what else can be done within 'runastrodriz' pipeline processing to generate a better result.  One option would be to update the header rules for fitsblender to not even have rule for the CTYPE keywords and rely on the processing code to set the WCS keywords entirely.   This option would be implemented under HLA-769, where it will be tested to see whether or not it solves this problem.

stscijgbot-hstdp commented 2 years ago

Comment by Warren Hack on JIRA:

A new function was implemented under #1424 to evaluate all the a posteriori HDRLET solutions pulled from the astrometry database to insure they have a full distortion model included.  This turned out to be the problem for ie3501buq.   The new function removes incomplete HDRLET extensions after the call to the database, allowing it to be recomputed from scratch with the full distortion model.   The incomplete solution has also been removed from the database by B. McLean as well.  So, this problem should be full resolved, not just for this specific exposure, but for all exposures with the same problem.