Grism QA Guide (long)

         Guide to QA-ing Spectral Reductions (visits) (May 2006)

1. Check for existence of products.

   The output files occur in this order: [n/f]g-cnt.fits, [n/f]g-gsax.fits, 
   [n/f]g-pri.fits, [n/f]g-xsp.fits, [n/f]g-gsp.fits, and xg-gsp.fits .
   See file descriptions.

   Reject any visits where any of these files are not present.

2. Check the aspect (offset) solution.

   Look in the -ng-gsax.fits file for the following header cards:

             Warning Flag   Unknown     Fail 

EXPTIME   :   <120         < 60         < 20          Exposure time in seconds.
GRSPADIF  :   <-1.4,>1.4   <-2,>2       <-6,>6        Fit - original grism position angle.
SXOFF     :   <-300,>300   <-600,>600   <-1200,>1200  X Offset (dispersion direction) in arcseconds.
SYOFF     :   <-300,>300   <-600,>600   <-1200,>1200  Y Offset (spatial direction) in arcseconds.
STWIST    :   <-0.5,>0.5   <-2.0,>2.0   <-5.0,>5.0    Twist offset in degrees.
SMDNRES   :     >1.5,      >3.0         >5.0          Median residual in offset fit in arcseconds.
SMDNFWHM  :     >6.5       >8.0         >12.0         Median FWHM of bright stars in arcseconds.
SMDNBKDF  :     >0.13      >0.2         >0.5          Background difference: | left - right background | / mean.
SXOITRMS  :     >0.3       >1.0         >3.0          X Offset Iteration RMS in arcseconds.
SYOITRMS  :     >0.2       >0.5         >1.5          Y Offset Iteration RMS in arcseconds.
PROFWHM   :     >6.5       >8.0         >12.0         Profile model FWHM in arcseconds.
FLXFRAC   :     <0.9       <0.7         <0.5          Extracted flux fraction.

    I based these numbers on about 500 grism visits reduced within the last
    6 months.  I expect there to be only about 1% of the visits with "Unknown"
    and ~0 visits with "Fail".

    Warning Flag : QA'er should look a little more carefully at the data.
    Unknown      : Detailed inspection recommended.
                   The QA'er should determine whether the data
                   is so significantly compromised that it would
                   damage the final coadd.
    Fail         : I expect these to be exceedingly rare, (if they
                   occur at all), so the QA'er can leave them alone.
                   I'll look at these myself and we may have to discuss
                   whether the FAIL state could be overridden.

   Reject any visit that violate these limits, visits may be re-accepted
   after visual inspection (if time permits).

   If this is a stage 2 run (after _rtastar run), check the following cards:

             Warning Flag   Unknown     Fail 

DIFGRSPA :    >1.0, <-1.0                        : GRSPA difference relative to _rtastar   run.
DIFXOFF  :    >2.0, <-2.0                        : SXOFF difference relative to _rtastar run.
DIFYOFF  :    >2.0, <-2.0                        : SYOFF difference relative to
DIFTWIST :    >0.1, <-0.1                        : STWIST difference relative to
DIFMDNRE :    >1.0, <-1.0                        : SMDNRES difference relative to _rtastar run.
DIFMDNFW :    >0.2, <-0.2                        : FWHM difference relative to    
DIFNUMBE :    >10 , < 10                         : SNUMBER difference relative to _rtastar run.

3. Check full field grism image visually (-?g-int.fits):

   - Look for double profiles, this will show up as two parallel lines at
     the location of each source.

   - Look for bright reflections, this will appear as bright streaks which
     are not parallel with the spectra.

   Obvious examples of these should be noted.

4. Look at the * file which is a PostScript plot based on 
   data from various data tables in the ./qa/ directory which were written by 
   galexspac.  These plots summarize how well galexspac did in computing the 
   offset of the spectra from their nominal positions.  'galexspac' computes 
   the X and Y offsets between the spectra and the positions found in the -mcat.fits
   catalog.  X is along the dispersion direction, Y is perpindicular to the 
   dispersion direction.

   Description of plots from upper-left to lower-right, reading left to right,
   first page to remaining pages:

      - Information panel (look at the Xoff and Yoff values which should be on
          the order of 1-100).
      - GRSPA: used to find the true grism position angle.
      - Refined GRSPA: a more precise estimate of grism position angle.
      - FWHM: Value for each star, these should be between 4-12.
      - Relative X,Y: shows the computed offsets for each star.
      - Residuals in Final Fit: should be between 0.1 and 1.5 .
      - X, Y, Twist offsets by iteration number: these should hopefully
          converge, there may be a bounce, but if the range is less than
          about 0.3 arcseconds, it is OK.
      - Plots of star spectra vs. the UV star reference atlas.  The units
          are in relative photons on the detector (no flux calibration).
          These should roughly line up.
      - Relative background difference: ratio of one side of the profile
          to the other (median should be between 0.1 and 0.4).
      - Plots of spatial profiles.  These are the most useful plots since
          they show how well the spacecraft was pointing.  If the profiles are
          too wide, or double humped, the visit may be rejected.
      Please note: there is a JPEG image called offset_profile_qa.jpg which
      is a median of these profiles and summarizes a lot of this information.

5. Look at *-ng-offset_grid_qa.jpg  correlation sums image file to check for multiple
   profiles, i.e. jumps in the delta-phot solution. 
   Here is an example of a good grid:  JPEG 1 .
   Here is an example of a bad grid with a shift in the last 10% of the photon list:  JPEG 2 .
   Here is an example of a bad grid with a shift in the last 5% of the photon list:  JPEG 3 .

   See other special cases here: