
Astrometry
  need a way to know if astrometry failed for a dither set
    in *.imwcs: nmatch= 5 nstars= 31 between, require match fraction > 25% ?
    worked if RMS line found and < N arcsec
    have astrometry.pl give summary per input file, RMS, Rotation, if failed
      don't give lots of info, just important summary, input guesses, output
  make script rotations.pl that determines rotation per chip from *.imwcs
    apm2 798> foreach file (irx*c1*imwcs)
    foreach? grep "Rotation=" $file | tail -1 | awk '{print $6}'
    foreach? end
    then give rotations to astrometry_refine.pl
  double check inputs to imwcs, eg, catalog files produced: APM, sextractor
  update astrometry.pl with tricks used in astrometry_refine.pl
  average center position from four chips, then put back offsets
    get avg center position?  doesn't work, what if not equispace from center?
  have plot showing CD matrix and chip separations for each dither set
  tune imwcs parameters, tolerance, imfrac, etc
  have avgrot, avgscale use robust (weighted?) average
  check that wcsinfo writes reasonable default CD matrix values
  use newest WCStools?
  astrometry.pl etc should use dithers file, not irx.r*c?.fits
  in fitsIO.c, use #define for 1.25e-6, is 1.25e-6 best choice?
  see rgm email, add astrometry cat used to hdr, eg, USNO, APM-POSS1, APM-UKST

fix to handle BZERO and BSCALE
  improve writefits(), make two versions of writefits, writefitss?
  send bitpix to writefits instead of using shortimg()
  see ~/offsetsfail
  go through and double check (offsets not dropping, irx.r* look okay), rename
  run /local/cirsi_7/19991221p/AXAFT4 again now that on_runs is fixed
  cp gain*fits flat*fits /local/scsi/sabbey/19991222p/AXAFT3 and run that again
  /local/cirsi_6/sabbey/19991228p/NTTT4
  offsets.r11000, chip 4 disagrees by 1.5 pix, which is correct? both?

rename AXAF -> AXAFT1H, AXAFT2J, etc
work on astrometry and quality control as process
rerun offsets and coadd steps by hand, comment in README:
  cirsi.csh >& cirsi.log
  runcmd.pl offsets.pl ...
  runcmd.pl coadd.pl ...

Verification
  take notes in log file about data quality
  check data all same filter, logs + dfits irx*c?.fits.skysub | fitsort FILTER
  view gain maps, check same filter as data 
  view master object masks, delete individual frame masks
  look at some coadded dither sets
  check offset step, no dropped frames, and reasonable stdevs (make plot)
  process or save standard star data
  sextractor parameters for each loop and coadded dither sets:
    seeing FHWM, ellipticity, a, b, theta, bkglvl, noiselvl, Nobjs
  stats.c bkg and sigma output
    check what gave rgm before
  dither offset measurement agreement between chips
    stdev_xoffset, stdev_yoffset per run number
  check for transparency change, relative zero point
    make a sextractor catalog per loop
    match loop catalogs to master catalog of coadded dither set
    output median and stdev of magnitude offsets
  for each run:
    stdev_xoffset, stdev_yoffset
  for each loop, for each run (combined loops), for each dither set:
    bkg, noise, nobjs, fwhm, a, b, theta, ellipticity
  for each loop, for each run (combined loops):
    median and stdev of magnitude differences verse coadded dither set

----

Cleanup
  test swarp
      if works can delete tile.pl, normalize.pl, etc
  normalize.pl uses statsmask which does not work for sigma ~ 1
      -> but now will use SWarp to coadd anyway
  user should be able to check reset correction directions, or turn it off
    put @ramp = ("row", "col", "row", "col") in cirsi.csh?
    make sure there aren't any hidden parameters, put in run.csh
  BZERO/BSCALE keywords not handled correctly
  problems if coadding dither sets with different gain, scale, exptime,
  run coadd.pl and coadd_nomerge.pl to see which gives better FWHM
  putwcs() writes CD matrix with rotation non-zero
  flatfield loop 1 data differently (use correction for different gain)?
