Index: /branches/czw_branch/20100519/DataStore/lib/DataStore/Utils.pm
===================================================================
--- /branches/czw_branch/20100519/DataStore/lib/DataStore/Utils.pm	(revision 28303)
+++ /branches/czw_branch/20100519/DataStore/lib/DataStore/Utils.pm	(revision 28304)
@@ -44,5 +44,5 @@
 %KNOWN_FILE_TYPES = map { $_ => 1 } qw( chip psrequest psresults pstamp chipproc warp stack diff ipp-mops table text xml tgz fits );
 %KNOWN_FILESET_TYPES = map { $_ => 1 } qw( OBJECT BIAS DARK SKYFLAT DOMEFLAT OOF SHACKHARTMANN PSREQUEST PSRESULTS IPP-MOPS XRAY FOCUS MOPS_DETECTABILITY_QUERY MOPS_DETECTABILITY_RESPONSE MOPS_TRANSIENT_DETECTIONS LED notset IPP_PSPS IPP-DIST);
-%KNOWN_PRODUCT_TYPES = map { $_ => 1 } qw( image dump psrequest psresults table ipp-dist ipp-misc);
+%KNOWN_PRODUCT_TYPES = map { $_ => 1 } qw( image dump psrequest psresults table ipp-dist ipp-misc dqresults);
 
 =pod
Index: /branches/czw_branch/20100519/Ohana/Makefile.in
===================================================================
--- /branches/czw_branch/20100519/Ohana/Makefile.in	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/Makefile.in	(revision 28304)
@@ -31,4 +31,5 @@
 delstar     \
 dvosplit    \
+dvomerge    \
 elixir      \
 gastro      \
Index: /branches/czw_branch/20100519/Ohana/configure.tcsh
===================================================================
--- /branches/czw_branch/20100519/Ohana/configure.tcsh	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/configure.tcsh	(revision 28304)
@@ -186,5 +186,9 @@
 
 # use_gnu99
-if ($use_gnu99) set CFLAGS = "$CFLAGS -std=gnu99"
+if ($use_gnu99) then
+    set CFLAGS = "$CFLAGS -std=gnu99"
+else
+    set CFLAGS = "$CFLAGS -std=gnu89"
+endif
 
 # no_largefiles
@@ -670,5 +674,5 @@
   --use-tcmalloc          use the alternate tcmalloc from Google
   --use-gnu99             use gnu99 flags to ensure C99 compatibility
-  --use-largefiles        ensure large file compatibility
+  --no-largefiles         skip large file compatibility
 
 Installation directories:
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/ConfigInit.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/ConfigInit.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/ConfigInit.c	(revision 28304)
@@ -7,5 +7,5 @@
   double ZERO_POINT;
   char *config, *file;
-  char RadiusWord[80];
+  char RadiusWord[80], tmpword[80];
   char CatdirPhotcodeFile[256];
   char MasterPhotcodeFile[256];
@@ -68,6 +68,29 @@
   ScanConfig (config, "CCDNUM-KEYWORD",         "%s",  0, CCDNumKeyword);
   ScanConfig (config, "ST-KEYWORD",             "%s",  0, STKeyword);
-  ScanConfig (config, "OBSERVATORY-LATITUDE",   "%lf", 0, &Latitude);
-  ScanConfig (config, "OBSERVATORY-LONGITUDE",  "%lf", 0, &Longitude);
+
+  ScanConfig (config, "OBSERVATORY-LATITUDE",   "%s",  0, tmpword);
+  if (!strcasecmp(tmpword, "NONE")) {
+      fprintf (stderr, "observatory latitude is not set\n");
+      Latitude = NAN;
+  } else {
+      ScanConfig (config, "OBSERVATORY-LATITUDE",   "%lf", 0, &Latitude);
+  }
+  ScanConfig (config, "OBSERVATORY-LONGITUDE",   "%s",  0, tmpword);
+  if (!strcasecmp(tmpword, "NONE")) {
+      fprintf (stderr, "observatory longitude is not set\n");
+      Longitude = NAN;
+  } else {
+      ScanConfig (config, "OBSERVATORY-LONGITUDE",  "%lf", 0, &Longitude);
+  }
+  fprintf (stderr, "observatory @ (%f,%f)\n", Longitude, Latitude);
+
+  if (!strcasecmp(STKeyword, "NONE")) {
+      if (isnan(Longitude)) { 
+	  fprintf (stderr, "WARNING: ST cannot be determined for this image (no ST Keyword, no longitude)\n");
+      } else {
+	  fprintf (stderr, "ST Keyword is not defined, ST will be derived from time & longitude\n");
+      }
+  }
+
   ScanConfig (config, "SUBPIX_DATAFILE",        "%s",  0, SubpixDatafile);
 
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/FilterStars.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/FilterStars.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/FilterStars.c	(revision 28304)
@@ -54,5 +54,5 @@
     /* calculate accurate per-star airmass and azimuth */
     stars[N].measure.airmass = airmass (image[0].secz, stars[N].average.R, stars[N].average.D, image[0].sidtime, image[0].latitude);
-    stars[N].measure.az      = azimuth (image[0].sidtime - stars[N].average.R, stars[N].average.D, image[0].latitude);
+    stars[N].measure.az      = azimuth (15.0*image[0].sidtime - stars[N].average.R, stars[N].average.D, image[0].latitude);
     stars[N].measure.Mcal    = image[0].Mcal;
     stars[N].measure.t       = image[0].tzero + 1e-4*stars[N].measure.Yccd*image[0].trate;  /* trate is in 0.1 msec / row */
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/LoadStars.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/LoadStars.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/LoadStars.c	(revision 28304)
@@ -81,5 +81,5 @@
       continue;
     }
-    if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %lld images\n", file[i], Nheaders, (long long) NheaderSets);
+    if (VERBOSE) fprintf (stderr, "file %s has %d headers, including "OFF_T_FMT" images\n", file[i], Nheaders,  NheaderSets);
 
     /* supplied photcode is incompatible with multi-chip images */
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/ReadImageHeader.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/ReadImageHeader.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/ReadImageHeader.c	(revision 28304)
@@ -148,5 +148,5 @@
   image[0].fwhm_y = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0;
 
-  if (STKeyword[0]) {
+  if (STKeyword[0] && strcasecmp(STKeyword, "NONE")) {
     /* get ST (used for airmass calculation) */
     gfits_scan (header, STKeyword, "%s", 1, line);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/SkyTableFromTychoIndex.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/SkyTableFromTychoIndex.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/SkyTableFromTychoIndex.c	(revision 28304)
@@ -147,5 +147,5 @@
     skytable[0].filename[i] = NULL;
   }
-  if (VERBOSE) fprintf (stderr, "loaded %lld tables from tycho index\n", (long long) skytable[0].Nregions);
+  if (VERBOSE) fprintf (stderr, "loaded "OFF_T_FMT" tables from tycho index\n",  skytable[0].Nregions);
 
   return (skytable);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/UpdateImageIDs.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/UpdateImageIDs.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/UpdateImageIDs.c	(revision 28304)
@@ -55,7 +55,7 @@
 
   if (isEmpty) {
-    dvo_image_addrows (&db, NULL, 0);
+    if (!dvo_image_addrows (&db, NULL, 0)) Shutdown ("failed to create image table");
     SetProtect (TRUE);
-    dvo_image_update (&db, VERBOSE);
+    if (!dvo_image_update (&db, VERBOSE)) Shutdown ("failed to update image table");
     SetProtect (FALSE);
   } else {
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/addstar.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/addstar.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/addstar.c	(revision 28304)
@@ -48,5 +48,5 @@
 	newlist = SkyListByImage (sky, -1, &images[i]);
 	SkyListMerge (&skylist, newlist);
-	if (VERBOSE) fprintf (stderr, "added %lld regions to yield %lld total\n", (long long) newlist[0].Nregions, (long long) skylist[0].Nregions);
+	if (VERBOSE) fprintf (stderr, "added "OFF_T_FMT" regions to yield "OFF_T_FMT" total\n",  newlist[0].Nregions,  skylist[0].Nregions);
 	SkyListFree (newlist);
       }
@@ -80,5 +80,5 @@
     skylist = tmp;
   }
-  if (VERBOSE) fprintf (stderr, "writing to %lld regions\n", (long long) skylist[0].Nregions);
+  if (VERBOSE) fprintf (stderr, "writing to "OFF_T_FMT" regions\n",  skylist[0].Nregions);
 
   /* don't load the object tables for only_images, unless we are getting the calibration. */
@@ -213,5 +213,5 @@
   gettimeofday (&stop, NULL);
   dtime = DTIME (stop, start);
-  fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), %6lld average, %7lld measure\n", dtime, Nstars, Nmatch, (long long) Naverage, (long long) Nmeasure);
+  fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), "OFF_T_FMT" average, "OFF_T_FMT" measure\n", dtime, Nstars, Nmatch,  Naverage,  Nmeasure);
 
   exit (0);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches.c	(revision 28304)
@@ -3,5 +3,5 @@
 int find_matches (SkyRegion *region, Stars *stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
 
-  off_t i, j, n, N, J, status, Nstars;
+  off_t i, j, n, N, J, Nstars;
   double RADIUS, RADIUS2;
   double *X1, *Y1, *X2, *Y2;
@@ -9,5 +9,5 @@
   off_t *N1, *N2, *next_meas;
   off_t Nave, NAVE, Nmeas, NMEAS, Nmatch;
-  int Nsecfilt, Nsec;
+  int Nsecfilt, Nsec, status;
   unsigned int objID, catID;
   Coords tcoords;
@@ -356,5 +356,5 @@
   catalog[0].Nmeasure = Nmeas;
   catalog[0].Nsecf_mem = Nave*Nsecfilt;
-  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
+  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
 
   free (catalog[0].found);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest.c	(revision 28304)
@@ -350,5 +350,5 @@
   catalog[0].Nmeasure = Nmeas;
   catalog[0].Nsecf_mem = Nave*Nsecfilt;
-  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
+  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
 
   free (catalog[0].found);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest_refstars.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 28304)
@@ -361,5 +361,5 @@
   catalog[0].Nmeasure = Nmeas;
   catalog[0].Nsecf_mem = Nave*Nsecfilt;
-  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
+  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
 
   free (catalog[0].found);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_refstars.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/find_matches_refstars.c	(revision 28304)
@@ -329,5 +329,5 @@
   catalog[0].Nmeasure = Nmeas;
   catalog[0].Nsecf_mem = Nave*Nsecfilt;
-  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
+  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
 
   free (catalog[0].found);
Index: /branches/czw_branch/20100519/Ohana/src/addstar/src/sky_tessalation.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/addstar/src/sky_tessalation.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/addstar/src/sky_tessalation.c	(revision 28304)
@@ -940,5 +940,5 @@
 int dvo_image_clear_vtable (FITS_DB *db) {
 
-  int i;
+  int i, nbytes;
 
   // free memory used by the current vtable rows
@@ -951,5 +951,6 @@
 
   // reset db[0].theader(NAXIS1) to match Image
-  gfits_modify (&db[0].theader, "NAXIS1", "%lld", 1, (long long) sizeof(Image));
+  nbytes = sizeof(Image);
+  gfits_modify (&db[0].theader, "NAXIS1", "%d", 1,  nbytes);
   db[0].theader.Naxis[0] = sizeof(Image);
 
Index: /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_imagename.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_imagename.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_imagename.c	(revision 28304)
@@ -77,9 +77,9 @@
   Noutimage = Nimage - Nimlist;
   
-  if (VERBOSE) fprintf (stderr, "removing %lld images (leaving %lld of %lld)\n", (long long) Nimlist, (long long) Noutimage, (long long) Nimage);
+  if (VERBOSE) fprintf (stderr, "removing "OFF_T_FMT" images (leaving "OFF_T_FMT" of "OFF_T_FMT")\n",  Nimlist,  Noutimage,  Nimage);
   // gfits_table_set_Image (&db[0].ftable, outimage, Noutimage);
 
-  gfits_modify (&db[0].theader, "NAXIS2", "%lld", 1, (long long) Noutimage);
-  gfits_modify (&db[0].header, "NIMAGES", "%lld", 1, (long long) Noutimage);
+  gfits_modify (&db[0].theader, "NAXIS2", OFF_T_FMT, 1,  Noutimage);
+  gfits_modify (&db[0].header, "NIMAGES", OFF_T_FMT, 1,  Noutimage);
   db[0].theader.Naxis[1] = Noutimage;
   db[0].ftable.buffer = (char *) outimage;
Index: /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_missed.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_missed.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/delstar/src/delete_missed.c	(revision 28304)
@@ -11,5 +11,5 @@
   Nmiss = catalog[0].Nmissing;
   
-  if (VERBOSE) fprintf (stderr, "starting with Nave, Nmeas, Nmiss: %lld %lld %lld\n", (long long) Nave, (long long) Nmeas, (long long) Nmiss);
+  if (VERBOSE) fprintf (stderr, "starting with Nave, Nmeas, Nmiss: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT"\n",  Nave,  Nmeas,  Nmiss);
 
   /* set up references for missing to average */
@@ -19,5 +19,5 @@
   REALLOCATE (catalog[0].missing, Missing, 1);
   catalog[0].Nmissing = 0;
-  if (VERBOSE) fprintf (stderr, "  ending with Nave, Nmeas, Nmiss: %lld %lld %lld\n", (long long) Nave, (long long) Nmeas, (long long) Nmiss);
+  if (VERBOSE) fprintf (stderr, "  ending with Nave, Nmeas, Nmiss: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT"\n",  Nave,  Nmeas,  Nmiss);
 }
 
Index: /branches/czw_branch/20100519/Ohana/src/delstar/src/find_matches.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/delstar/src/find_matches.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/delstar/src/find_matches.c	(revision 28304)
@@ -22,5 +22,5 @@
   ALLOCATE (ave_miss, off_t, MAX(Nmiss,1));
   
-  if (VERBOSE) fprintf (stderr, "starting with Nave, Nmeas, Nmiss: %lld %lld %lld\n", (long long) Nave, (long long) Nmeas, (long long) Nmiss);
+  if (VERBOSE) fprintf (stderr, "starting with Nave, Nmeas, Nmiss: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT"\n",  Nave,  Nmeas,  Nmiss);
 
   /* set up pointers for linked list of measure */
@@ -75,5 +75,5 @@
       if (next_meas[j] != i) {
 	fprintf (stderr, "error? (1)  this link seems to have been lost\n");
-	fprintf (stderr, "j: %lld, next_meas[j]: %lld, i: %lld\n", (long long) j, (long long) next_meas[j], (long long) i);
+	fprintf (stderr, "j: "OFF_T_FMT", next_meas[j]: "OFF_T_FMT", i: "OFF_T_FMT"\n",  j,  next_meas[j],  i);
 	exit (1);
       }
@@ -108,5 +108,5 @@
 	if (next_miss[j] != m) {
 	  fprintf (stderr, "error? (2) this link seems to have been lost\n");
-	  fprintf (stderr, "j: %lld, next_miss[j]: %lld, i: %lld\n", (long long) j, (long long) next_miss[j], (long long) i);
+	  fprintf (stderr, "j: "OFF_T_FMT", next_miss[j]: "OFF_T_FMT", i: "OFF_T_FMT"\n",  j,  next_miss[j],  i);
 	  exit (1);
 	}
@@ -131,5 +131,5 @@
     }
   } 
-  fprintf (stderr, "found %lld meas to remove\n", (long long) Nmeasfound);
+  fprintf (stderr, "found "OFF_T_FMT" meas to remove\n",  Nmeasfound);
 
   if (VERBOSE) fprintf (stderr, "fixing missing..."); 
@@ -146,5 +146,5 @@
       if (next_miss[j] != i) {
 	fprintf (stderr, "error? (3) this link seems to have been lost\n");
-	fprintf (stderr, "j: %lld, next_miss[j]: %lld, i: %lld\n", (long long) j, (long long) next_miss[j], (long long) i);
+	fprintf (stderr, "j: "OFF_T_FMT", next_miss[j]: "OFF_T_FMT", i: "OFF_T_FMT"\n",  j,  next_miss[j],  i);
 	exit (1);
       }
@@ -249,5 +249,5 @@
   catalog[0].Nsecf_mem = Nave*Nsecfilt;
 
-  if (VERBOSE) fprintf (stderr, "  ending with Nave, Nmeas, Nmiss: %lld %lld %lld\n", (long long) Nave, (long long) Nmeas, (long long) Nmiss);
+  if (VERBOSE) fprintf (stderr, "  ending with Nave, Nmeas, Nmiss: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT"\n",  Nave,  Nmeas,  Nmiss);
 
   free (next_meas);
Index: /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c	(revision 28304)
@@ -17,6 +17,6 @@
  /* adjust header */
   Nout = 0;
-  gfits_scan (&out[0].header, "NIMAGES", "%lld", 1, (long long *) &Nout);
-  status = gfits_scan (&out[0].header, "IMAGEID", "%lld", 1, (long long *) &IDstart);
+  gfits_scan (&out[0].header, "NIMAGES", OFF_T_FMT, 1,  &Nout);
+  status = gfits_scan (&out[0].header, "IMAGEID", OFF_T_FMT, 1,  &IDstart);
   if (!status) {
     IDstart = 1;
@@ -36,6 +36,6 @@
   Nout += Nimages;
   IDstart += Nimages;
-  gfits_modify (&out[0].header, "NIMAGES", "%lld", 1, (long long) Nout);
-  gfits_modify (&out[0].header, "IMAGEID", "%lld", 1, (long long) IDstart);
+  gfits_modify (&out[0].header, "NIMAGES", OFF_T_FMT, 1,  Nout);
+  gfits_modify (&out[0].header, "IMAGEID", OFF_T_FMT, 1,  IDstart);
 
   gfits_add_rows (&out[0].ftable, (char *) images, Nimages, sizeof(Image));
@@ -65,5 +65,5 @@
     newID = dvo_map_image_ID (IDmap, oldID);
     if (newID == 0) {
-      fprintf (stderr, "cannot find image ID %lld\n", (long long) oldID);
+      fprintf (stderr, "cannot find image ID "OFF_T_FMT"\n",  oldID);
       exit (2);
     }
Index: /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoconvert.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoconvert.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoconvert.c	(revision 28304)
@@ -150,7 +150,7 @@
 
   // update additional metadata
-  gfits_scan (&inDB.header, "IMAGEID", "%lld", 1, (long long *) &ID);
-  gfits_modify (&outDB.header, "NIMAGES", "%lld", 1, (long long) Nimages);
-  gfits_modify (&outDB.header, "IMAGEID", "%lld", 1, (long long) ID);
+  gfits_scan (&inDB.header, "IMAGEID", OFF_T_FMT, 1,  &ID);
+  gfits_modify (&outDB.header, "NIMAGES", OFF_T_FMT, 1,  Nimages);
+  gfits_modify (&outDB.header, "IMAGEID", OFF_T_FMT, 1,  ID);
 
   // copy input rows to output table
Index: /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoverify.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoverify.c	(revision 28304)
+++ /branches/czw_branch/20100519/Ohana/src/dvomerge/src/dvoverify.c	(revision 28304)
@@ -0,0 +1,173 @@
+# include "dvomerge.h"
+
+/* things we can verify easily:
+   table sizes: (NAXIS1 vs EXTTYPE; NAXIS2 vs data size)
+   sum of catalog.average.Nmeasure == catalog.Nmeasure
+   averef, obj_id consistent between average and measure
+   do we need a checksum?
+*/
+
+int main (int argc, char **argv) {
+
+  char filename[256], *input, *output;
+
+  int depth;
+  off_t i, j, Ns, Ne;
+  SkyTable *outsky, *insky;
+  SkyList *inlist;
+  Catalog incatalog, outcatalog;
+
+  SetSignals ();
+  dvoconvert_help (argc, argv);
+  ConfigInit (&argc, argv);
+  dvoconvert_args (&argc, argv);
+
+  if (strcasecmp (argv[2], "to")) dvoconvert_usage();
+  input = argv[1];
+  output = argv[3];
+
+  // load input images, save to output images
+  dvoConvert_copy_images (input, output);
+
+  // copy photcode table
+  { 
+    // the first input defines the photcode table & db layout
+    sprintf (filename, "%s/Photcodes.dat", input);
+    if (!LoadPhotcodes (filename, NULL, FALSE)) {
+      fprintf (stderr, "error loading photcode table %s\n", filename);
+      exit (1);
+    }
+    // save the photcodes in the output catdir
+    sprintf (filename, "%s/Photcodes.dat", output);
+    if (!check_file_access (filename, TRUE, TRUE, VERBOSE)) {
+      fprintf (stderr, "error creating output catdir %s\n", output);
+      exit (1);
+    }
+    if (!SavePhotcodesFITS (filename)) {
+      fprintf (stderr, "error saving photcode table %s\n", filename);
+      exit (1);
+    }
+  }
+
+  // copy skytable
+  { 
+    // load the sky table for the existing database
+    insky = SkyTableLoadOptimal (input, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE);
+    SkyTableSetFilenames (insky, input, "cpt");
+
+    // generate an output table populated at the desired depth
+    // XXX force this to match the input?
+    outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+    SkyTableSetFilenames (outsky, output, "cpt");
+
+    SkyTablePopulatedRange (&Ns, &Ne, insky, 0);
+    depth = insky[0].regions[Ns].depth;
+    // XXX this seems to imply that insky is a uniform depth...
+  }
+
+  // loop over all input catalogs, save to output catalogs
+  // loop over the populatable output regions
+  for (i = 0; i < outsky[0].Nregions; i++) {
+    if (!outsky[0].regions[i].table) continue;
+    if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name);
+
+    // load / create output catalog
+    LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w");
+
+    // combine only tables at equal or larger depth
+      
+    // load in all of the tables from input for this region
+    inlist = SkyListByBounds (insky, depth, outsky[0].regions[i].Rmin, outsky[0].regions[i].Rmax, outsky[0].regions[i].Dmin, outsky[0].regions[i].Dmax);
+    for (j = 0; j < inlist[0].Nregions; j++) {
+      if (VERBOSE) fprintf (stderr, "input : %s\n", inlist[0].regions[j][0].name);
+
+      // load input catalog
+      LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r");
+
+      // skip empty input catalogs
+      if (!incatalog.Naves_disk) {
+	dvo_catalog_unlock (&incatalog);
+	dvo_catalog_free (&incatalog);
+	continue;
+      }
+      merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog);
+      dvo_catalog_unlock (&incatalog);
+      dvo_catalog_free (&incatalog);
+    }
+    SkyListFree (inlist);
+
+    outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    dvo_catalog_save (&outcatalog, VERBOSE);
+    dvo_catalog_unlock (&outcatalog);
+    dvo_catalog_free (&outcatalog);
+  }
+
+  // save the output sky table copy
+  sprintf (filename, "%s/SkyTable.fits", output);
+  check_file_access (filename, TRUE, TRUE, VERBOSE);
+  if (!SkyTableSave (outsky, filename)) {
+    fprintf (stderr, "ERROR: failed to save sky table for %s\n", output);
+    exit (1);
+  }
+
+  exit (0);
+}
+
+int dvoConvert_copy_images (char *input, char *output) {
+
+  FITS_DB inDB;
+  FITS_DB outDB;
+  int    status;
+
+  Image *images;
+  off_t Nimages;
+  off_t ID;
+
+  /*** load output/Images.dat ***/
+  sprintf (ImageCat, "%s/Images.dat", output);
+  outDB.mode   = dvo_catalog_catmode (CATMODE);
+  outDB.format = dvo_catalog_catformat (CATFORMAT);
+  status       = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD);  // shorter timeout?
+  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename);
+
+  // output image table should not already exist
+  if (outDB.dbstate != LCK_EMPTY) {
+    Shutdown ("ERROR: image table %s already exists", outDB.filename);
+  }
+  dvo_image_create (&outDB, GetZeroPoint());
+
+  /*** load input/Images.dat ***/
+  sprintf (ImageCat, "%s/Images.dat", input);
+  // inDB.mode   = dvo_catalog_catmode (CATMODE);
+  // inDB.format = dvo_catalog_catformat (CATFORMAT);
+  status       = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD);  // shorter timeout?
+  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);
+
+  // load the image table 
+  if (inDB.dbstate == LCK_EMPTY) {
+    Shutdown ("can't find input image catalog %s", inDB.filename);
+  }
+  if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {
+    Shutdown ("can't read input image catalog %s", inDB.filename);
+  }
+
+  // convert the raw image table to Image type (byteswap if needed)
+  images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped);
+
+  // update additional metadata
+  gfits_scan (&inDB.header, "IMAGEID", OFF_T_FMT, 1,  &ID);
+  gfits_modify (&outDB.header, "NIMAGES", OFF_T_FMT, 1,  Nimages);
+  gfits_modify (&outDB.header, "IMAGEID", OFF_T_FMT, 1,  ID);
+
+  // copy input rows to output table
+  gfits_add_rows (&outDB.ftable, (char *) images, Nimages, sizeof(Image));
+
+  // write out the image table to disk
+  SetProtect (TRUE);
+  dvo_image_save (&outDB, VERBOSE);
+  SetProtect (FALSE);
+  dvo_image_unlock (&outDB); // unlock output
+  dvo_image_unlock (&inDB); // unlock input1
+
+  return TRUE;
+}
Index: /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_new.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_new.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_new.c	(revision 28304)
@@ -72,8 +72,8 @@
   
   if (VERBOSE) {
-      fprintf (stderr, "%lld: using %lld stars (%lld measures) for catalog\n", 
-	       (long long) i, 
-	       (long long) output[0].Naverage, 
-	       (long long) output[0].Nmeasure);
+      fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures) for catalog\n", 
+	        i, 
+	        output[0].Naverage, 
+	        output[0].Nmeasure);
   }
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_old.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_old.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/dvomerge/src/merge_catalogs_old.c	(revision 28304)
@@ -96,5 +96,5 @@
 
   /* set up pointers for linked list of measure */
-  if (output[0].sorted && (output[0].Nmeasure == output[0].Nmeas_disk)) {
+  if (output[0].sorted && (output[0].Nmeasure >= output[0].Nmeas_disk)) {
     // this version is only valid if we have done a full catalog load, and if the catalog
     // is sorted while processed
@@ -183,5 +183,7 @@
       output[0].measure[Nmeas].catID    = output[0].catID;
 
-      // fprintf (stderr, "Nave : %lld, Nmeas : %lld, dR: %f, dD: %f, catID: %d\n", (long long) n, (long long) Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);
+      assert (output[0].measure[Nmeas].averef < Nave);
+
+      // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n",  n,  Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);
 
       // rationalize dR
@@ -216,5 +218,5 @@
   fprintf (stderr, "--- 1 ---\n");
   for (i = 0; i < Nmeas; i++) {
-    fprintf (stderr, "Nave : %d, Nmeas : %lld, dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef, (long long) i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
+    fprintf (stderr, "Nave : %d, Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef,  i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
   }
 # endif
@@ -321,5 +323,5 @@
   fprintf (stderr, "--- 2 ---\n");
   for (i = 0; i < Nmeas; i++) {
-    fprintf (stderr, "Nave : %d, Nmeas : %lld, dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef, (long long) i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
+    fprintf (stderr, "Nave : %d, Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef,  i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
   }
 # endif
@@ -336,5 +338,5 @@
   fprintf (stderr, "--- 3 ---\n");
   for (i = 0; i < Nmeas; i++) {
-    fprintf (stderr, "Nave : %d, Nmeas : %lld, dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef, (long long) i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
+    fprintf (stderr, "Nave : %d, Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n", output[0].measure[i].averef,  i, output[0].measure[i].dR, output[0].measure[i].dD, output[0].measure[i].catID);
   }
 # endif
@@ -354,5 +356,5 @@
   output[0].Nmeasure = Nmeas;
   output[0].Nsecf_mem = Nave*Nsecfilt;
-  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
+  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
 
   free (next_meas);
Index: /branches/czw_branch/20100519/Ohana/src/fixcat/src/wcatalog.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/fixcat/src/wcatalog.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/fixcat/src/wcatalog.c	(revision 28304)
@@ -34,7 +34,7 @@
   chmod (filename, mode);
   
-  gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, catalog[0].Naverage);
-  gfits_modify (&catalog[0].header, "NMEAS",  "%lld", 1, catalog[0].Nmeasure);
-  gfits_modify (&catalog[0].header, "NMISS",  "%lld", 1, catalog[0].Nmissing);
+  gfits_modify (&catalog[0].header, "NSTARS", OFF_T_FMT, 1, catalog[0].Naverage);
+  gfits_modify (&catalog[0].header, "NMEAS",  OFF_T_FMT, 1, catalog[0].Nmeasure);
+  gfits_modify (&catalog[0].header, "NMISS",  OFF_T_FMT, 1, catalog[0].Nmissing);
 
   gfits_modify_alt (&catalog[0].header, "MARKSTAR", "%t", 1, TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/getstar/src/MatchImages.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/getstar/src/MatchImages.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/getstar/src/MatchImages.c	(revision 28304)
@@ -132,5 +132,5 @@
   }
   
-  if (VERBOSE) fprintf (stderr, "found %lld overlapping images\n", (long long) nmatch);
+  if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" overlapping images\n",  nmatch);
 
   *Nmatch = nmatch;
Index: /branches/czw_branch/20100519/Ohana/src/getstar/src/SelectImages.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/getstar/src/SelectImages.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/getstar/src/SelectImages.c	(revision 28304)
@@ -31,5 +31,5 @@
   }  
 
-  if (VERBOSE) fprintf (stderr, "found %lld matching images\n", (long long) nmatch);
+  if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" matching images\n",  nmatch);
 
   *Nmatch = nmatch;
Index: /branches/czw_branch/20100519/Ohana/src/getstar/src/select_by_region.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/getstar/src/select_by_region.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/getstar/src/select_by_region.c	(revision 28304)
@@ -161,6 +161,6 @@
   output[0].Nsecf_mem = Nave*Nsecfilt;
 
-  fprintf (stderr, "output catalog has %lld stars (%lld measures, %d secfilt)\n",
-           (long long) output[0].Naverage, (long long) output[0].Nmeasure, output[0].Nsecfilt);
+  fprintf (stderr, "output catalog has "OFF_T_FMT" stars ("OFF_T_FMT" measures, %d secfilt)\n",
+            output[0].Naverage,  output[0].Nmeasure, output[0].Nsecfilt);
   return (TRUE);
 }
Index: /branches/czw_branch/20100519/Ohana/src/imregister/detrend/delete.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/detrend/delete.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/detrend/delete.c	(revision 28304)
@@ -10,5 +10,5 @@
   ALLOCATE (keep, off_t, MAX (Nimage, 1));
   for (i = 0; i < Nimage; i++) keep[i] = TRUE;
-  fprintf (stderr, "total of %lld detrend images\n", (long long) Nimage);
+  fprintf (stderr, "total of "OFF_T_FMT" detrend images\n",  Nimage);
 
   Ndel = 0;
@@ -20,5 +20,5 @@
     delete_image (&image[i]);
   }
-  fprintf (stderr, "delete %lld images\n", (long long) Ndel);
+  fprintf (stderr, "delete "OFF_T_FMT" images\n",  Ndel);
   if (Ndel == 0) { 
     fprintf (stderr, "SUCCESS\n");
@@ -30,5 +30,5 @@
   Nsubset = Nimage - Ndel;
   ALLOCATE (subset, DetReg, MAX (1, Nsubset));
-  fprintf (stderr, "keeping %lld images\n", (long long) Nsubset);
+  fprintf (stderr, "keeping "OFF_T_FMT" images\n",  Nsubset);
   for (j = i = 0; i < Nimage; i++) {
     if (!keep[i]) continue;
Index: /branches/czw_branch/20100519/Ohana/src/imregister/imphot/rtext.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/imphot/rtext.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/imphot/rtext.c	(revision 28304)
@@ -10,5 +10,5 @@
   /* check that file size makes sense */
   Nimage = 0;
-  gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (&db[0].header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   if (stat (db[0].filename, &filestatus) == -1) {
     if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n");
@@ -21,5 +21,5 @@
     Ndata = (filestatus.st_size - db[0].header.datasize) / sizeof (Image);
     if (VERBOSE) fprintf (stderr, "ERROR: image catalog has inconsistent size\n");
-    if (VERBOSE) fprintf (stderr, "header: %lld, data: %d\n", (long long) Nimage, Ndata);
+    if (VERBOSE) fprintf (stderr, "header: "OFF_T_FMT", data: %d\n",  Nimage, Ndata);
     if (!FORCE_READ) exit (1);
     Nimage = Ndata;
@@ -41,5 +41,5 @@
   } 
   db[0].ftable.buffer = (char *) image;
-  gfits_modify (&db[0].theader, "NAXIS2", "%lld", 1, (long long) Nimage);
+  gfits_modify (&db[0].theader, "NAXIS2", OFF_T_FMT, 1,  Nimage);
   db[0].theader.Naxis[1] = Nimage;
   db[0].ftable.datasize = gfits_data_size (&db[0].theader);
Index: /branches/czw_branch/20100519/Ohana/src/imregister/imreg/delete.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/imreg/delete.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/imreg/delete.c	(revision 28304)
@@ -10,5 +10,5 @@
   ALLOCATE (keep, off_t, MAX (Nimage, 1));
   for (i = 0; i < Nimage; i++) keep[i] = TRUE;
-  fprintf (stderr, "total of %lld images\n", (long long) Nimage);
+  fprintf (stderr, "total of "OFF_T_FMT" images\n",  Nimage);
 
   Ndel = 0;
@@ -19,5 +19,5 @@
     Ndel ++;
   }
-  fprintf (stderr, "delete %lld images\n", (long long) Ndel);
+  fprintf (stderr, "delete "OFF_T_FMT" images\n",  Ndel);
   if (Ndel == 0) { 
     fprintf (stderr, "SUCCESS\n");
@@ -29,5 +29,5 @@
   Nsubset = Nimage - Ndel;
   ALLOCATE (subset, RegImage, MAX (1, Nsubset));
-  fprintf (stderr, "keeping %lld images\n", (long long) Nsubset);
+  fprintf (stderr, "keeping "OFF_T_FMT" images\n",  Nsubset);
   for (j = i = 0; i < Nimage; i++) {
     if (!keep[i]) continue;
Index: /branches/czw_branch/20100519/Ohana/src/imregister/photreg/delete.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/photreg/delete.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/photreg/delete.c	(revision 28304)
@@ -10,5 +10,5 @@
   ALLOCATE (keep, off_t, MAX (Nphotdata, 1));
   for (i = 0; i < Nphotdata; i++) keep[i] = TRUE;
-  fprintf (stderr, "total of %lld photdata\n", (long long) Nphotdata);
+  fprintf (stderr, "total of "OFF_T_FMT" photdata\n",  Nphotdata);
 
   Ndel = 0;
@@ -19,5 +19,5 @@
     Ndel ++;
   }
-  fprintf (stderr, "delete %lld photdata\n", (long long) Ndel);
+  fprintf (stderr, "delete "OFF_T_FMT" photdata\n",  Ndel);
 
   if (Ndel == 0) { 
@@ -31,5 +31,5 @@
   Nsubset = Nphotdata - Ndel;
   ALLOCATE (subset, PhotPars, MAX (1, Nsubset));
-  fprintf (stderr, "keeping %lld photdata\n", (long long) Nsubset);
+  fprintf (stderr, "keeping "OFF_T_FMT" photdata\n",  Nsubset);
   for (j = i = 0; i < Nphotdata; i++) {
     if (!keep[i]) continue;
Index: /branches/czw_branch/20100519/Ohana/src/imregister/spreg/delete.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/spreg/delete.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/spreg/delete.c	(revision 28304)
@@ -10,5 +10,5 @@
   ALLOCATE (keep, off_t, MAX (Nspectrum, 1));
   for (i = 0; i < Nspectrum; i++) keep[i] = TRUE;
-  fprintf (stderr, "total of %lld spectra\n", (long long) Nspectrum);
+  fprintf (stderr, "total of "OFF_T_FMT" spectra\n",  Nspectrum);
 
   Nbad = 0;
@@ -19,5 +19,5 @@
     Nbad ++;
   }
-  fprintf (stderr, "delete %lld spectra\n", (long long) Nbad);
+  fprintf (stderr, "delete "OFF_T_FMT" spectra\n",  Nbad);
   if (Nbad == 0) { 
     fprintf (stderr, "SUCCESS\n");
@@ -28,5 +28,5 @@
   Nsubset = Nspectrum - Nbad;
   ALLOCATE (subset, Spectrum, MAX (1, Nsubset));
-  fprintf (stderr, "keeping %lld spectra\n", (long long) Nsubset);
+  fprintf (stderr, "keeping "OFF_T_FMT" spectra\n",  Nsubset);
   for (j = i = 0; i < Nspectrum; i++) {
     if (!keep[i]) continue;
Index: /branches/czw_branch/20100519/Ohana/src/imregister/src/convertimreg.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/src/convertimreg.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/src/convertimreg.c	(revision 28304)
@@ -41,9 +41,9 @@
 
   /* load existing data from database */
-  gfits_scan (&header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (&header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   ALLOCATE (pimage, RegImage, Nimage);
   status = fread (pimage, sizeof(RegImage), Nimage, f);
   if (status != Nimage) {
-    fprintf (stderr, "ERROR: header and data in dB don't match (%lld vs %lld)\n", (long long) Nimage, (long long) status);
+    fprintf (stderr, "ERROR: header and data in dB don't match ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nimage,  status);
     fclearlockfile (argv[1], f, lockstate, &dbstate);
     exit (1);
Index: /branches/czw_branch/20100519/Ohana/src/imregister/src/imphotmerge.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/imregister/src/imphotmerge.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/imregister/src/imphotmerge.c	(revision 28304)
@@ -113,5 +113,5 @@
   }
   Nimage += Nin;
-  gfits_modify (&header, "NIMAGES", "%lld", 1, (long long) Nimage);
+  gfits_modify (&header, "NIMAGES", OFF_T_FMT, 1,  Nimage);
 
   /* position to begining of file to write header */
@@ -152,5 +152,5 @@
   /* check that file size makes sense */
   Nimage = 0;
-  gfits_scan (header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   if (fstat (fileno(f), &filestatus) == -1) {
     fprintf (stderr, "ERROR: failed to get status of image catalog\n");
@@ -161,5 +161,5 @@
     Ndata = (filestatus.st_size - header[0].datasize) / sizeof (Image);
     fprintf (stderr, "ERROR: image catalog has inconsistent size\n");
-    fprintf (stderr, "header: %lld, data: %lld\n", (long long) Nimage, (long long) Ndata);
+    fprintf (stderr, "header: "OFF_T_FMT", data: "OFF_T_FMT"\n",  Nimage,  Ndata);
     Nimage = Ndata;
   } 
Index: /branches/czw_branch/20100519/Ohana/src/kapa2/src/LoadPicture.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/kapa2/src/LoadPicture.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/kapa2/src/LoadPicture.c	(revision 28304)
@@ -32,5 +32,5 @@
   gfits_init_header (&header);
   header.Naxes = 2;
-  KiiScanMessage (sock, "%lld %lld", (long long *) &header.Naxis[0], (long long *) &header.Naxis[1]);
+  KiiScanMessage (sock, OFF_T_FMT" "OFF_T_FMT,  &header.Naxis[0],  &header.Naxis[1]);
 
   // internal image are 32 bit floats; sender must send in this format
@@ -41,5 +41,5 @@
 
   KiiScanMessage (sock, "%lf %lf %s %s",  &image[0].image[0].zero, &image[0].image[0].range, image[0].image[0].name, image[0].image[0].file);
-  KiiScanMessage (sock, "%lf %lf %lld", &image[0].image[0].min,  &image[0].image[0].max, (long long *) &header.datasize);
+  KiiScanMessage (sock, "%lf %lf "OFF_T_FMT, &image[0].image[0].min,  &image[0].image[0].max,  &header.datasize);
   KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval1, &image[0].image[0].coords.crpix1, &image[0].image[0].coords.cdelt1, &image[0].image[0].coords.pc1_1, &image[0].image[0].coords.pc1_2);
   KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval2, &image[0].image[0].coords.crpix2, &image[0].image[0].coords.cdelt2, &image[0].image[0].coords.pc2_1, &image[0].image[0].coords.pc2_2);
@@ -85,8 +85,8 @@
   fcntl (sock, F_SETFL, !O_NONBLOCK);  
 
-  if (DEBUG) fprintf (stderr, "read %lld bytes\n", (long long) image[0].image[0].matrix.datasize);
+  if (DEBUG) fprintf (stderr, "read "OFF_T_FMT" bytes\n",  image[0].image[0].matrix.datasize);
   /* it it not obvious this condition should kill kapa, but ... */
   if (image[0].image[0].matrix.datasize != header.datasize) {  
-    fprintf (stderr, "error: expected %lld bytes, but got only %lld\n", (long long) header.datasize, (long long) image[0].image[0].matrix.datasize);
+    fprintf (stderr, "error: expected "OFF_T_FMT" bytes, but got only "OFF_T_FMT"\n",  header.datasize,  image[0].image[0].matrix.datasize);
     return (FALSE);
   }
Index: /branches/czw_branch/20100519/Ohana/src/libautocode/def/autocode.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libautocode/def/autocode.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libautocode/def/autocode.c	(revision 28304)
@@ -7,5 +7,5 @@
 
   if (size != $SIZE) { 
-    fprintf (stderr, "WARNING: mismatch in data types $STRUCT: %lld vs %lld\n", (long long) size, (long long) $SIZE);
+    fprintf (stderr, "WARNING: mismatch in data types $STRUCT: "OFF_T_FMT" vs %d\n",  size,  $SIZE);
     return (FALSE);
   }
@@ -32,5 +32,5 @@
 
   if ($SIZE > size) { 
-    fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: %lld vs %lld\n", (long long) size, (long long) $SIZE);
+    fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: "OFF_T_FMT" vs %d\n",  size,  $SIZE);
     exit (1);
   }
@@ -60,5 +60,12 @@
 $STRUCT *gfits_table_get_$STRUCT (FTable *ftable, off_t *Ndata, char *swapped) {
 
+  int Ncols;
   $STRUCT *data, *output;
+
+  Ncols = ftable[0].header[0].Naxis[0];
+  if (Ncols != $SIZE) {
+    fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, $SIZE);
+    exit (1);
+  }
 
   *Ndata = ftable[0].header[0].Naxis[1];
@@ -84,5 +91,5 @@
 
   /* create table header */
-  gfits_create_table_header (header, "$TYPE", "$EXTNAME");
+  if (!gfits_create_table_header (header, "$TYPE", "$EXTNAME")) return (FALSE);
 
   /* define table layout */
@@ -90,10 +97,10 @@
 
   /* create table */
-  gfits_create_table (header, ftable);
+  if (!gfits_create_table (header, ftable)) return (FALSE);
 
   /* add data values */
-  gfits_table_scale_data (ftable);
-  gfits_convert_$STRUCT (data, sizeof ($STRUCT), Ndata);
-  gfits_add_rows (ftable, (char *) data, Ndata, sizeof ($STRUCT));
+  if (!gfits_table_scale_data (ftable)) return (FALSE);
+  if (!gfits_convert_$STRUCT (data, sizeof ($STRUCT), Ndata)) return (FALSE);
+  if (!gfits_add_rows (ftable, (char *) data, Ndata, sizeof ($STRUCT))) return (FALSE);
 
   return (TRUE);
@@ -103,5 +110,5 @@
 
   /* create table header */
-  gfits_create_table_header (header, "$TYPE", "$EXTNAME");
+  if (!gfits_create_table_header (header, "$TYPE", "$EXTNAME")) return (FALSE);
 
   /* define table layout */
@@ -125,5 +132,5 @@
   }
 
-  gfits_convert_$STRUCT (tmpdata, sizeof ($STRUCT), Ndata);
+  if (!gfits_convert_$STRUCT (tmpdata, sizeof ($STRUCT), Ndata)) return (FALSE);
 
   SendCommand (device, 16, "NVALUE: %6d", Ndata);
@@ -153,5 +160,5 @@
   
   tmpdata = ($STRUCT *) message.buffer;
-  gfits_convert_$STRUCT (tmpdata, sizeof ($STRUCT), ndata);
+  if (!gfits_convert_$STRUCT (tmpdata, sizeof ($STRUCT), ndata)) return (FALSE);
 
   /* double-check data length? */
Index: /branches/czw_branch/20100519/Ohana/src/libautocode/def/common.h
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libautocode/def/common.h	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libautocode/def/common.h	(revision 28304)
@@ -22,18 +22,8 @@
   tmp = byte[X+3]; byte[X+3] = byte[X+4]; byte[X+4] = tmp;
 
-# ifdef linux
-# define BYTE_SWAP
+# ifndef BYTE_SWAP
+# ifndef NOT_BYTE_SWAP
+# error "neither BYTE_SWAP not NOT_BYTE_SWAP is set"
 # endif
-
-# ifdef darwin_x86
-# define BYTE_SWAP
-# endif
-
-# ifdef sid
-# define BYTE_SWAP
-# endif
-
-# ifdef dec
-# define BYTE_SWAP
 # endif
 
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/LoadPhotcodes.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/LoadPhotcodes.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/LoadPhotcodes.c	(revision 28304)
@@ -15,5 +15,5 @@
   if (LoadPhotcodesText (master_file)) { 
     if (!check_file_access (catdir_file, TRUE, TRUE, TRUE)) return TRUE;
-    SavePhotcodesFITS (catdir_file);
+    if (!SavePhotcodesFITS (catdir_file)) return FALSE;
     return TRUE;
   }
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/SavePhotcodesFITS.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 28304)
@@ -32,8 +32,8 @@
 
   /* convert FITS format data to internal format (byteswaps & EXTNAME) */
-  gfits_db_create (&db);
-  gfits_table_set_PhotCode_PS1_V2 (&db.ftable, photcode_output, table[0].Ncode);
-  gfits_db_save (&db);
-  gfits_db_close (&db);
+  if (!gfits_db_create (&db)) return (FALSE);
+  if (!gfits_table_set_PhotCode_PS1_V2 (&db.ftable, photcode_output, table[0].Ncode)) return (FALSE);
+  if (!gfits_db_save (&db)) return (FALSE);
+  if (!gfits_db_close (&db)) return (FALSE);
 
   free (photcode_output);
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c	(revision 28304)
@@ -13,5 +13,5 @@
   // this function is a special case : it must have Nx = 136
   if (ftable[0].header[0].Naxis[0] != 136) { 
-    fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: %lld vs %d\n", (long long) ftable[0].header[0].Naxis[0], 136);
+    fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: "OFF_T_FMT" vs %d\n",  ftable[0].header[0].Naxis[0], 136);
     exit (2);
   }
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_mef.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 28304)
@@ -24,7 +24,7 @@
   }
   /* get the components from the header */
-  if (!gfits_scan (&catalog[0].header, "NSTARS",   "%lld", 1, (long long *) &Naverage)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMEAS",    "%lld", 1, (long long *) &Nmeasure)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMISS",    "%lld", 1, (long long *) &Nmissing)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &Naverage)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  &Nmeasure)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  &Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d",   1,               &Nsecfilt)) Nsecfilt = 0;
 
@@ -73,5 +73,5 @@
     catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary);
     if (Naverage != catalog[0].Naves_disk) {
-      fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%lld vs %lld)\n", (long long) Naverage, (long long) catalog[0].Naves_disk);
+      fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Naverage,  catalog[0].Naves_disk);
     }
     catalog[0].Naverage = catalog[0].Naves_disk;
@@ -100,5 +100,5 @@
     catalog[0].measure = FtableToMeasure (&ftable, &catalog[0].Nmeasure, &catalog[0].catformat);
     if (Nmeasure != catalog[0].Nmeas_disk) {
-      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) catalog[0].Nmeas_disk);
+      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmeasure,  catalog[0].Nmeas_disk);
     }
     catalog[0].Nmeasure = catalog[0].Nmeas_disk;
@@ -126,5 +126,5 @@
     catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL);
     if (Nmissing != catalog[0].Nmiss_disk) {
-      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) catalog[0].Nmiss_disk);
+      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  catalog[0].Nmiss_disk);
     }
     catalog[0].Nmissing = catalog[0].Nmiss_disk;
@@ -154,5 +154,5 @@
     catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat);
     if (Nexpect != Nitems) {
-      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nexpect, (long long) Nitems);
+      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nexpect,  Nitems);
     }
 
@@ -238,7 +238,7 @@
 
   /* make sure header is consistent with data */
-  gfits_modify (&catalog[0].header, "NSTARS",   "%lld", 1, (long long) catalog[0].Naverage);
-  gfits_modify (&catalog[0].header, "NMEAS",    "%lld", 1, (long long) catalog[0].Nmeasure);
-  gfits_modify (&catalog[0].header, "NMISS",    "%lld", 1, (long long) catalog[0].Nmissing);
+  gfits_modify (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  catalog[0].Naverage);
+  gfits_modify (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  catalog[0].Nmeasure);
+  gfits_modify (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  catalog[0].Nmissing);
   gfits_modify (&catalog[0].header, "NSECFILT", "%d",   1,                        Nsecfilt);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 28304)
@@ -21,7 +21,7 @@
   /* get the components from the header */
   catalog[0].Naverage = catalog[0].Nmeasure = catalog[0].Nmissing = catalog[0].Nsecfilt = 0;
-  if (!gfits_scan (&catalog[0].header, "NSTARS",   "%lld", 1, (long long *) &catalog[0].Naverage)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMEAS",    "%lld", 1, (long long *) &catalog[0].Nmeasure)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMISS",    "%lld", 1, (long long *) &catalog[0].Nmissing)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &catalog[0].Naverage)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  &catalog[0].Nmeasure)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  &catalog[0].Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d",   1,               &catalog[0].Nsecfilt)) catalog[0].Nsecfilt = 0;
 
@@ -113,9 +113,9 @@
     if (VERBOSE) {
       fprintf (stderr, "star catalog has inconsistent size\n");
-      fprintf (stderr, "average: %lld = %lld bytes\n", (long long) catalog[0].Naverage, (long long) catalog[0].Naverage*AverageSize);
-      fprintf (stderr, "measure: %lld = %lld bytes\n", (long long) catalog[0].Nmeasure, (long long) catalog[0].Nmeasure*MeasureSize);
-      fprintf (stderr, "missing: %lld = %lld bytes\n", (long long) catalog[0].Nmissing, (long long) catalog[0].Nmissing*MissingSize);
-      fprintf (stderr, "secfilt: %lld = %lld bytes\n", (long long) catalog[0].Nsecfilt, (long long) catalog[0].Nsecfilt*SecFiltSize*catalog[0].Naverage);
-      fprintf (stderr, "expect: %lld, found: %lld\n", (long long) size, (long long) filestatus.st_size);
+      fprintf (stderr, "average: "OFF_T_FMT" = "OFF_T_FMT" bytes\n",  catalog[0].Naverage,  catalog[0].Naverage*AverageSize);
+      fprintf (stderr, "measure: "OFF_T_FMT" = "OFF_T_FMT" bytes\n",  catalog[0].Nmeasure,  catalog[0].Nmeasure*MeasureSize);
+      fprintf (stderr, "missing: "OFF_T_FMT" = "OFF_T_FMT" bytes\n",  catalog[0].Nmissing,  catalog[0].Nmissing*MissingSize);
+      fprintf (stderr, "secfilt: %d = "OFF_T_FMT" bytes\n",  catalog[0].Nsecfilt,  catalog[0].Nsecfilt*SecFiltSize*catalog[0].Naverage);
+      fprintf (stderr, "expect: "OFF_T_FMT", found: "OFF_T_FMT"\n",  size,  filestatus.st_size);
     }
     return (FALSE);
@@ -155,5 +155,5 @@
     nitems = fread (catalog[0].missing, MissingSize, Nitems, f);
     if (nitems != Nitems) {
-      if (VERBOSE) fprintf (stderr, "failed to read missing from catalog file %s (%lld vs %lld)\n", catalog[0].filename, (long long) nitems, (long long) Nitems);
+      if (VERBOSE) fprintf (stderr, "failed to read missing from catalog file %s ("OFF_T_FMT" vs "OFF_T_FMT")\n", catalog[0].filename,  nitems,  Nitems);
       return (FALSE);
     }
@@ -198,10 +198,10 @@
   }
 
-  if (VERBOSE) fprintf (stderr, "read %lld stars from catalog file %s (%lld measurements, %lld missing, %lld secondary filters)\n", 
-			(long long) catalog[0].Naverage, 
+  if (VERBOSE) fprintf (stderr, "read "OFF_T_FMT" stars from catalog file %s ("OFF_T_FMT" measurements, "OFF_T_FMT" missing, %d secondary filters)\n", 
+			 catalog[0].Naverage, 
 			catalog[0].filename, 
-			(long long) catalog[0].Nmeasure, 
-			(long long) catalog[0].Nmissing, 
-			(long long) catalog[0].Nsecfilt);
+			 catalog[0].Nmeasure, 
+			 catalog[0].Nmissing, 
+			 catalog[0].Nsecfilt);
 
   /* check data integrity */
@@ -214,6 +214,6 @@
       if (VERBOSE) {
 	fprintf (stderr, "****** data in catalog %s is corrupt, sums don't check\n", catalog[0].filename);
-	fprintf (stderr, "****** Nmeas: %lld, %lld\n", (long long) Nmeas, (long long) catalog[0].Nmeasure);
-	fprintf (stderr, "****** Nmiss: %lld, %lld\n", (long long) Nmiss, (long long) catalog[0].Nmissing);
+	fprintf (stderr, "****** Nmeas: "OFF_T_FMT", "OFF_T_FMT"\n",  Nmeas,  catalog[0].Nmeasure);
+	fprintf (stderr, "****** Nmiss: "OFF_T_FMT", "OFF_T_FMT"\n",  Nmiss,  catalog[0].Nmissing);
       }
       return (FALSE);
@@ -264,8 +264,8 @@
 
   /* make sure header is consistent with data */
-  gfits_modify (&catalog[0].header, "NSTARS",   "%lld", 1, (long long) catalog[0].Naverage);
-  gfits_modify (&catalog[0].header, "NMEAS",    "%lld", 1, (long long) catalog[0].Nmeasure);
-  gfits_modify (&catalog[0].header, "NMISS",    "%lld", 1, (long long) catalog[0].Nmissing);
-  gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, (long long) catalog[0].Nsecfilt);
+  gfits_modify (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  catalog[0].Naverage);
+  gfits_modify (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  catalog[0].Nmeasure);
+  gfits_modify (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  catalog[0].Nmissing);
+  gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1,  catalog[0].Nsecfilt);
   gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
@@ -353,5 +353,5 @@
       nitems = fread (tmpAverage, sizeof(Average_##TYPE), Naverage, f); \
       if (nitems != Naverage) { \
-	fprintf (stderr, "failed to read averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); \
+	fprintf (stderr, "failed to read averages ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Naverage); \
 	return (NULL); \
       } \
@@ -367,5 +367,5 @@
       nitems = fread (average, sizeof(Average), Naverage, f);
       if (nitems != Naverage) {
-	fprintf (stderr, "failed to read averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage);
+	fprintf (stderr, "failed to read averages ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Naverage);
 	return (NULL);
       }
@@ -406,5 +406,5 @@
       free (tmpAverage); \
       if (nitems != Naverage) { \
-	fprintf (stderr, "failed to write averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); \
+	fprintf (stderr, "failed to write averages ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Naverage); \
 	return (FALSE); \
       } \
@@ -417,5 +417,5 @@
       nitems = fwrite (average, sizeof(Average), Naverage, f);
       if (nitems != Naverage) {
-	fprintf (stderr, "failed to write averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage);
+	fprintf (stderr, "failed to write averages ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Naverage);
 	return (FALSE);
       }
@@ -455,5 +455,5 @@
       nitems = fread (tmpMeasure, sizeof(Measure_##TYPE), Nmeasure, f); \
       if (nitems != Nmeasure) { \
-	fprintf (stderr, "failed to read measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); \
+	fprintf (stderr, "failed to read measures ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nmeasure); \
 	return (NULL); \
       } \
@@ -469,5 +469,5 @@
       nitems = fread (measure, sizeof(Measure), Nmeasure, f);
       if (nitems != Nmeasure) {
-	fprintf (stderr, "failed to read measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure);
+	fprintf (stderr, "failed to read measures ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nmeasure);
 	return (NULL);
       }
@@ -508,5 +508,5 @@
       free (tmpMeasure); \
       if (nitems != Nmeasure) { \
-	fprintf (stderr, "failed to write measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); \
+	fprintf (stderr, "failed to write measures ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nmeasure); \
 	return (FALSE); \
       } \
@@ -519,5 +519,5 @@
       nitems = fwrite (measure, sizeof(Measure), Nmeasure, f);
       if (nitems != Nmeasure) {
-	fprintf (stderr, "failed to write measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure);
+	fprintf (stderr, "failed to write measures ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nmeasure);
 	return (FALSE);
       }
@@ -557,5 +557,5 @@
       nitems = fread (tmpSecFilt, sizeof(SecFilt_##TYPE), Nsecfilt, f); \
       if (nitems != Nsecfilt) { \
-	fprintf (stderr, "failed to read secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); \
+	fprintf (stderr, "failed to read secfilts ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nsecfilt); \
 	return (NULL); \
       } \
@@ -571,5 +571,5 @@
       nitems = fread (secfilt, sizeof(SecFilt), Nsecfilt, f);
       if (nitems != Nsecfilt) {
-	fprintf (stderr, "failed to read secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt);
+	fprintf (stderr, "failed to read secfilts ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nsecfilt);
 	return (NULL);
       }
@@ -610,5 +610,5 @@
       free (tmpSecFilt); \
       if (nitems != Nsecfilt) { \
-	fprintf (stderr, "failed to write secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); \
+	fprintf (stderr, "failed to write secfilts ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nsecfilt); \
 	return (FALSE); \
       } \
@@ -621,5 +621,5 @@
       nitems = fwrite (secfilt, sizeof(SecFilt), Nsecfilt, f);
       if (nitems != Nsecfilt) {
-	fprintf (stderr, "failed to write secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt);
+	fprintf (stderr, "failed to write secfilts ("OFF_T_FMT" vs "OFF_T_FMT")\n",  nitems,  Nsecfilt);
 	return (FALSE);
       }
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 28304)
@@ -174,7 +174,7 @@
 
   /* get the components from the header - these duplicate information in the split files (NAXIS2) */
-  if (!gfits_scan (&catalog[0].header, "NSTARS",   "%lld", 1, (long long *) &Naverage)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMEAS",    "%lld", 1, (long long *) &Nmeasure)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMISS",    "%lld", 1, (long long *) &Nmissing)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &Naverage)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  &Nmeasure)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  &Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d",   1,               &Nsecfilt)) Nsecfilt = 0;
 
@@ -227,5 +227,5 @@
     catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary);
     if (Naverage != catalog[0].Naves_disk) {
-      fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%lld vs %lld)\n", (long long) Naverage, (long long) catalog[0].Naves_disk);
+      fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Naverage,  catalog[0].Naves_disk);
     }
     gfits_free_header (&header);
@@ -256,5 +256,5 @@
     catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat);
     if (Nmeasure != catalog[0].Nmeas_disk) {
-      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) catalog[0].Nmeas_disk);
+      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmeasure,  catalog[0].Nmeas_disk);
     }
     catalog[0].Nmeasure = catalog[0].Nmeas_disk;
@@ -286,5 +286,5 @@
     catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL);
     if (Nmissing != catalog[0].Nmiss_disk) {
-      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) catalog[0].Nmiss_disk);
+      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  catalog[0].Nmiss_disk);
     }
     catalog[0].Nmissing = catalog[0].Nmiss_disk;
@@ -315,5 +315,5 @@
     catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat);
     if (Nitems != catalog[0].Nsecf_disk) {
-      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nitems, (long long) catalog[0].Nsecf_disk);
+      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nitems,  catalog[0].Nsecf_disk);
     }
     catalog[0].Nsecf_mem = catalog[0].Nsecf_disk;
@@ -408,5 +408,5 @@
     catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat);
     if (Nitems != Nexpect) {
-      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nitems, (long long) Nexpect);
+      fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nitems,  Nexpect);
     }
     catalog[0].Nsecf_mem = catalog[0].Naverage * catalog[0].Nsecfilt;
@@ -444,5 +444,5 @@
     catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat);
     if (Nmeasure != Nrows) {
-      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) Nrows);
+      fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmeasure,  Nrows);
     }
     gfits_free_header (&header);
@@ -474,5 +474,5 @@
     catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL);
     if (Nmissing != Nrows) {
-      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) Nrows);
+      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  Nrows);
     }
     gfits_free_header (&header);
@@ -524,7 +524,7 @@
 
   /* make sure header is consistent with data */
-  gfits_modify (&catalog[0].header, "NSTARS",   "%lld", 1, (long long) Naves_disk_new);
-  gfits_modify (&catalog[0].header, "NMEAS",    "%lld", 1, (long long) Nmeas_disk_new);
-  gfits_modify (&catalog[0].header, "NMISS",    "%lld", 1, (long long) Nmiss_disk_new);
+  gfits_modify (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  Naves_disk_new);
+  gfits_modify (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  Nmeas_disk_new);
+  gfits_modify (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  Nmiss_disk_new);
   gfits_modify (&catalog[0].header, "NSECFILT", "%d",   1, Nsecfilt);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
@@ -723,7 +723,7 @@
 
   /* make sure header is consistent with data */
-  gfits_modify (&catalog[0].header, "NSTARS",   "%lld", 1, (long long) Naves_disk_new);
-  gfits_modify (&catalog[0].header, "NMEAS",    "%lld", 1, (long long) Nmeas_disk_new);
-  gfits_modify (&catalog[0].header, "NMISS",    "%lld", 1, (long long) Nmiss_disk_new);
+  gfits_modify (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  Naves_disk_new);
+  gfits_modify (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  Nmeas_disk_new);
+  gfits_modify (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  Nmiss_disk_new);
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
@@ -902,7 +902,7 @@
 
   /* make sure header is consistent with data */
-  gfits_modify (&catalog[0].header, "NSTARS",   "%lld", 1, (long long) Naves_disk_new);
-  gfits_modify (&catalog[0].header, "NMEAS",    "%lld", 1, (long long) Nmeas_disk_new);
-  gfits_modify (&catalog[0].header, "NMISS",    "%lld", 1, (long long) Nmiss_disk_new);
+  gfits_modify (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  Naves_disk_new);
+  gfits_modify (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  Nmeas_disk_new);
+  gfits_modify (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  Nmiss_disk_new);
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_convert.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_convert.c	(revision 28304)
@@ -267,5 +267,5 @@
     gfits_free_header (theader);
     gfits_table_mkheader_Image (theader);
-    gfits_modify (theader, "NAXIS2", "%lld", 1, (long long) Nimage);
+    gfits_modify (theader, "NAXIS2", OFF_T_FMT, 1,  Nimage);
     theader[0].Naxis[1] = Nimage;
     ftable[0].datasize = gfits_data_size (theader);
@@ -288,5 +288,5 @@
     gfits_free_header (theader); \
     gfits_table_mkheader_Image (theader); \
-    gfits_modify (theader, "NAXIS2", "%lld", 1, (long long) Nimage); \
+    gfits_modify (theader, "NAXIS2", OFF_T_FMT, 1,  Nimage); \
     theader[0].Naxis[1] = Nimage; \
     ftable[0].datasize = gfits_data_size (theader); \
@@ -373,8 +373,8 @@
       } \
       /* convert header from old format to new format */ \
-      gfits_scan (theader, "NAXIS2", "%lld", 1, (long long *) &Nimage); \
+      gfits_scan (theader, "NAXIS2", OFF_T_FMT, 1,  &Nimage); \
       gfits_free_header (theader); \
       gfits_table_mkheader_Image_##TYPE (theader); \
-      gfits_modify (theader, "NAXIS2", "%lld", 1, (long long) Nimage); \
+      gfits_modify (theader, "NAXIS2", OFF_T_FMT, 1,  Nimage); \
       theader[0].Naxis[1] = Nimage; \
       vtable[0].datasize = gfits_data_size (theader); \
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image.c	(revision 28304)
@@ -120,14 +120,17 @@
   /* adjust header */
   Nimages = 0;
-  gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, (long long *) &Nimages);
+  if (!gfits_scan (&db[0].header, "NIMAGES", OFF_T_FMT, 1,  &Nimages)) return (FALSE);
   Nimages += Nnew;
-  gfits_modify (&db[0].header, "NIMAGES", "%lld", 1, (long long) Nimages);
-
-  gfits_table_to_vtable (&db[0].ftable, &db[0].vtable, 0, 0);
-  gfits_vadd_rows (&db[0].vtable, (char *) new, Nnew, sizeof(Image));
+
+  if (!gfits_modify (&db[0].header, "NIMAGES", OFF_T_FMT, 1,  Nimages)) return (FALSE);
+
+  if (!gfits_table_to_vtable (&db[0].ftable, &db[0].vtable, 0, 0)) return (FALSE);
+
+  if (!gfits_vadd_rows (&db[0].vtable, (char *) new, Nnew, sizeof(Image))) return (FALSE);
 
   /* check that primary header and table header agree */
   if (Nimages != db[0].theader.Naxis[1]) {
     fprintf (stderr, "header / table length mismatch!\n");
+    return (FALSE);
   }
   return (TRUE);
@@ -157,5 +160,5 @@
       exit (2);
   }
-  return (TRUE);
+  return (status);
 }
 
@@ -195,5 +198,5 @@
   gfits_table_set_Image (&db[0].ftable, NULL, 0);
 
-  gfits_modify (&db[0].header, "NIMAGES", "%lld", 1, 0LL);
+  gfits_modify (&db[0].header, "NIMAGES", "%d", 1, 0);
   gfits_modify (&db[0].header, "ZERO_PT", "%lf", 1, ZeroPoint);
 
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 28304)
@@ -39,5 +39,5 @@
   /* find number of images */
   Nimage = 0;
-  gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (&db[0].header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   if (stat (db[0].filename, &filestatus) == -1) {
     if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n");
@@ -64,5 +64,5 @@
     Ndata = (filestatus.st_size - db[0].header.datasize) / ImageSize;
     if (VERBOSE) fprintf (stderr, "ERROR: image catalog has inconsistent size\n");
-    if (VERBOSE) fprintf (stderr, "header: %lld, data: %lld\n", (long long) Nimage, (long long) Ndata);
+    if (VERBOSE) fprintf (stderr, "header: "OFF_T_FMT", data: "OFF_T_FMT"\n",  Nimage,  Ndata);
     if (!FORCE_READ) exit (1);
     Nimage = Ndata;
@@ -96,5 +96,5 @@
   } 
 
-  gfits_modify (&db[0].theader, "NAXIS2", "%lld", 1, (long long) Nimage);
+  gfits_modify (&db[0].theader, "NAXIS2", OFF_T_FMT, 1,  Nimage);
   db[0].theader.Naxis[1] = Nimage;
   db[0].ftable.datasize = gfits_data_size (&db[0].theader);
@@ -110,5 +110,5 @@
   off_t *row;
 
-  if (VERBOSE) fprintf (stderr, "writing out %lld images\n", (long long) db[0].vtable.Nrow);
+  if (VERBOSE) fprintf (stderr, "writing out "OFF_T_FMT" images\n",  db[0].vtable.Nrow);
 
   /* position to start of file */
@@ -125,6 +125,6 @@
   Nrow = db[0].vtable.Nrow;
   row = db[0].vtable.row;
-  gfits_scan (db[0].vtable.header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (db[0].vtable.header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (db[0].vtable.header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (db[0].vtable.header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
 
   /* file pointer is at beginning of desired table data */
@@ -146,5 +146,5 @@
   int status;
 
-  if (VERBOSE) fprintf (stderr, "writing out %lld images\n", (long long) db[0].theader.Naxis[1]);
+  if (VERBOSE) fprintf (stderr, "writing out "OFF_T_FMT" images\n",  db[0].theader.Naxis[1]);
 
   /* position to start of file */
@@ -158,6 +158,6 @@
   }
 
-  gfits_scan (db[0].ftable.header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (db[0].ftable.header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (db[0].ftable.header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (db[0].ftable.header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   size = Nx * Ny;
   Nbytes = fwrite (db[0].ftable.buffer, sizeof(char), size, db[0].f);
Index: /branches/czw_branch/20100519/Ohana/src/libdvo/src/fits_db.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libdvo/src/fits_db.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libdvo/src/fits_db.c	(revision 28304)
@@ -20,9 +20,9 @@
 /* create an empty db */
 int gfits_db_create (FITS_DB *db) {
-  gfits_init_header (&db[0].header);    
+  if (!gfits_init_header (&db[0].header)) return (FALSE);
   db[0].header.extend = TRUE;
-  gfits_create_header (&db[0].header);
-  gfits_create_matrix (&db[0].header, &db[0].matrix);
-  gfits_print (&db[0].header, "NEXTEND", "%d", 1, 1);
+  if (!gfits_create_header (&db[0].header))  return (FALSE);
+  if (!gfits_create_matrix (&db[0].header, &db[0].matrix)) return (FALSE);
+  if (!gfits_print (&db[0].header, "NEXTEND", "%d", 1, 1)) return (FALSE);
   db[0].ftable.header = &db[0].theader;
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/header/F_create_H.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/header/F_create_H.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/header/F_create_H.c	(revision 28304)
@@ -23,5 +23,5 @@
   for (i = 0; i < header[0].Naxes; i++) {
     snprintf (axis, 10, "NAXIS%d", i + 1);
-    gfits_modify (header,  axis, "%lld", 1, (long long) header[0].Naxis[i]);
+    gfits_modify (header,  axis, OFF_T_FMT, 1,  header[0].Naxis[i]);
   }
 
Index: /branches/czw_branch/20100519/Ohana/src/libfits/header/F_modify.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/header/F_modify.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/header/F_modify.c	(revision 28304)
@@ -51,19 +51,20 @@
 
   /* write the numeric modes */
-  if (!strcmp (mode, "%d"))   snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),       	      comment);
-  if (!strcmp (mode, "%ld"))  snprintf (string, 81, "%-8s= %20ld / %-s ",   field, va_arg (argp, long),      	      comment);
-  if (!strcmp (mode, "%lld")) snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long), 	      comment);
-  if (!strcmp (mode, "%Ld"))  snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long), 	      comment);
-  if (!strcmp (mode, "%u"))   snprintf (string, 81, "%-8s= %20u / %-s ",    field, va_arg (argp, unsigned),  	      comment);
-  if (!strcmp (mode, "%lu"))  snprintf (string, 81, "%-8s= %20lu / %-s ",   field, va_arg (argp, unsigned long),      comment);
-  if (!strcmp (mode, "%llu")) snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment);
-  if (!strcmp (mode, "%Lu"))  snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment);
-  if (!strcmp (mode, "%hd"))  snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),      	      comment); 
-  if (!strcmp (mode, "%f"))   snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),   	      comment); 
-  if (!strcmp (mode, "%lf"))  snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),   	      comment); 
-  if (!strcmp (mode, "%e"))   snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),   	      comment); 
-  if (!strcmp (mode, "%le"))  snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),   	      comment); 
-  if (!strcmp (mode, "%g"))   snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),   	      comment); 
-  if (!strcmp (mode, "%lg"))  snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),   	      comment); 
+  if (!strcmp (mode, "%d"))   { snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),       	      	comment); goto found_it; }
+  if (!strcmp (mode, "%ld"))  { snprintf (string, 81, "%-8s= %20ld / %-s ",   field, va_arg (argp, long),      	      	comment); goto found_it; }
+  if (!strcmp (mode, "%lld")) { snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long), 	      	comment); goto found_it; }
+  if (!strcmp (mode, "%Ld"))  { snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long), 	      	comment); goto found_it; }
+  if (!strcmp (mode, "%u"))   { snprintf (string, 81, "%-8s= %20u / %-s ",    field, va_arg (argp, unsigned),  	      	comment); goto found_it; }
+  if (!strcmp (mode, "%lu"))  { snprintf (string, 81, "%-8s= %20lu / %-s ",   field, va_arg (argp, unsigned long),      comment); goto found_it; }
+  if (!strcmp (mode, "%llu")) { snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
+  if (!strcmp (mode, "%Lu"))  { snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
+  if (!strcmp (mode, "%hd"))  { snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),      	        comment); goto found_it; } 
+  if (!strcmp (mode, "%f"))   { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%lf"))  { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%e"))   { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%le"))  { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%g"))   { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%lg"))  { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),   	        comment); goto found_it; } 
+  if (!strcmp (mode, "%jd"))  { snprintf (string, 81, "%-8s= %20jd / %-s ",   field, va_arg (argp, intmax_t), 	        comment); goto found_it; }
 
   /* string value.  Quotes must be at least 18 chars apart */
@@ -71,6 +72,11 @@
     strncpy (data, va_arg (argp, char *), 68);
     snprintf (string, 81, "%-8s= '%-18s' / %-s ", field, data, comment);
-  }
-
+    goto found_it;
+  }
+
+  /* failed to find mode */
+  return (FALSE);
+
+found_it:
   strncpy (p, string, 80);
   va_end (argp);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/header/F_print.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/header/F_print.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/header/F_print.c	(revision 28304)
@@ -46,19 +46,20 @@
 
   /* write the numeric modes */
-  if (!strcmp (mode, "%d"))  { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); }
-  if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ",   field, va_arg (argp, long),               blank); }
-  if (!strcmp (mode, "%lld")){ snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); }
-  if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); }
-  if (!strcmp (mode, "%u"))  { snprintf (string, 81, "%-8s= %20u / %46s ",    field, va_arg (argp, unsigned),           blank); }
-  if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %46s ",   field, va_arg (argp, unsigned long),      blank); }
-  if (!strcmp (mode, "%llu")){ snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); }
-  if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); }
-  if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); }
-  if (!strcmp (mode, "%f"))  { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); }
-  if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); }
-  if (!strcmp (mode, "%e"))  { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); }
-  if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); }
-  if (!strcmp (mode, "%g"))  { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); }
-  if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); }
+  if (!strcmp (mode, "%d"))  { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
+  if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ",   field, va_arg (argp, long),               blank); goto found_it; }
+  if (!strcmp (mode, "%lld")){ snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
+  if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
+  if (!strcmp (mode, "%u"))  { snprintf (string, 81, "%-8s= %20u / %46s ",    field, va_arg (argp, unsigned),           blank); goto found_it; }
+  if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %46s ",   field, va_arg (argp, unsigned long),      blank); goto found_it; }
+  if (!strcmp (mode, "%llu")){ snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
+  if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
+  if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
+  if (!strcmp (mode, "%f"))  { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%e"))  { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%g"))  { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
+  if (!strcmp (mode, "%jd")) { snprintf (string, 81, "%-8s= %20jd / %46s ",   field, va_arg (argp, intmax_t),           blank); goto found_it; }
 
   /* string value.  Quotes must be at least 18 chars apart.  Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */
@@ -67,8 +68,10 @@
     line[68] = 0;
     snprintf (string, 81, "%-8s= '%-18s' / %46s ", field, line, blank);
+    goto found_it;
   }
+  return (FALSE);
 
+found_it:
   strncpy (p, string, 80);
-  
   va_end (argp);
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/header/F_read_H.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/header/F_read_H.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/header/F_read_H.c	(revision 28304)
@@ -54,7 +54,12 @@
   }
 
+  /* if these are not found in the header, they should be set to FALSE */
+  header[0].simple = FALSE;
+  header[0].extend = FALSE;
+
   header[0].unsign = gfits_get_unsign_mode();
   header[0].bscale = 1;
   header[0].bzero  = 0;
+
   for (i = 0; i < FT_MAX_NAXES; i++)
     header[0].Naxis[i] = 0;
@@ -69,14 +74,14 @@
   gfits_scan (header,  "BZERO",  "%lf",  1, &header[0].bzero);
 				       
-  gfits_scan (header,  "NAXIS1", "%lld", 1, (long long *) &header[0].Naxis[0]);
-  gfits_scan (header,  "NAXIS2", "%lld", 1, (long long *) &header[0].Naxis[1]);
-  gfits_scan (header,  "NAXIS3", "%lld", 1, (long long *) &header[0].Naxis[2]);
-  gfits_scan (header,  "NAXIS4", "%lld", 1, (long long *) &header[0].Naxis[3]);
-  gfits_scan (header,  "NAXIS5", "%lld", 1, (long long *) &header[0].Naxis[4]);
-  gfits_scan (header,  "NAXIS6", "%lld", 1, (long long *) &header[0].Naxis[5]);
-  gfits_scan (header,  "NAXIS7", "%lld", 1, (long long *) &header[0].Naxis[6]);
-  gfits_scan (header,  "NAXIS8", "%lld", 1, (long long *) &header[0].Naxis[7]);
-  gfits_scan (header,  "NAXIS9", "%lld", 1, (long long *) &header[0].Naxis[8]);
-  gfits_scan (header, "NAXIS10", "%lld", 1, (long long *) &header[0].Naxis[9]);
+  gfits_scan (header,  "NAXIS1", OFF_T_FMT, 1,  &header[0].Naxis[0]);
+  gfits_scan (header,  "NAXIS2", OFF_T_FMT, 1,  &header[0].Naxis[1]);
+  gfits_scan (header,  "NAXIS3", OFF_T_FMT, 1,  &header[0].Naxis[2]);
+  gfits_scan (header,  "NAXIS4", OFF_T_FMT, 1,  &header[0].Naxis[3]);
+  gfits_scan (header,  "NAXIS5", OFF_T_FMT, 1,  &header[0].Naxis[4]);
+  gfits_scan (header,  "NAXIS6", OFF_T_FMT, 1,  &header[0].Naxis[5]);
+  gfits_scan (header,  "NAXIS7", OFF_T_FMT, 1,  &header[0].Naxis[6]);
+  gfits_scan (header,  "NAXIS8", OFF_T_FMT, 1,  &header[0].Naxis[7]);
+  gfits_scan (header,  "NAXIS9", OFF_T_FMT, 1,  &header[0].Naxis[8]);
+  gfits_scan (header, "NAXIS10", OFF_T_FMT, 1,  &header[0].Naxis[9]);
 
   if (!gfits_scan (header, "PCOUNT",  "%d", 1, &header[0].pcount)) {
Index: /branches/czw_branch/20100519/Ohana/src/libfits/header/F_scan.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/header/F_scan.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/header/F_scan.c	(revision 28304)
@@ -84,4 +84,7 @@
   if (!strcmp (mode, "%hd"))  { *va_arg (argp, short *)     	     = value; return (TRUE); }
 
+  // XXX is this safe for 64bit off_t and 32bit off_t?
+  if (!strcmp (mode, "%jd"))  { *va_arg (argp, intmax_t *) 	     = value; return (TRUE); }
+
   /* no valid mode found */
   return (FALSE);
@@ -219,5 +222,5 @@
   if (!strcmp (mode, "%d"))   { *va_arg (argp, int *)       	     = value; return (TRUE); }
   if (!strcmp (mode, "%ld"))  { *va_arg (argp, long *)      	     = value; return (TRUE); }
-  if (!strcmp (mode, "%lld")) { *va_arg (argp, long long *) 	     = value; return (TRUE); }
+  if (!strcmp (mode, OFF_T_FMT)) { *va_arg (argp, long long *) 	     = value; return (TRUE); }
   if (!strcmp (mode, "%Ld"))  { *va_arg (argp, long long *) 	     = value; return (TRUE); }
   if (!strcmp (mode, "%u"))   { *va_arg (argp, unsigned *)  	     = value; return (TRUE); }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/include/gfitsio.h
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/include/gfitsio.h	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/include/gfitsio.h	(revision 28304)
@@ -7,23 +7,9 @@
 # define GFITSIO
 
-/* also defined in libautocode/def/common.h */
-/* what about lin64 ?? - 'linux' might be defined automatically by linux */
 # ifndef BYTE_SWAP
-# ifdef linux
-# define BYTE_SWAP
+# ifndef NOT_BYTE_SWAP
+# error "neither BYTE_SWAP not NOT_BYTE_SWAP is set"
 # endif
-
-# ifdef sid
-# define BYTE_SWAP
 # endif
-
-# ifdef darwin_x86
-# define BYTE_SWAP
-# endif
-
-# ifdef dec
-# define BYTE_SWAP
-# endif
-# endif /* BYTE_SWAP */
 
 # ifndef NEWLINE
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_add_M.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_add_M.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_add_M.c	(revision 28304)
@@ -13,11 +13,11 @@
   if ((x + array[0].Naxis[0] > matrix[0].Naxis[0]) ||
       (y + array[0].Naxis[1] > matrix[0].Naxis[1])) {
-    fprintf (stderr, "can't add array here: (%lld,%lld) - (%lld,%lld) vs (%lld,%lld)\n",
-	     (long long) x, 
-	     (long long) y, 
-	     (long long) x + array[0].Naxis[0], 
-	     (long long) y + array[0].Naxis[1],
-	     (long long) matrix[0].Naxis[0], 
-	     (long long) matrix[0].Naxis[1]);
+    fprintf (stderr, "can't add array here: ("OFF_T_FMT","OFF_T_FMT") - ("OFF_T_FMT","OFF_T_FMT") vs ("OFF_T_FMT","OFF_T_FMT")\n",
+	      x, 
+	      y, 
+	      x + array[0].Naxis[0], 
+	      y + array[0].Naxis[1],
+	      matrix[0].Naxis[0], 
+	      matrix[0].Naxis[1]);
     return;
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_compress_M.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_compress_M.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_compress_M.c	(revision 28304)
@@ -77,5 +77,5 @@
     snprintf (zaxis, 10, "ZNAXIS%d", i + 1);
     snprintf (naxis, 10, "NAXIS%d", i + 1);
-    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  "%lld", (long long *) &header->Naxis[i], (long long) header->Naxis[i]);
+    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  OFF_T_FMT,  &header->Naxis[i],  header->Naxis[i]);
   }    
 
@@ -203,7 +203,7 @@
   if (!gfits_varlength_column_define (ftable, &zdef, zcol)) ESCAPE;
   gfits_delete (header, "TFIELDS", 1);
-  snprintf (key, 10, "TTYPE%lld", (long long) zcol);
+  snprintf (key, 10, "TTYPE"OFF_T_FMT,  zcol);
   gfits_delete (header, key, 1);
-  snprintf (key, 10, "TFORM%lld", (long long) zcol);
+  snprintf (key, 10, "TFORM"OFF_T_FMT,  zcol);
   gfits_delete (header, key, 1);
 
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_insert_M.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_insert_M.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_insert_M.c	(revision 28304)
@@ -12,11 +12,11 @@
   if ((x + array[0].Naxis[0] > matrix[0].Naxis[0]) ||
       (y + array[0].Naxis[1] > matrix[0].Naxis[1])) {
-    fprintf (stderr, "can't insert array here: (%lld,%lld) - (%lld,%lld) vs (%lld,%lld)\n",
-	     (long long) x, 
-	     (long long) y, 
-	     (long long) x + array[0].Naxis[0], 
-	     (long long) y + array[0].Naxis[1],
-	     (long long) matrix[0].Naxis[0], 
-	     (long long) matrix[0].Naxis[1]);
+    fprintf (stderr, "can't insert array here: ("OFF_T_FMT","OFF_T_FMT") - ("OFF_T_FMT","OFF_T_FMT") vs ("OFF_T_FMT","OFF_T_FMT")\n",
+	      x, 
+	      y, 
+	      x + array[0].Naxis[0], 
+	      y + array[0].Naxis[1],
+	      matrix[0].Naxis[0], 
+	      matrix[0].Naxis[1]);
     return;
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_load_M.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_load_M.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_load_M.c	(revision 28304)
@@ -95,5 +95,5 @@
   }
   if (nbytes != Nbytes) {  /* this is a FITS error, but often the image is OK */
-    fprintf (stderr, "incomplete block in FITS file: (%lld, %lld)\n", (long long) nbytes, (long long) Nbytes);
+    fprintf (stderr, "incomplete block in FITS file: ("OFF_T_FMT", "OFF_T_FMT")\n",  nbytes,  Nbytes);
     return (TRUE); 
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_portion.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_portion.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_portion.c	(revision 28304)
@@ -108,9 +108,9 @@
 
   if (nbytes < Nbytes - 2880) {  /* this is a bad FITS error: image is not OK */
-    fprintf (stderr, "error reading in matrix data from FITS file %s (%lld < %lld - 2880)\n", filename, (long long) nbytes, (long long) Nbytes);
+    fprintf (stderr, "error reading in matrix data from FITS file %s ("OFF_T_FMT" < "OFF_T_FMT" - 2880)\n", filename,  nbytes,  Nbytes);
     return (FALSE);
   }
   if (nbytes != Nbytes) {  /* this is a FITS error, but often the image is OK */
-    fprintf (stderr, "incomplete block in %s: (%lld, %lld)\n", filename, (long long) nbytes, (long long) Nbytes);
+    fprintf (stderr, "incomplete block in %s: ("OFF_T_FMT", "OFF_T_FMT")\n", filename,  nbytes,  Nbytes);
     return (TRUE); 
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_segment.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_segment.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/matrix/F_read_segment.c	(revision 28304)
@@ -148,9 +148,9 @@
 
   if (nbytes < Nbytes - 2880) {  /* this is a bad FITS error: image is not OK */
-    fprintf (stderr, "error reading in matrix data from FITS file (%lld < %lld - 2880)\n", (long long) nbytes, (long long) Nbytes);
+    fprintf (stderr, "error reading in matrix data from FITS file ("OFF_T_FMT" < "OFF_T_FMT" - 2880)\n",  nbytes,  Nbytes);
     return (FALSE);
   }
   if (nbytes != Nbytes) {  /* this is a FITS error, but often the image is OK */
-    fprintf (stderr, "incomplete block in FITS file: (%lld, %lld)\n", (long long) nbytes, (long long) Nbytes);
+    fprintf (stderr, "incomplete block in FITS file: ("OFF_T_FMT", "OFF_T_FMT")\n",  nbytes,  Nbytes);
     return (TRUE); 
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_create_TH.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_create_TH.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_create_TH.c	(revision 28304)
@@ -27,5 +27,5 @@
   for (i = 0; i < header[0].Naxes; i++) {
     sprintf (axis, "NAXIS%d", i + 1);
-    gfits_modify (header,  axis, "%lld", 1, (long long) header[0].Naxis[i]);
+    gfits_modify (header,  axis, OFF_T_FMT, 1,  header[0].Naxis[i]);
   }
   
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_define_column.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_define_column.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_define_column.c	(revision 28304)
@@ -13,5 +13,5 @@
   Nfields = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Naxis1);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Naxis1);
   Nfields ++;
   Naxis1 += Nbytes*Nval;
@@ -35,5 +35,5 @@
   /* update TFIELDS & NAXIS1 */
   gfits_modify (header, "TFIELDS", "%d", 1, Nfields);
-  gfits_modify (header, "NAXIS1",  "%lld", 1, (long long) Naxis1);
+  gfits_modify (header, "NAXIS1",  OFF_T_FMT, 1,  Naxis1);
   header[0].Naxis[0] = Naxis1;
 
@@ -53,5 +53,5 @@
   Nfields = 0;
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Naxis1);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Naxis1);
   Nstart = Naxis1 + 1;
   Nfields ++;
@@ -70,5 +70,5 @@
 
   gfits_modify (header, "TFIELDS", "%d", 1, Nfields);
-  gfits_modify (header, "NAXIS1",  "%lld", 1, (long long) Naxis1);
+  gfits_modify (header, "NAXIS1",  OFF_T_FMT, 1,  Naxis1);
   header[0].Naxis[0] = Naxis1;
 
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_get_column.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_get_column.c	(revision 28304)
@@ -51,6 +51,6 @@
   
   /* check existing table dimensions */
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
 
   /* scan columns to find insert point */
@@ -187,6 +187,6 @@
   
   /* check existing table dimensions */
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
 
   /* scan columns to find insert point */
@@ -336,6 +336,6 @@
   
   /* check existing table dimensions */
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
 
   /* scan columns to find insert point */
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_T.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_T.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_T.c	(revision 28304)
@@ -64,5 +64,5 @@
     perror (string);
     if (Nread < gfits_data_min_size (table[0].header)) {
-      fprintf (stderr, "error: fits read error in %s, read %lld, need %lld\n", __func__, (long long) Nread, (long long) gfits_data_min_size (table[0].header));
+      fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__,  Nread,  gfits_data_min_size (table[0].header));
       gfits_free_table  (table);
       return (FALSE);
@@ -109,5 +109,5 @@
   /* modify structure and header to match actual read rows Ny */
   table[0].header[0].Naxis[1] = Nrows;
-  gfits_modify (table[0].header, "NAXIS2",  "%lld", 1, (long long) Nrows);
+  gfits_modify (table[0].header, "NAXIS2",  OFF_T_FMT, 1,  Nrows);
   table[0].datasize = gfits_data_size (table[0].header);
 
@@ -185,6 +185,8 @@
     /* file pointer is at beginning of desired table data */
     start = ftello (f);
-    gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-    gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+
+    gfits_scan (header, "NAXIS1", OFF_T_FMT, 1, &Nx);
+    gfits_scan (header, "NAXIS2", OFF_T_FMT, 1, &Ny);
+
     for (i = 0; i < Nrow; i++) {
       if (row[i] > Ny) { return (FALSE); }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_TH.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_TH.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_read_TH.c	(revision 28304)
@@ -70,14 +70,14 @@
   if (!status) return (FALSE);
 				                           
-  gfits_scan (Theader,  "NAXIS1", "%lld", 1, (long long *) &Theader[0].Naxis[0]);
-  gfits_scan (Theader,  "NAXIS2", "%lld", 1, (long long *) &Theader[0].Naxis[1]);
-  gfits_scan (Theader,  "NAXIS3", "%lld", 1, (long long *) &Theader[0].Naxis[2]);
-  gfits_scan (Theader,  "NAXIS4", "%lld", 1, (long long *) &Theader[0].Naxis[3]);
-  gfits_scan (Theader,  "NAXIS5", "%lld", 1, (long long *) &Theader[0].Naxis[4]);
-  gfits_scan (Theader,  "NAXIS6", "%lld", 1, (long long *) &Theader[0].Naxis[5]);
-  gfits_scan (Theader,  "NAXIS7", "%lld", 1, (long long *) &Theader[0].Naxis[6]);
-  gfits_scan (Theader,  "NAXIS8", "%lld", 1, (long long *) &Theader[0].Naxis[7]);
-  gfits_scan (Theader,  "NAXIS9", "%lld", 1, (long long *) &Theader[0].Naxis[8]);
-  gfits_scan (Theader, "NAXIS10", "%lld", 1, (long long *) &Theader[0].Naxis[9]);
+  gfits_scan (Theader,  "NAXIS1", OFF_T_FMT, 1,  &Theader[0].Naxis[0]);
+  gfits_scan (Theader,  "NAXIS2", OFF_T_FMT, 1,  &Theader[0].Naxis[1]);
+  gfits_scan (Theader,  "NAXIS3", OFF_T_FMT, 1,  &Theader[0].Naxis[2]);
+  gfits_scan (Theader,  "NAXIS4", OFF_T_FMT, 1,  &Theader[0].Naxis[3]);
+  gfits_scan (Theader,  "NAXIS5", OFF_T_FMT, 1,  &Theader[0].Naxis[4]);
+  gfits_scan (Theader,  "NAXIS6", OFF_T_FMT, 1,  &Theader[0].Naxis[5]);
+  gfits_scan (Theader,  "NAXIS7", OFF_T_FMT, 1,  &Theader[0].Naxis[6]);
+  gfits_scan (Theader,  "NAXIS8", OFF_T_FMT, 1,  &Theader[0].Naxis[7]);
+  gfits_scan (Theader,  "NAXIS9", OFF_T_FMT, 1,  &Theader[0].Naxis[8]);
+  gfits_scan (Theader, "NAXIS10", OFF_T_FMT, 1,  &Theader[0].Naxis[9]);
 
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_set_column.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_set_column.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_set_column.c	(revision 28304)
@@ -49,10 +49,10 @@
   
   /* check existing table dimensions */
-  gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   if (Ny == 0) { 
     Ny = Nrow;
     header[0].Naxis[1] = Ny;
-    gfits_modify (header, "NAXIS2", "%lld", 1, (long long) Ny);
+    gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
 
     nbytes = gfits_data_size (header);
@@ -181,10 +181,10 @@
   
   /* check existing table dimensions */
-  gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   if (Ny == 0) { 
     Ny = Nrow;
     header[0].Naxis[1] = Ny;
-    gfits_modify (header, "NAXIS2", "%lld", 1, (long long) Ny);
+    gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
 
     nbytes = gfits_data_size (header);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_format.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_format.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_format.c	(revision 28304)
@@ -130,6 +130,6 @@
   off_t i, Nx, Ny;
 
-  gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (ftable[0].header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (ftable[0].header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   
   if (start + Nkeep > Ny) return (FALSE);
@@ -158,6 +158,6 @@
   off_t i, N, Nx, Ny;
 
-  gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (ftable[0].header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (ftable[0].header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
 
   /* make empty vtable from table */
@@ -191,5 +191,5 @@
   va_start (argp, table);
 
-  gfits_scan (table[0].header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
+  gfits_scan (table[0].header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
   gfits_scan (table[0].header, "TFIELDS", "%d", 1, &Nfields);
 
@@ -236,6 +236,6 @@
   off = 0;
 
-  gfits_scan (ftable[0].header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (ftable[0].header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (ftable[0].header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (ftable[0].header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
   gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields);
 
@@ -320,6 +320,6 @@
   off = 0;
 
-  gfits_scan (ftable[0].header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (ftable[0].header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (ftable[0].header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (ftable[0].header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
   gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields);
 
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_row.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_row.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_row.c	(revision 28304)
@@ -11,6 +11,6 @@
   header = table[0].header;
 
-  gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   
   if (header[0].Naxis[1] != Ny) return (FALSE);
@@ -23,5 +23,5 @@
   Ny += Nrow;
   header[0].Naxis[1] = Ny;
-  gfits_modify (header, "NAXIS2",  "%lld", 1, (long long) Ny);
+  gfits_modify (header, "NAXIS2",  OFF_T_FMT, 1,  Ny);
 
   nbytes = gfits_data_size (header);
@@ -43,6 +43,6 @@
   header = table[0].header;
 
-  gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   
   if (header[0].Naxis[1] != Ny) return (FALSE);
@@ -64,5 +64,5 @@
   Ny += Nrow;
   header[0].Naxis[1] = Ny;
-  gfits_modify (header, "NAXIS2", "%lld", 1, (long long) Ny);
+  gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
 
   table[0].datasize = gfits_data_size (table[0].header);
@@ -81,6 +81,6 @@
   header = table[0].header;
 
-  gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
   
   if (header[0].Naxis[1] != Ny) return (FALSE);
@@ -97,5 +97,5 @@
   Ny -= Nrow;
   header[0].Naxis[1] = Ny;
-  gfits_modify (header, "NAXIS2", "%lld", 1, (long long) Ny);
+  gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
 
   nbytes = gfits_data_size (header);
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_varlength.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_varlength.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_table_varlength.c	(revision 28304)
@@ -64,5 +64,5 @@
 
   // heap_start must be long long so file may be very large
-  if (!gfits_scan (ftable->header, "THEAP", "%lld", 1, (long long *) &def->heap_start)) {
+  if (!gfits_scan (ftable->header, "THEAP", OFF_T_FMT, 1,  &def->heap_start)) {
     def->heap_start = ftable->header->Naxis[0]*ftable->header->Naxis[1];
   }
Index: /branches/czw_branch/20100519/Ohana/src/libfits/table/F_write_T.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libfits/table/F_write_T.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libfits/table/F_write_T.c	(revision 28304)
@@ -40,6 +40,6 @@
   Nrow = table[0].Nrow;
   row = table[0].row;
-  gfits_scan (table[0].header, "NAXIS1", "%lld", 1, (long long *) &Nx);
-  gfits_scan (table[0].header, "NAXIS2", "%lld", 1, (long long *) &Ny);
+  gfits_scan (table[0].header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
+  gfits_scan (table[0].header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
 
   /* file pointer is at beginning of desired table data */
@@ -79,5 +79,5 @@
   
   /* modify vtable to represent full disk table */
-  gfits_modify (ftable[0].header, "NAXIS2", "%lld", 1, (long long) Ntotal);
+  gfits_modify (ftable[0].header, "NAXIS2", OFF_T_FMT, 1,  Ntotal);
   ftable[0].header[0].Naxis[1] = Ntotal;
 
Index: /branches/czw_branch/20100519/Ohana/src/libohana/Makefile
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libohana/Makefile	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libohana/Makefile	(revision 28304)
@@ -1,5 +1,5 @@
 default: install
 help:
-	@echo "make options: install libohana clean dist"
+	@echo "make options: install libohana clean dist test typetest"
 
 include ../../Makefile.System
@@ -19,5 +19,5 @@
 TFLAGS        = $(FULL_CFLAGS) $(FULL_CPPFLAGS) $(FULL_LDFLAGS) -lohana -ltap_ohana
 
-install: $(DESTLIB)/libohana.a $(DESTLIB)/libohana.$(DLLTYPE)
+install: $(DESTLIB)/libohana.a $(DESTLIB)/libohana.$(DLLTYPE) typetest
 libohana: $(LIB)/libohana.$(ARCH).a $(LIB)/libohana.$(ARCH).$(DLLTYPE)
 
@@ -40,4 +40,12 @@
 $(SRC)/CommOps.$(ARCH).o	 \
 $(SRC)/version.$(ARCH).o
+
+TYPETEST = \
+$(TESTDIR)/typetest.$(ARCH)
+
+$(TYPETEST) : $(LIB)/libohana.$(ARCH).a
+
+typetest: $(TYPETEST)
+	for i in $(TYPETEST); do $$i || exit 1; done
 
 TEST = \
Index: /branches/czw_branch/20100519/Ohana/src/libohana/include/ohana.h
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libohana/include/ohana.h	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/libohana/include/ohana.h	(revision 28304)
@@ -94,4 +94,31 @@
 };
 
+/* note: in the Ohana tree, the byte order is determined by the ARCH variable
+   if you have a small endian machine that is not listed here, the test
+   program 'typestest' should fail */
+# ifndef BYTE_SWAP
+# ifdef linux
+# define BYTE_SWAP
+# endif
+
+# ifdef lin64
+# define BYTE_SWAP
+# endif
+
+# ifdef sid
+# define BYTE_SWAP
+# endif
+
+# if defined(darwin_x86) || defined(_DARWIN_C_SOURCE)
+# define BYTE_SWAP
+# endif
+
+# ifdef dec
+# define BYTE_SWAP
+# endif
+# else
+# define NOT_BYTE_SWAP
+# endif /* BYTE_SWAP */
+
 # ifndef NAN
 # ifndef BYTE_SWAP
@@ -103,4 +130,22 @@
     __attribute_used__ = { __nan_bytes };
 # define NAN    (__nan_union.__d)
+# endif
+
+/* if your build crashes on OFF_T_MODE, you probably need to add your 64bit hardware to this list */
+# ifdef _LARGEFILE_SOURCE
+# define OFF_T_FMT "%jd"
+# endif
+# ifdef lin64
+# define OFF_T_FMT "%jd"
+# endif
+# ifdef _DARWIN_C_SOURCE
+# define OFF_T_FMT "%jd"
+#endif
+# ifndef OFF_T_FMT
+# define OFF_T_FMT "%ld"
+# endif
+
+# ifndef isfinite
+# define isfinite(A) (!isnan(A))
 # endif
 
Index: /branches/czw_branch/20100519/Ohana/src/libohana/test/typetest.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/libohana/test/typetest.c	(revision 28304)
+++ /branches/czw_branch/20100519/Ohana/src/libohana/test/typetest.c	(revision 28304)
@@ -0,0 +1,73 @@
+# include "ohana.h"
+
+enum
+{
+    OHANA_LITTLE_ENDIAN = 0x03020100ul,
+    OHANA_BIG_ENDIAN    = 0x00010203ul,
+};
+
+static const union { 
+    unsigned char bytes[4]; 
+    int value; 
+} ohana_host_order = { { 0, 1, 2, 3 } };
+
+# define OHANA_HOST_ORDER (ohana_host_order.value)
+
+// we need to verify some type-related issues:
+int main (int argc, char **argv) {
+
+    int status;
+
+    status = 0;
+
+    // 1) have we defined BYTE_SWAP correctly?
+
+# ifdef BYTE_SWAP
+    if (OHANA_HOST_ORDER == OHANA_BIG_ENDIAN) {
+	fprintf (stderr, "ERROR: BYTE_SWAP is defined on a big endian machine\n");
+	fprintf (stderr, "(see libohana/include/ohana.h)\n");
+	status = 1;
+    } else {
+	fprintf (stderr, "BYTE_SWAP is small endian\n");
+    }	
+# else
+    if (OHANA_HOST_ORDER == OHANA_BIG_ENDIAN) {
+	fprintf (stderr, "NOT_BYTE_SWAP is big endian\n");
+    } else {
+	fprintf (stderr, "ERROR: BYTE_SWAP not defined on a small endian machine\n");
+	fprintf (stderr, "(see libohana/include/ohana.h)\n");
+	status = 1;
+    }	
+# endif 
+
+    // 2) have we defined NAN correctly?
+    {
+	float fvalue;
+	double dvalue;
+    
+	fvalue = NAN;
+	dvalue = NAN;
+
+	if (isfinite(fvalue)) {
+	    fprintf (stderr, "ERROR: NAN definition fails for float\n");
+	    fprintf (stderr, "fvalue: %e\n", fvalue);
+	    status = 1;
+	}
+	if (isfinite(dvalue)) {
+	    fprintf (stderr, "ERROR: NAN definition fails for double\n");
+	    fprintf (stderr, "dvalue: %e\n", dvalue);
+	    status = 1;
+	}
+
+	fprintf (stderr, "fvalue: %e (isfinite: %d)\n", fvalue, isfinite(fvalue));
+	fprintf (stderr, "dvalue: %e (isfinite: %d)\n", dvalue, isfinite(dvalue));
+
+# ifdef __STDC_VERSION__
+	fprintf (stderr, "STDC_VERSION: %ld\n", __STDC_VERSION__);
+# else
+	fprintf (stderr, "STDC_VERSION is not set\n");
+# endif
+
+    }
+    exit (status);
+}
Index: /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/extract.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/extract.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/extract.c	(revision 28304)
@@ -70,6 +70,6 @@
     if ((out[0].header.Naxis[1] != Ny) || (out[0].header.Naxis[0] != Nx)) {
       gprint (GP_ERR, "matrix sizes mis-matched\n");
-      gprint (GP_ERR, "%d x %d  vs  %lld x %lld\n", Nx, Ny, 
-	      (long long) out[0].header.Naxis[0], (long long) out[0].header.Naxis[1]);
+      gprint (GP_ERR, "%d x %d  vs  "OFF_T_FMT" x "OFF_T_FMT"\n", Nx, Ny, 
+	       out[0].header.Naxis[0],  out[0].header.Naxis[1]);
       return (FALSE);
     }
Index: /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/matrix.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/matrix.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/matrix.c	(revision 28304)
@@ -23,7 +23,7 @@
 
     if (bufB[0].matrix.Naxis[0] != bufC[0].matrix.Naxis[1]) {
-      gprint (GP_ERR, "size mis-match in matrices: (%lld x %lld) * (%lld x %lld)\n", 
-	      (long long) bufB[0].matrix.Naxis[0], (long long) bufB[0].matrix.Naxis[1], 
-	      (long long) bufC[0].matrix.Naxis[0], (long long) bufC[0].matrix.Naxis[1]);
+      gprint (GP_ERR, "size mis-match in matrices: ("OFF_T_FMT" x "OFF_T_FMT") * ("OFF_T_FMT" x "OFF_T_FMT")\n", 
+	       bufB[0].matrix.Naxis[0],  bufB[0].matrix.Naxis[1], 
+	       bufC[0].matrix.Naxis[0],  bufC[0].matrix.Naxis[1]);
       return (FALSE);
     }
Index: /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rd.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rd.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rd.c	(revision 28304)
@@ -222,6 +222,6 @@
   buf[0].unsign = buf[0].header.unsign;
 
-  gprint (GP_LOG, "read %lld bytes from %s into buffer %s\n", 
-	  (long long) buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
+  gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", 
+	   buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
 
   blank = 0xffff;
Index: /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rdseg.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rdseg.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rdseg.c	(revision 28304)
@@ -62,5 +62,5 @@
   buf[0].bzero  = buf[0].header.bzero;     /* store the original values */
   buf[0].unsign = buf[0].header.unsign;
-  gprint (GP_LOG, "read %lld bytes from %s into buffer %s\n", (long long) buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
+  gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n",  buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
 
   gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rebin.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rebin.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/cmd.data/rebin.c	(revision 28304)
@@ -63,5 +63,5 @@
     }      
   }
-  if (VERBOSE) gprint (GP_LOG, "rebin %s to %s (%lld,%lld to %d,%d)\n", argv[1], argv[2], (long long) in[0].header.Naxis[0], (long long) in[0].header.Naxis[1], nx, ny);
+  if (VERBOSE) gprint (GP_LOG, "rebin %s to %s ("OFF_T_FMT","OFF_T_FMT" to %d,%d)\n", argv[1], argv[2],  in[0].header.Naxis[0],  in[0].header.Naxis[1], nx, ny);
 
   Nx = in[0].header.Naxis[0];
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avextract.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avextract.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avextract.c	(revision 28304)
@@ -103,5 +103,5 @@
     catalog.Nsecfilt = 0;
 
-    if (VERBOSE) gprint (GP_ERR, "trying %s (%lld of %lld)\n", catalog.filename, (long long) i, (long long) skylist[0].Nregions);
+    if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename,  i,  skylist[0].Nregions);
       
     // an error exit status here is a significant error
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avmatch.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avmatch.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/avmatch.c	(revision 28304)
@@ -102,5 +102,5 @@
     catalog.Nsecfilt = 0;
 
-    if (VERBOSE) gprint (GP_ERR, "trying %s (%lld of %lld)\n", catalog.filename, (long long) i, (long long) skylist[0].Nregions);
+    if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename,  i,  skylist[0].Nregions);
       
     // an error exit status here is a significant error
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmatch.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmatch.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmatch.c	(revision 28304)
@@ -37,5 +37,5 @@
   }
   dvo_catalog_unlock (&catalog1);
-  gprint (GP_ERR, "read %lld stars from phot catalog file %s\n", (long long) catalog1.Naverage, filename);
+  gprint (GP_ERR, "read "OFF_T_FMT" stars from phot catalog file %s\n",  catalog1.Naverage, filename);
 
   /* this is for loading from a text file, presumably hstgsc or usno
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmpread.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmpread.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/cmpread.c	(revision 28304)
@@ -65,5 +65,5 @@
 
   /* find expected number of stars */
-  if (!gfits_scan (&header, "NSTARS", "%lld", 1, (long long *) &Nstars)) {
+  if (!gfits_scan (&header, "NSTARS", OFF_T_FMT, 1,  &Nstars)) {
     gprint (GP_ERR, "ERROR: can't get NSTARS from header\n");
     gfits_free_header (&header);
@@ -77,5 +77,5 @@
     /* allocate space for stars */
     gprint (GP_ERR, "reading from TEXT cmp file %s\n", argv[2]);
-    if (!gfits_scan (&header, "NSTARS", "%lld", 1, (long long *) &Nstars)) {
+    if (!gfits_scan (&header, "NSTARS", OFF_T_FMT, 1,  &Nstars)) {
       gprint (GP_ERR, "ERROR: failed to find NSTARS\n");
       exit (1);
@@ -139,5 +139,5 @@
   free (stars);
   gfits_free_header (&header);
-  gprint (GP_ERR, "loaded %lld objects\n", (long long) Nstars);
+  gprint (GP_ERR, "loaded "OFF_T_FMT" objects\n",  Nstars);
   return (TRUE);
 }
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/dbExtractMeasures.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/dbExtractMeasures.c	(revision 28304)
@@ -303,4 +303,7 @@
     case MEAS_AZ: /* OK */
       value.Flt = measure[0].az;
+      break;
+    case MEAS_ALT: /* OK */
+      value.Flt = 90.0 - DEG_RAD*acos(1.0/measure[0].airmass);
       break;
     case MEAS_EXPTIME: /* OK */
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/detrend.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/detrend.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/detrend.c	(revision 28304)
@@ -137,5 +137,5 @@
 
   /* load existing data from database */
-  gfits_scan (&header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (&header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   ALLOCATE (pimage, RegImage, Nimage);
   status = fread (pimage, sizeof(RegImage), Nimage, f);
@@ -143,5 +143,5 @@
 
   if (status != Nimage) {
-    gprint (GP_ERR, "ERROR: header and data in dB don't match (%lld vs %lld)\n", (long long) Nimage, (long long) status);
+    gprint (GP_ERR, "ERROR: header and data in dB don't match ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nimage,  status);
     gfits_free_header (&header);
     free (pimage);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitcolors.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitcolors.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitcolors.c	(revision 28304)
@@ -174,5 +174,5 @@
     // the selection criteria
   }
-  gprint (GP_ERR, "using %lld possible regions\n", (long long) skylist[0].Nregions);
+  gprint (GP_ERR, "using "OFF_T_FMT" possible regions\n",  skylist[0].Nregions);
 
   /* vectors to save data */
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitsed.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitsed.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/fitsed.c	(revision 28304)
@@ -185,5 +185,5 @@
   /* loop over regions, extract data for each region */
   // XXX add interrupt checks
-  gprint (GP_ERR, "using %lld possible regions\n", (long long) skylist[0].Nregions);
+  gprint (GP_ERR, "using "OFF_T_FMT" possible regions\n",  skylist[0].Nregions);
   for (k = 0; k < skylist[0].Nregions; k++) {
     /* lock, load, unlock catalog */
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/gstar.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/gstar.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/gstar.c	(revision 28304)
@@ -159,5 +159,5 @@
       k = N1[i];
       if (!QUIET) {
-	gprint (GP_LOG, "star: %lld\n", (long long) k);
+	gprint (GP_LOG, "star: "OFF_T_FMT"\n",  i);
 	gprint (GP_LOG, "%11.7f ", catalog.average[k].R);
 	gprint (GP_LOG, "%11.7f ", catalog.average[k].D);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imrough.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imrough.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imrough.c	(revision 28304)
@@ -267,5 +267,5 @@
     
     /* load existing data from database */
-    gfits_scan (&header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+    gfits_scan (&header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
     ALLOCATE (image, RegImage, Nimage);
     status = fread (image, sizeof(RegImage), Nimage, f);
@@ -273,5 +273,5 @@
     
     if (status != Nimage) {
-      gprint (GP_ERR, "ERROR: header and data in dB don't match (%lld vs %d)\n", (long long) Nimage, status);
+      gprint (GP_ERR, "ERROR: header and data in dB don't match ("OFF_T_FMT" vs %d)\n",  Nimage, status);
       gfits_free_header (&header);
       free (image);
@@ -304,5 +304,5 @@
   /* convert to internal format */
   image = (RegImage *) table.buffer;
-  gfits_scan (table.header, "NAXIS2", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (table.header, "NAXIS2", OFF_T_FMT, 1,  &Nimage);
   gfits_convert_RegImage (image, sizeof (RegImage), Nimage);
 
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imsearch.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imsearch.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/imsearch.c	(revision 28304)
@@ -106,10 +106,10 @@
 
   /* load existing data from database */
-  gfits_scan (&header, "NIMAGES", "%lld", 1, (long long *) &Nimage);
+  gfits_scan (&header, "NIMAGES", OFF_T_FMT, 1,  &Nimage);
   ALLOCATE (pimage, RegImage, Nimage);
   status = fread (pimage, sizeof(RegImage), Nimage, f);
   fclose (f);
   if (status != Nimage) {
-    gprint (GP_ERR, "ERROR: header and data in dB don't match (%lld vs %lld)\n", (long long) Nimage, (long long) status);
+    gprint (GP_ERR, "ERROR: header and data in dB don't match ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nimage,  status);
     gfits_free_header (&header);
     free (pimage);
@@ -131,5 +131,5 @@
     obstime[strlen(obstime)-1] = 0;
 
-    gprint (GP_LOG, "%5lld %6s %6s %2d %2d   ", (long long) i, get_type_name(pimage[i].type), get_mode_name(pimage[i].mode), pimage[i].ccd, pimage[i].type);
+    gprint (GP_LOG, OFF_T_FMT" %6s %6s %2d %2d   ",  i, get_type_name(pimage[i].type), get_mode_name(pimage[i].mode), pimage[i].ccd, pimage[i].type);
     gprint (GP_LOG, "%s %s  ", pimage[i].pathname, pimage[i].filename);
     gprint (GP_LOG, "%s %s %f %s\n", pimage[i].filter, pimage[i].instrument, pimage[i].exptime, obstime);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mextract.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mextract.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mextract.c	(revision 28304)
@@ -120,5 +120,5 @@
     catalog.Nsecfilt = Nsecfilt;
 
-    if (VERBOSE) gprint (GP_ERR, "trying %s (%lld of %lld)\n", catalog.filename, (long long) i, (long long) skylist[0].Nregions);
+    if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename,  i,  skylist[0].Nregions);
       
     // an error exit status here is a significant error
Index: /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mmextract.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mmextract.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/dvo/mmextract.c	(revision 28304)
@@ -186,5 +186,5 @@
     catalog.Nsecfilt = Nsecfilt;
 
-    if (VERBOSE) gprint (GP_ERR, "trying %s (%lld of %lld)\n", catalog.filename, (long long) i, (long long) skylist[0].Nregions);
+    if (VERBOSE) gprint (GP_ERR, "trying %s ("OFF_T_FMT" of "OFF_T_FMT")\n", catalog.filename,  i,  skylist[0].Nregions);
       
     // an error exit status here is a significant error
Index: /branches/czw_branch/20100519/Ohana/src/opihi/include/pcontrol.h
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/include/pcontrol.h	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/include/pcontrol.h	(revision 28304)
@@ -120,6 +120,6 @@
   JobStat      state;
   JobStat      stack;
-  JobOutput    stdout;
-  JobOutput    stderr;
+  JobOutput    stdout_buf;
+  JobOutput    stderr_buf;
   Ptime        start;
   Ptime        stop;
@@ -273,4 +273,7 @@
 int    StopHostResponse (Host *host);
 int    HarvestHost (int pid);
+int    AddZombie(int pid);
+int    DelZombies();
+int    CheckZombies();
 
 /*** JobOps.c ***/
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckBusyJob.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckBusyJob.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckBusyJob.c	(revision 28304)
@@ -94,11 +94,11 @@
   sscanf (p, "%*s %d", &job[0].exit_status);
   p = memstr (buffer[0].buffer, "STDOUT", buffer[0].Nbuffer);
-  sscanf (p, "%*s %d", &job[0].stdout.size);
+  sscanf (p, "%*s %d", &job[0].stdout_buf.size);
   p = memstr (buffer[0].buffer, "STDERR", buffer[0].Nbuffer);
-  sscanf (p, "%*s %d", &job[0].stderr.size);
+  sscanf (p, "%*s %d", &job[0].stderr_buf.size);
 
   // XXX runaway job if output too large?
-  if (job[0].stdout.size > 0x1000000) abort();
-  if (job[0].stderr.size > 0x1000000) abort();
+  if (job[0].stdout_buf.size > 0x1000000) abort();
+  if (job[0].stderr_buf.size > 0x1000000) abort();
 
   // job has exited : move to DONE stack 
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckDoneJob.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckDoneJob.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckDoneJob.c	(revision 28304)
@@ -19,10 +19,10 @@
 
   // we can always call this for stdout (if it is done, this is a NOP)
-  status1 = GetJobOutput ("stdout", host, &job[0].stdout);
+  status1 = GetJobOutput ("stdout", host, &job[0].stdout_buf);
 
   // we cannot try stderr until stdout is completed
   status2 = PCLIENT_HUNG;
-  if (job[0].stdout.completed) {
-      status2 = GetJobOutput ("stderr", host, &job[0].stderr);
+  if (job[0].stdout_buf.completed) {
+      status2 = GetJobOutput ("stderr", host, &job[0].stderr_buf);
   }
 
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckIdleHost.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckIdleHost.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckIdleHost.c	(revision 28304)
@@ -8,5 +8,4 @@
 static float MAX_WANTHOST_WAIT = 10.0;
 static float MAX_CONNECT_TIME = 36000.0;
-static FILE *logfile = NULL;
 
   /* if this host has been connected for too long, disconnect (will automatically reconnect) */
@@ -35,8 +34,4 @@
   struct timeval now;
   float dtime;
-
-  if (logfile == NULL) { 
-    logfile = fopen ("pcontrol.log", "w");
-  }
 
   ASSERT (host, "host not set");
@@ -69,5 +64,5 @@
     host[0].job = (struct Job *) job;
 
-    // if (logfile) fprintf (logfile, "start needhost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
+    // gprint (GP_ERR, "start needhost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
     AddMachineJob (host, job);
 
@@ -90,5 +85,5 @@
     host[0].job = (struct Job *) job;
 
-    // if (logfile) fprintf (logfile, "start wanthost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
+    // gprint (GP_ERR, "start wanthost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
     AddMachineJob (host, job);
 
@@ -111,5 +106,5 @@
     host[0].job = (struct Job *) job;
 
-    // if (logfile) fprintf (logfile, "start  anyhost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
+    // gprint (GP_ERR, "start  anyhost %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
     AddMachineJob (host, job);
 
@@ -133,5 +128,5 @@
     if (!CheckMachineJobs (host, job)) continue;
 
-    if (logfile) fprintf (logfile, "start wanthost(2) %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
+    gprint (GP_ERR, "start wanthost(2) %s (job host %s) : %s\n", host[0].hostname, job[0].hostname, job[0].argv[0]);
     AddMachineJob (host, job);
 
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckSystem.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckSystem.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/CheckSystem.c	(revision 28304)
@@ -107,4 +107,6 @@
       TestCheckPoint ();
       Nhostchecks += CheckDownHosts(0.100); /* launch the host */
+      TestCheckPoint ();
+      CheckZombies(); /* launch the host */
       TestCheckPoint ();
     }
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/JobOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/JobOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/JobOps.c	(revision 28304)
@@ -216,6 +216,6 @@
   job[0].Reset    = FALSE;
 
-  InitJobOutput (&job[0].stdout);
-  InitJobOutput (&job[0].stderr);
+  InitJobOutput (&job[0].stdout_buf);
+  InitJobOutput (&job[0].stderr_buf);
 
   job[0].mode     = mode;
@@ -257,6 +257,6 @@
   FREE (job[0].argv);
 
-  FreeIOBuffer (&job[0].stdout.buffer);
-  FreeIOBuffer (&job[0].stderr.buffer);
+  FreeIOBuffer (&job[0].stdout_buf.buffer);
+  FreeIOBuffer (&job[0].stderr_buf.buffer);
 
   FREE (job);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartHost.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartHost.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartHost.c	(revision 28304)
@@ -14,7 +14,6 @@
   if (VarConfig ("SHELL", "%s", shell)     == NULL) strcpy (shell, "pclient");
 
-#ifndef __APPLE__
-  if (VerboseMode()) gprint (GP_ERR, "starting host within thread %lld\n", (long long) pthread_self());
-#endif
+  if (VerboseMode()) gprint (GP_ERR, "starting host within thread\n");
+
   pid = rconnect (command, host[0].hostname, shell, stdio);
   if (!pid) {     
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartJob.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartJob.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StartJob.c	(revision 28304)
@@ -13,6 +13,6 @@
   ASSERT (job  == (Job *) host[0].job, "invalid job");
 
-  ResetJobOutput (&job[0].stdout);
-  ResetJobOutput (&job[0].stderr);
+  ResetJobOutput (&job[0].stdout_buf);
+  ResetJobOutput (&job[0].stderr_buf);
 
   /* construct command line : job arg0 arg1 ... argN\n */
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StopHosts.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StopHosts.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/StopHosts.c	(revision 28304)
@@ -1,3 +1,10 @@
 # include "pcontrol.h"
+
+// we attempt to harvest the 'down' hosts in HarvestHost.  However, sometimes the
+// child is busy and does not exit in the timeout period.  we need to keep a list and
+// try again occasionally to free up the needed resources
+static int NUNHARVESTED = 0;
+static int Nunharvested = 0;
+static int *unharvested = NULL;
 
 void DownHost (Host *host) {
@@ -121,7 +128,5 @@
   int i, result, waitstatus;
 
-#ifndef __APPLE__
-  if (VerboseMode()) gprint (GP_ERR, "harvesting within thread %lld\n", (long long) pthread_self());
-#endif
+  if (VerboseMode()) gprint (GP_ERR, "harvesting within thread\n");
   if (VerboseMode()) gprint (GP_ERR, "child process %d is down, wait for exit status\n", pid);
   
@@ -140,5 +145,5 @@
       switch (errno) {
 	case ECHILD:
-	  gprint (GP_ERR, "unknown PID, not a child proc\n");
+	  gprint (GP_ERR, "HarvestHost: unknown PID (%d), not a child proc\n", pid);
 	  gprint (GP_ERR, "did process already exit?  programming error?\n");
 	  break;
@@ -152,5 +157,6 @@
       
     case 0:
-      gprint (GP_ERR, "HarvestHost: child with connection to remote host failed to exit: may be hung");
+      gprint (GP_ERR, "HarvestHost: child with connection to remote host failed to exit: may be hung\n");
+      AddZombie(pid);
       break;
 
@@ -174,2 +180,99 @@
   return (TRUE);
 }
+
+int AddZombie(int pid) {
+
+  if (unharvested == NULL) {
+    NUNHARVESTED = 128;
+    ALLOCATE (unharvested, int, NUNHARVESTED);
+    memset (unharvested, 0, NUNHARVESTED*sizeof(int));
+  }
+  unharvested[Nunharvested] = pid;
+
+  Nunharvested ++;
+  if (Nunharvested >= NUNHARVESTED) {
+    NUNHARVESTED += 128;
+    REALLOCATE (unharvested, int, NUNHARVESTED);
+    memset (&unharvested[Nunharvested], 0, (NUNHARVESTED - Nunharvested)*sizeof(int));
+  }
+  return TRUE;
+}
+
+int DelZombies() {
+
+  int i, j;
+
+  if (!unharvested) return FALSE;
+  if (!Nunharvested) return FALSE;
+  if (!NUNHARVESTED) return FALSE;
+
+  int *newlist = NULL;
+
+  ALLOCATE (newlist, int, NUNHARVESTED);
+  memset (newlist, 0, NUNHARVESTED*sizeof(int));
+
+  j = 0;
+  for (i = 0; i < NUNHARVESTED; i++) {
+    if (!unharvested[i]) continue;
+    newlist[j] = unharvested[i];
+    j++;
+  }
+  free (unharvested);
+  unharvested = newlist;
+  Nunharvested = j;
+  return TRUE;
+}
+
+int CheckZombies() {
+
+  int pid, i, result, waitstatus;
+
+  if (!unharvested) return FALSE;
+  if (!Nunharvested) return FALSE;
+  if (!NUNHARVESTED) return FALSE;
+
+  for (i = 0; i < Nunharvested; i++) {
+    if (!unharvested[i]) continue;
+    pid = unharvested[i];
+    result = waitpid (pid, &waitstatus, WNOHANG);
+    switch (result) {
+      case -1:  /* error with waitpid */
+	switch (errno) {
+	  case ECHILD:
+	    gprint (GP_ERR, "CheckZombies: unknown PID (%d), not a child proc\n", pid);
+	    gprint (GP_ERR, "did process already exit?  programming error?\n");
+	    break;
+	  case EINTR:
+	  case EINVAL:
+	  default:
+	    perror ("unexpected error");
+	    ABORT ("CheckZombies impossible condition");
+	}
+	break;
+      
+      case 0:
+	if (VerboseMode()) gprint (GP_ERR, "CheckZombies: still waiting on %d\n", pid);
+	break;
+
+      default:
+	if (result != pid) {
+	  gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d).  programming error\n", result, pid);
+	  ABORT ("CheckZombies impossible condition");
+	}
+	
+	if (WIFEXITED(waitstatus)) {
+	  if (VerboseMode()) gprint (GP_ERR, "child exited with status %d\n", WEXITSTATUS(waitstatus));
+	}
+	if (WIFSIGNALED(waitstatus)) {
+	  if (VerboseMode()) gprint (GP_ERR, "child crashed with status %d\n", WTERMSIG(waitstatus));
+	}
+	if (WIFSTOPPED(waitstatus)) {
+	  ABORT ("waitpid returns 'stopped': programming error\n");
+	}
+	unharvested[i] = 0;
+	break;
+    }
+  }
+  DelZombies();
+  return (TRUE);
+}
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/check.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/check.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/check.c	(revision 28304)
@@ -38,6 +38,6 @@
     gprint (GP_LOG, "STATUS %s\n", GetJobStackName(job[0].stack));
     gprint (GP_LOG, "EXITST %d\n", job[0].exit_status);
-    gprint (GP_LOG, "STDOUT %d\n", job[0].stdout.size);
-    gprint (GP_LOG, "STDERR %d\n", job[0].stderr.size);
+    gprint (GP_LOG, "STDOUT %d\n", job[0].stdout_buf.size);
+    gprint (GP_LOG, "STDERR %d\n", job[0].stderr_buf.size);
     gprint (GP_LOG, "DTIME %lf\n", job[0].dtime);
     if (job[0].realhost) {
@@ -50,6 +50,6 @@
 	set_str_variable ("JOB_STATUS", GetJobStackName(job[0].stack));
 	set_int_variable ("JOB_EXITST", job[0].exit_status);
-	set_int_variable ("JOB_STDOUT_SIZE", job[0].stdout.size);
-	set_int_variable ("JOB_STDERR_SIZE", job[0].stderr.size);
+	set_int_variable ("JOB_STDOUT_SIZE", job[0].stdout_buf.size);
+	set_int_variable ("JOB_STDERR_SIZE", job[0].stderr_buf.size);
 	set_variable ("JOB_DTIME", job[0].dtime);
 	set_str_variable ("JOB_HOSTNAME", job[0].hostname);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/pcontrol.c.in
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/pcontrol.c.in	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/pcontrol.c.in	(revision 28304)
@@ -1,3 +1,5 @@
 # include "pcontrol.h"
+
+# define STDERR_FILE "pcontrol.log"
 
 # define opihi_name "PCONTROL"
@@ -24,4 +26,12 @@
   signal (SIGTSTP, gotsignal);
   signal (SIGTTIN, gotsignal);
+
+  // stdin / stdout are used for communication with pantasks.
+  // redirect stderr so various error messages are saved
+  stderr = freopen (STDERR_FILE, "a", stderr);
+  if (!stderr) {
+      fprintf (stdout, "failed to open %s for error output\n", STDERR_FILE);
+      exit (1);
+  }
 
   rl_readline_name = opihi_name;
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/stdout.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/stdout.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/stdout.c	(revision 28304)
@@ -43,5 +43,5 @@
 
 found_stdout:
-  buffer = &job[0].stdout.buffer;
+  buffer = &job[0].stdout_buf.buffer;
   if (varName == NULL) {
     fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stdout);
@@ -97,5 +97,5 @@
 
 found_stderr:
-  buffer = &job[0].stderr.buffer;
+  buffer = &job[0].stderr_buf.buffer;
   if (varName == NULL) {
     fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stdout);
Index: /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/test/machines.sh
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/test/machines.sh	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/opihi/pcontrol/test/machines.sh	(revision 28304)
@@ -6,5 +6,4 @@
   host add pikake
   host add pikake
-
   host add ipp022
   host add ipp022
@@ -26,2 +25,26 @@
 end
 
+macro load.hosts.zombie
+  parameters connect = 2.0
+
+  host add pikake
+  host add pikake
+  host add ipp022
+  host add ipp022
+  host add ipp022
+  host add ipp022
+
+  machines
+end
+
+macro load.jobs.zombie
+  job sleep 10
+  job sleep 10
+  job sleep 10
+  job sleep 10
+  job sleep 10
+  job sleep 10
+  job sleep 10
+  job sleep 10
+end
+
Index: /branches/czw_branch/20100519/Ohana/src/relastro/Makefile
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/Makefile	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/Makefile	(revision 28304)
@@ -56,6 +56,8 @@
 $(SRC)/save_catalogs.$(ARCH).o       \
 $(SRC)/write_coords.$(ARCH).o        \
-$(SRC)/CoordOps.$(ARCH).o        \
-$(SRC)/FixProblemImages.$(ARCH).o        \
+$(SRC)/CoordOps.$(ARCH).o            \
+$(SRC)/FixProblemImages.$(ARCH).o    \
+$(SRC)/high_speed_catalogs.$(ARCH).o  \
+$(SRC)/high_speed_objects.$(ARCH).o  \
 $(SRC)/relastroVisual.$(ARCH).o
 
Index: /branches/czw_branch/20100519/Ohana/src/relastro/doc/high-speed.txt
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/doc/high-speed.txt	(revision 28304)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/doc/high-speed.txt	(revision 28304)
@@ -0,0 +1,7 @@
+
+Niall Deacon's 2MASS / PS1 high-speed search uses the following set of criteria (roughly):
+
+2 sets of detections:
+
+A : 2MASS only, J significant, H & K anything, set of phot_flags?
+B : PS1 only, 2 y-band, 2 z-band, S/N > 5, not a galaxy 
Index: /branches/czw_branch/20100519/Ohana/src/relastro/include/relastro.h
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/include/relastro.h	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/include/relastro.h	(revision 28304)
@@ -14,5 +14,5 @@
 typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode;
 
-typedef enum {TARGET_NONE, TARGET_OBJECTS, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS} FitTarget;
+typedef enum {TARGET_NONE, TARGET_OBJECTS, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS, TARGET_HIGH_SPEED} FitTarget;
 
 typedef struct {
@@ -89,4 +89,6 @@
 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored
 double MIN_ERROR;
+
+double RADIUS; // match radius for high-speed objects
 
 int    VERBOSE;
@@ -112,4 +114,8 @@
 int           NphotcodesKeep,      NphotcodesSkip;
 PhotCode     **photcodesKeep,     **photcodesSkip;
+
+char          *PHOTCODE_A_LIST,  *PHOTCODE_B_LIST;
+int           NphotcodesGroupA,  NphotcodesGroupB;
+PhotCode     **photcodesGroupA, **photcodesGroupB;
 
 int AreaSelect;
@@ -321,2 +327,6 @@
 int saveCoords (Coords *coords, off_t N);
 void resetImageRaw (Catalog *catalog, int Ncatalog, off_t im);
+
+int high_speed_catalogs ();
+int high_speed_objects (SkyRegion *region, Catalog *catalog);
+int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset);
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/ImageOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/ImageOps.c	(revision 28304)
@@ -165,5 +165,5 @@
   for (i = 0; VERBOSE2 && (i < Nimage); i++) {
     name = GetPhotcodeNamebyCode (image[i].photcode);
-    fprintf (stderr, "image %lld has %lld measures (%s, %s)\n", (long long) i, (long long) Nlist[i],
+    fprintf (stderr, "image "OFF_T_FMT" has "OFF_T_FMT" measures (%s, %s)\n",  i,  Nlist[i],
              ohana_sec_to_date(image[i].tzero), name);
   }
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateChips.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateChips.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateChips.c	(revision 28304)
@@ -30,7 +30,7 @@
 
     // FitChip does iterative, clipped fitting
-    // fprintf (stderr, "image %lld : Nstars: %lld\n", (long long) i, (long long) Nraw);
+    // fprintf (stderr, "image "OFF_T_FMT" : Nstars: "OFF_T_FMT"\n",  i,  Nraw);
     if (!FitChip (raw, ref, Nraw, &image[i].coords)) {
-      fprintf (stderr, "reject fit for image %s (%lld) : Nstars: %lld\n", image[i].name, (long long) i, (long long) Nraw);
+      fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
       oldCoords = getCoords (i);
       memcpy (&image[i].coords, oldCoords, sizeof(Coords));
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateObjects.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/UpdateObjects.c	(revision 28304)
@@ -80,5 +80,5 @@
   for (i = 0; i < Ncatalog; i++) {
 
-    if (VERBOSE) fprintf (stderr, "astrometrize catalog %d : %lld ave, %lld meas\n", i, (long long) catalog[i].Naverage, (long long) catalog[i].Nmeasure);
+    if (VERBOSE) fprintf (stderr, "astrometrize catalog %d : "OFF_T_FMT" ave, "OFF_T_FMT" meas\n", i,  catalog[i].Naverage,  catalog[i].Nmeasure);
 
     Nave = Npar = Npm = Nskip = 0;
@@ -189,5 +189,5 @@
 	  T[k] -= Tmean;
 	  if (XVERB) {
-	    fprintf (stderr, "%lld %f %f %f  %f %f +/- %f %f\n", (long long) k, T[k], R[k], D[k], X[k], Y[k], dX[k], dY[k]);
+	    fprintf (stderr, OFF_T_FMT" %f %f %f  %f %f +/- %f %f\n",  k, T[k], R[k], D[k], X[k], Y[k], dX[k], dY[k]);
 	  }
 	}	  
@@ -316,8 +316,8 @@
     NparSum += Npar;
     NskipSum += Nskip;
-    if (VERBOSE) fprintf (stderr, "catalog %lld : %lld ave, %lld pm, %lld par : Nskip %lld\n", (long long) i, (long long) Nave, (long long) Npm, (long long) Npar, (long long) Nskip);
+    if (VERBOSE) fprintf (stderr, "catalog %d : "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT"\n",  i,  Nave,  Npm,  Npar,  Nskip);
   }
 
-  fprintf (stderr, "fitted %lld objects (%lld ave, %lld pm, %lld par), skipped %lld\n", (long long) (NaveSum + NpmSum + NparSum), (long long) NaveSum, (long long) NpmSum, (long long) NparSum, (long long) NskipSum);
+  fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT"\n",  (NaveSum + NpmSum + NparSum),  NaveSum,  NpmSum,  NparSum,  NskipSum);
   return (TRUE);
 }
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/args.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/args.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/args.c	(revision 28304)
@@ -28,4 +28,17 @@
     }
   }
+  if ((N = get_argument (argc, argv, "-high-speed"))) {
+    // XXX include a parallax / no-parallax option
+    if (N >= argc - 3) usage();
+    FIT_TARGET = TARGET_HIGH_SPEED;
+    remove_argument (N, &argc, argv);
+    PHOTCODE_A_LIST = strcreate(argv[N]);
+    remove_argument (N, &argc, argv);
+    PHOTCODE_B_LIST = strcreate(argv[N]);
+    remove_argument (N, &argc, argv);
+    RADIUS = atof(argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   if ((N = get_argument (argc, argv, "-update-simple"))) {
     remove_argument (N, &argc, argv);
@@ -271,6 +284,6 @@
 void usage () {
   fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n");
-  fprintf (stderr, "       OR:    relastro -catalog (ra) (dec)\n");
-  fprintf (stderr, "  working options: \n");
+  fprintf (stderr, "       OR:    relastro -catalog (ra) (dec)\n\n");
+  fprintf (stderr, "  specify one of the following modes: \n");
   fprintf (stderr, "  -update-objects\n");
   fprintf (stderr, "    -pm\n");
@@ -280,4 +293,6 @@
   fprintf (stderr, "  -update-chips\n");
   fprintf (stderr, "  -update-mosaics\n");
+  fprintf (stderr, "  -high-speed (code[,code,code]) (code[,code,code]) (radius)\n\n");
+  fprintf (stderr, "  additional options: \n");
   fprintf (stderr, "  -time (start)(stop)\n");
   fprintf (stderr, "  +photcode (code)[,code,code...]\n");
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/bcatalog.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/bcatalog.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/bcatalog.c	(revision 28304)
@@ -104,5 +104,5 @@
 
   if (VERBOSE) {
-    fprintf (stderr, "%lld: using %lld stars (%lld measures) for catalog\n", (long long) i, (long long) subcatalog[0].Naverage, (long long) subcatalog[0].Nmeasure);
+    fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures) for catalog\n",  i,  subcatalog[0].Naverage,  subcatalog[0].Nmeasure);
    }
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_catalogs.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 28304)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 28304)
@@ -0,0 +1,55 @@
+# include "relastro.h"
+
+int high_speed_catalogs () {
+
+  int i;
+
+  SkyTable *sky = NULL;
+  SkyList *skylist = NULL;
+  Catalog catalog;
+
+  // load the current sky table (layout of all SkyRegions) 
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  
+  // determine the populated SkyRegions overlapping the requested area (default depth)
+  if (UserCatalog) {
+    skylist = SkyRegionByPoint (sky, -1, UserCatalogRA, UserCatalogDEC);
+  } else {
+    skylist = SkyListByPatch (sky, -1, &UserPatch);
+  }
+
+  // load data from each region file, only use bright stars
+  for (i = 0; i < skylist[0].Nregions; i++) {
+
+    // set up the basic catalog info
+    catalog.filename  = skylist[0].filename[i];
+    catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
+    catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
+    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
+
+    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
+      fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
+      exit (1);
+    }
+    if (!catalog.Naves_disk) {
+      if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
+      dvo_catalog_unlock (&catalog);
+      dvo_catalog_free (&catalog);
+      continue;
+    }
+
+    high_speed_objects (skylist[0].regions[i], &catalog);
+
+    if (!UPDATE) {
+      dvo_catalog_unlock (&catalog);
+      dvo_catalog_free (&catalog);
+      continue;
+    }
+    
+    save_catalogs (&catalog, 1);
+  }
+  
+  return (TRUE);
+}
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_objects.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_objects.c	(revision 28304)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/high_speed_objects.c	(revision 28304)
@@ -0,0 +1,338 @@
+# include "relastro.h"
+
+# define NEXT_I { i++; continue; }
+# define NEXT_J { j++; continue; }
+
+// XXX these were used to spot-check specific objects
+# define REF_RA1 192.455781 
+# define REF_DEC1 2.563102 
+# define REF_RA2 192.444302113 
+# define REF_DEC2 2.5786559112 
+int high_speed_objects (SkyRegion *region, Catalog *catalog) {
+
+  // XXX seems silly to require region here just to find the catalog bounds / center
+
+  off_t i, j, m, J, ni, nj, *N1, Nslow, NgroupA, NgroupB;
+  int *slowMoving, *groupA, *groupB, status, foundA, foundB, Nmatch, valid;
+  double *X1, *Y1;
+  double dX, dY, dR, RADIUS2, yJ;
+  Coords tcoords;
+
+  int zcode, zNsec, ycode, yNsec, jcode, jNsec, hcode, hNsec, kcode, kNsec, USNO_R, USNO_N, Nsecfilt;
+
+  Nsecfilt = GetPhotcodeNsecfilt();
+
+  ycode = GetPhotcodeCodebyName("y");
+  yNsec = GetPhotcodeNsec(ycode);
+  
+  zcode = GetPhotcodeCodebyName("z");
+  zNsec = GetPhotcodeNsec(zcode);
+  
+  jcode = GetPhotcodeCodebyName("J");
+  jNsec = GetPhotcodeNsec(jcode);
+  
+  hcode = GetPhotcodeCodebyName("H");
+  hNsec = GetPhotcodeNsec(hcode);
+  
+  kcode = GetPhotcodeCodebyName("K");
+  kNsec = GetPhotcodeNsec(kcode);
+  
+  USNO_R = GetPhotcodeCodebyName("USNO_RED");
+  USNO_N = GetPhotcodeCodebyName("USNO_N");
+
+  // high-speed between different surveys (easier case):
+  // we have two sets of photcodes (A) and (B) and are looking for objects
+  // with detections in only (A) and separately only (B).
+
+  // we need at least 2 objects if we are going to match anything...
+  if (catalog[0].Naverage < 2) return (TRUE);
+
+  // mask with which to mark objects to be ignored
+  ALLOCATE (slowMoving, int, catalog[0].Naverage);
+  memset (slowMoving, 0, catalog[0].Naverage*sizeof(int));
+
+  // record to which photcode group the object belongs:
+  NgroupA = 0;
+  ALLOCATE (groupA, int, catalog[0].Naverage);
+  memset (groupA, 0, catalog[0].Naverage*sizeof(int));
+
+  NgroupB = 0;
+  ALLOCATE (groupB, int, catalog[0].Naverage);
+  memset (groupB, 0, catalog[0].Naverage*sizeof(int));
+
+  fprintf (stderr, "checking "OFF_T_FMT" objects\n",  catalog[0].Naverage);
+  Nslow = 0;
+
+  fprintf (stdout, "#      RA_A  DEC_A              RA_B  DEC_B      :     pmx     pmy      dR  :    z      dz       y      dy       J      dJ       H      dH       K      dK\n");
+  //................270.2346670  20.2471540  270.2170434  20.2717396 :  -59.11   88.78   106.66 :   0.000  0.000   19.582  0.112   16.041  0.110   15.388  0.098   14.858  0.001
+
+  // mark (exclude) objects with both sets of target photcodes
+  for (i = 0; i < catalog[0].Naverage; i++) {
+
+    // if (i % 100 == 0) fprintf (stderr, ".");
+
+    // radius = hypot((REF_DEC1 - catalog[0].average[i].D), (REF_RA1 - catalog[0].average[i].R));
+    // if (radius < 0.0001) {
+    //   fprintf (stderr, "found it\n");
+    // }
+    // radius = hypot((REF_DEC2 - catalog[0].average[i].D), (REF_RA2 - catalog[0].average[i].R));
+    // if (radius < 0.0001) {
+    //   fprintf (stderr, "found it\n");
+    // }
+
+    // do any of the measures for this object match group A?
+    m = catalog[0].average[i].measureOffset;
+    foundA = FALSE;
+    for (j = 0; !foundA && (j < catalog[0].average[i].Nmeasure); j++, m++) {
+      if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupA, NphotcodesGroupA)) {
+	foundA = TRUE;
+      }
+    }
+
+    // do any of the measures for this object match group B?
+    m = catalog[0].average[i].measureOffset;
+    foundB = FALSE;
+    for (j = 0; !foundB && (j < catalog[0].average[i].Nmeasure); j++, m++) {
+      if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupB, NphotcodesGroupB)) {
+	foundB = TRUE;
+      }
+    }
+
+    if (foundA && foundB) {
+      slowMoving[i] = TRUE;
+      Nslow ++;
+      continue;
+    }
+
+    // additional constraints:
+    // * group A : require 
+
+    // 2MASS detections:
+    if (foundA && !foundB) {
+      // average-based tests:
+      valid = TRUE;
+      valid &= ((catalog[0].average[i].flags & 0x40000) == 0);
+      valid &= ((catalog[0].average[i].flags & 0x80000)  > 0);
+      valid &= (catalog[0].secfilt[i*Nsecfilt + yNsec].M < 1.0);
+      valid &= (catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0);
+      // XXX color restrictions are applied in the pair-wise matching below
+      
+      // measure-based tests:
+      m = catalog[0].average[i].measureOffset;
+      for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) {
+	if (catalog[0].measure[m].photcode == USNO_R) {
+	  valid &= ((catalog[0].measure[m].M > 20.0) || isnan(catalog[0].measure[m].M));
+	}
+	if (catalog[0].measure[m].photcode == USNO_N) {
+	  valid &= ((catalog[0].measure[m].M > 18.0) || isnan(catalog[0].measure[m].M));
+	}
+      }
+
+      // ((objflags & 524288) == 524288) && 
+      // ((objflags & 262144) == 0) && 
+      // (z<1.0) && 
+      // (y<1.0) && 
+      // ((yp[$i]-J)>1.25) && ((yp[$i]-J)<5.0) && 
+      // ((USNO_RED<1.0)||(USNO_RED>20.0)) && 
+      // ((USNO_N>18.0)||(USNO_N<1.0))
+
+      if (valid) {
+	groupA[i] = TRUE;
+	NgroupA ++;
+	continue;
+      } else {
+	// fprintf (stderr, "skip "OFF_T_FMT" (group A)\n",  i);
+      }
+    }
+
+    // PS1 detections:
+    if (foundB && !foundA) {
+
+      // average-based tests:
+      valid = TRUE;
+      valid &= ((catalog[0].average[i].flags & 0x10000) == 0);
+      valid &= ((catalog[0].average[i].flags & 0x20000)  > 0);
+      valid &= (catalog[0].secfilt[i*Nsecfilt + jNsec].M < 1.0);
+      valid &= (catalog[0].secfilt[i*Nsecfilt + yNsec].Nused > 1);
+      valid &= (catalog[0].secfilt[i*Nsecfilt + yNsec].dM < 0.2);
+
+      if ((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0) || (catalog[0].secfilt[i*Nsecfilt + zNsec].Nused == 1)) {
+	valid &= TRUE;
+      } else {
+	valid &= ((catalog[0].secfilt[i*Nsecfilt + zNsec].M - catalog[0].secfilt[i*Nsecfilt + yNsec].M) > 0.2);
+      }
+
+      // measure-based tests:
+      m = catalog[0].average[i].measureOffset;
+      for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) {
+	if (catalog[0].measure[m].photcode == USNO_R) {
+	  valid &= ((catalog[0].measure[m].M > 20.0) || isnan(catalog[0].measure[m].M));
+	}
+	if (catalog[0].measure[m].photcode == USNO_N) {
+	  valid &= ((catalog[0].measure[m].M > 18.5) || isnan(catalog[0].measure[m].M));
+	}
+      }
+
+      // (abs(glat)>15.0) && 
+      // ((objflags & 65536) == 0) && 
+      // ((objflags & 131072) == 131072) &&
+      // (J<1.0) && 
+      // (y:nphot>1) && 
+      // (y:err<0.2) && 
+      // ((USNO_RED>20.0)||(USNO_RED<1.0)) && 
+      // ((USNO_N>18.5)||(USNO_N<1.0)) && 
+      // ((z<1.0)||(z:nphot == 1)||((z:nphot>1)&&((z-y)>0.2)))
+
+      if (valid) {
+	groupB[i] = TRUE;
+	NgroupB ++;
+	continue;
+      } else {
+	// fprintf (stderr, "skip "OFF_T_FMT" (group B)\n",  i);
+      }
+    }
+
+    // this object does not have a detection from either groupA or groupB -- skip as if slow
+    slowMoving[i] = TRUE;
+    Nslow ++;
+  }
+  fprintf (stderr, OFF_T_FMT" of "OFF_T_FMT" are slow or invalid; "OFF_T_FMT" in group A, "OFF_T_FMT" in group B\n",  Nslow,  catalog[0].Naverage,  NgroupA,  NgroupB);
+    
+  // double loop over unmarked objects (sorted in RA / X)
+  // record all pairs within the desired match distance
+
+  // create tmp local positional index
+  ALLOCATE (X1, double, catalog[0].Naverage);
+  ALLOCATE (Y1, double, catalog[0].Naverage);
+  ALLOCATE (N1, off_t,  catalog[0].Naverage);
+
+  // define a local projection
+  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
+  if (region[0].Dmax < 90) {
+    tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax);
+  } else {
+    tcoords.crval2 = 90.0;
+  }
+  tcoords.crpix1 = 0;
+  tcoords.crpix2 = 0;
+  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
+  tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
+  tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
+  tcoords.Npolyterms = 1;
+  strcpy (tcoords.ctype, "RA---ARC");
+
+  /* build spatial index (RA sort) referencing input array sequence */
+  for (i = 0; i < catalog[0].Naverage; i++) {
+    status = RD_to_XY (&X1[i], &Y1[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
+    N1[i] = i;
+    assert (status);
+  }
+  sort_coords_index (X1, Y1, N1, catalog[0].Naverage);
+
+  Nmatch = 0;
+  RADIUS2 = SQ(RADIUS);
+
+  // mark (exclude) objects with both sets of target photcodes
+  for (i = j = 0; (i < catalog[0].Naverage) && (j < catalog[0].Naverage);) {
+
+    ni = N1[i];
+    nj = N1[j];
+
+    // if (ni == 131030) {
+    //   fprintf (stderr, "got 2mass\n");
+    // }
+    // if (nj == 53581) {
+    //   fprintf (stderr, "got ps1\n");
+    // }
+
+    if (slowMoving[ni]) NEXT_I;
+    if (slowMoving[nj]) NEXT_J;
+
+    // i => groupA, j => groupB
+    if (!groupA[ni]) NEXT_I;
+    if (!groupB[nj]) NEXT_J;
+
+    if (!finite(X1[i]) || !finite(Y1[i])) NEXT_I;
+    if (!finite(X1[j]) || !finite(Y1[j])) NEXT_J;
+
+    // look for pairs that are within the maximum separation
+    dX = X1[i] - X1[j];
+
+    if (dX <= -1.02*RADIUS) NEXT_I; // negative dX: i is too small
+    if (dX >= +1.02*RADIUS) NEXT_J; // positive dX: j is too small
+
+    // within match range; look for valid matches
+    for (J = j; (dX > -1.02*RADIUS) && (J < catalog[0].Naverage); J++) {
+      if (J == i) continue;  // avoid auto-matches
+
+      dX = X1[i] - X1[J];
+
+      nj = N1[J];
+      if (!groupB[nj]) continue;
+
+      dY = Y1[i] - Y1[J];
+      dR = dX*dX + dY*dY;
+      if (dR > RADIUS2) continue;
+
+      // y_groupA - J_groupB 
+      yJ = catalog[0].secfilt[nj*Nsecfilt + yNsec].M - catalog[0].secfilt[ni*Nsecfilt + jNsec].M;
+      if (yJ < 1.25) continue;
+      if (yJ > 5.0) continue;
+
+      /*** a match is found (just print it for the moment) ***/
+      Nmatch ++;
+
+      // for the moment, just write the matches to stdout:
+      float pmx = -dX; // proper-motion displacement in ra  direction (B - A) [arcsec]
+      float pmy = -dY; // proper-motion displacement in dec direction (B - A) [arcsec]
+      fprintf (stdout, "%11.7f %11.7f  %11.7f %11.7f : %7.2f %7.2f  %7.2f : %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f\n", 
+	       catalog[0].average[ni].R, catalog[0].average[ni].D,
+	       catalog[0].average[nj].R, catalog[0].average[nj].D,
+	       pmx, pmy, sqrt(dR),
+	       catalog[0].secfilt[nj*Nsecfilt + zNsec].M,
+	       catalog[0].secfilt[nj*Nsecfilt + zNsec].dM,
+	       catalog[0].secfilt[nj*Nsecfilt + yNsec].M, 
+	       catalog[0].secfilt[nj*Nsecfilt + yNsec].dM,
+	       catalog[0].secfilt[ni*Nsecfilt + jNsec].M,
+	       catalog[0].secfilt[ni*Nsecfilt + jNsec].dM,
+	       catalog[0].secfilt[ni*Nsecfilt + hNsec].M,
+	       catalog[0].secfilt[ni*Nsecfilt + hNsec].dM,
+	       catalog[0].secfilt[ni*Nsecfilt + kNsec].M,
+	       catalog[0].secfilt[ni*Nsecfilt + kNsec].dM);
+    }
+    i++;
+  }
+  fprintf (stderr, "found %d matches\n", Nmatch);
+  
+  free (slowMoving);
+  free (groupA);
+  free (groupB);
+  free (X1);
+  free (Y1);
+  free (N1);
+
+  return TRUE;
+}
+
+// return TRUE if any measure->photcodes match the photcodeSet
+int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset) {
+
+  int found, k;
+
+  assert (Nset > 0);
+
+  if (!finite(measure[0].dR) || !finite(measure[0].dD)) return FALSE;
+  if (!finite(measure[0].M)) return FALSE;
+  
+  /* select measurements by photcode, or equiv photcode, if specified */
+  if (Nset > 0) {
+    found = FALSE;
+    for (k = 0; (k < Nset) && !found; k++) {
+      if (photcodeSet[k][0].code == measure[0].photcode) found = TRUE;
+      if (photcodeSet[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;
+    }
+    if (!found) return FALSE;
+  }
+  
+  return TRUE;
+}
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/initialize.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/initialize.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/initialize.c	(revision 28304)
@@ -56,4 +56,46 @@
   }
 
+  NphotcodesGroupA = 0;
+  photcodesGroupA = NULL;
+  if (PHOTCODE_A_LIST != NULL) {
+    NPHOTCODES = 10;
+    ALLOCATE (photcodesGroupA, PhotCode *, NPHOTCODES);
+
+    /* parse the comma-separated list of photcodesGroupA */
+    list = PHOTCODE_A_LIST;
+    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
+      list = NULL; // pass NULL on successive strtok_r calls
+      fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST);
+      fprintf (stderr, "codename: %s\n", codename);
+      if ((photcodesGroupA[NphotcodesGroupA] = GetPhotcodebyName (codename)) == NULL) {
+        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
+        exit (1);
+      }
+      NphotcodesGroupA ++;
+      CHECK_REALLOCATE (photcodesGroupA, PhotCode *, NPHOTCODES, NphotcodesGroupA, 10);
+    }
+  }
+
+  NphotcodesGroupB = 0;
+  photcodesGroupB = NULL;
+  if (PHOTCODE_B_LIST != NULL) {
+    NPHOTCODES = 10;
+    ALLOCATE (photcodesGroupB, PhotCode *, NPHOTCODES);
+
+    /* parse the comma-separated list of photcodesGroupB */
+    list = PHOTCODE_B_LIST;
+    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
+      list = NULL; // pass NULL on successive strtok_r calls
+      fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST);
+      fprintf (stderr, "codename: %s\n", codename);
+      if ((photcodesGroupB[NphotcodesGroupB] = GetPhotcodebyName (codename)) == NULL) {
+        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
+        exit (1);
+      }
+      NphotcodesGroupB ++;
+      CHECK_REALLOCATE (photcodesGroupB, PhotCode *, NPHOTCODES, NphotcodesGroupB, 10);
+    }
+  }
+
   initstats (STATMODE);
 
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/relastro.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/relastro.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/relastro.c	(revision 28304)
@@ -23,4 +23,10 @@
   if (FIT_TARGET == TARGET_OBJECTS) {
     relastro_objects ();
+    exit (0);
+  }
+
+  /* the object analysis is a separate process iterating over catalogs */
+  if (FIT_TARGET == TARGET_HIGH_SPEED) {
+    high_speed_catalogs ();
     exit (0);
   }
Index: /branches/czw_branch/20100519/Ohana/src/relastro/src/select_images.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relastro/src/select_images.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relastro/src/select_images.c	(revision 28304)
@@ -115,5 +115,5 @@
     
     if (!FindMosaicForImage (timage, Ntimage, i)) {
-      fprintf (stderr, "cannot find mosaic for %lld\n", (long long) i);
+      fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n",  i);
       continue;
     }
@@ -190,5 +190,5 @@
   }
       
-  if (VERBOSE) fprintf (stderr, "found %lld images\n", (long long) nimage);
+  if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" images\n",  nimage);
 
   REALLOCATE (image, Image, MAX (nimage, 1));
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/GridOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/GridOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/GridOps.c	(revision 28304)
@@ -703,5 +703,5 @@
   gfits_create_header (&header);
   gfits_create_matrix (&header, &matrix);
-  gfits_modify (&header, "NEXTEND", "%lld", 1, (long long) Nimage + 3);
+  gfits_modify (&header, "NEXTEND", OFF_T_FMT, 1,  Nimage + 3);
   gfits_modify (&header, "FILTER", "%s", 1, photcode[0].name);
   gfits_modify_alt (&header, "COMMENT", "%S", 1, "Mosaic Photometry Grid Analysis");
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/ImageOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/ImageOps.c	(revision 28304)
@@ -200,5 +200,5 @@
     status = findCCD (idx, meas, cat, measure);
     if (!status) {
-      if (VERBOSE2) fprintf (stderr, "failed to determine CCD for %lld, %d\n", (long long) meas, cat);
+      if (VERBOSE2) fprintf (stderr, "failed to determine CCD for "OFF_T_FMT", %d\n",  meas, cat);
       return;
     }
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/MosaicOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/MosaicOps.c	(revision 28304)
@@ -400,5 +400,5 @@
       mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);
       if (mark) {
-	fprintf (stderr, "marked image %s (%lld), (%lld < %d) || (%lld < %f*%lld)\n", image[imlist[i][0]].name, (long long) i, (long long) N, IMAGE_TOOFEW, (long long) N, IMAGE_GOOD_FRACTION, (long long) Nlist[i]);
+	fprintf (stderr, "marked mosaic %s ("OFF_T_FMT"), ("OFF_T_FMT" < %d) || ("OFF_T_FMT" < %f*"OFF_T_FMT")\n", image[imlist[i][0]].name,  i,  N, IMAGE_TOOFEW,  N, IMAGE_GOOD_FRACTION,  Nlist[i]);
 	mosaic[i].flags |= ID_IMAGE_FEW;
 	Nfew ++;
@@ -408,5 +408,5 @@
     }
     liststats (list, dlist, N, &stats);
-    if (PoorImages) fprintf (stderr, "Mmos: %f %f %d %lld\n", stats.mean, stats.sigma, stats.Nmeas, (long long) N);
+    if (PoorImages) fprintf (stderr, "Mmos: %f %f %d "OFF_T_FMT"\n", stats.mean, stats.sigma, stats.Nmeas,  N);
     mosaic[i].Mcal  = stats.mean;
     mosaic[i].dMcal = stats.sigma;
@@ -519,5 +519,5 @@
     n++;
   }
-  fprintf (stderr, "Nmosaic: %lld, n: %lld\n", (long long) Nmosaic, (long long) n);
+  fprintf (stderr, "Nmosaic: "OFF_T_FMT", n: "OFF_T_FMT"\n",  Nmosaic,  n);
 
   liststats (list, dlist, n, &stats);
@@ -599,5 +599,5 @@
   }
 
-  fprintf (stderr, "%lld mosaics marked poor\n", (long long) Nmark);
+  fprintf (stderr, OFF_T_FMT" mosaics marked poor\n",  Nmark);
   initstats (STATMODE);
   free (mlist);
@@ -643,5 +643,5 @@
     }
   
-    sprintf (string, "Mosaic %lld", (long long) i);
+    sprintf (string, "Mosaic "OFF_T_FMT,  i);
     plot_defaults (&graphdata);
     plot_list (&graphdata, xlist, ylist, N, string, NULL);
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/StarOps.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/StarOps.c	(revision 28304)
@@ -391,4 +391,6 @@
 }
 
+# define NSIGMA_CLIP 3.0
+# define NSIGMA_REJECT 5.0
 void clean_measures (Catalog *catalog, int Ncatalog, int final) {
 
@@ -396,7 +398,8 @@
   int i, N, image_bad, TOOFEW;
   off_t *ilist;
-  double *tlist, *list, *dlist, Ns;
+  double *tlist, *list, *dlist;
   float Msys, Mcal, Mmos, Mgrid;
   StatType stats;
+  int Ncal, Nmos, Ngrid, Nfew;
 
   if (VERBOSE) fprintf (stderr, "marking poor measures\n");
@@ -416,6 +419,6 @@
   TOOFEW = MAX (5, STAR_TOOFEW);
 
-  Ns = 3;
   Ndel = Nave = 0;
+  Ncal = Nmos = Ngrid = Nfew = 0;
   for (i = 0; i < Ncatalog; i++) {
     for (j = 0; j < catalog[i].Naverage; j++) {
@@ -433,9 +436,9 @@
 	/* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
 	Mcal  = getMcal  (m, i);
-	if (isnan(Mcal)) continue;
+	if (isnan(Mcal)) { Ncal ++; continue; }
 	Mmos  = getMmos  (m, i);
-	if (isnan(Mmos)) continue;
+	if (isnan(Mmos)) { Nmos ++; continue; }
 	Mgrid = getMgrid (m, i);
-	if (isnan(Mgrid)) continue;
+	if (isnan(Mgrid)) { Ngrid ++; continue; }
 
 	Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
@@ -444,16 +447,21 @@
 	N++;
       }
-      if (N <= TOOFEW) continue;
+      if (N <= TOOFEW) { Nfew ++; continue; }
 
       /* 3-sigma clip based on stats of inner 50% */
+
+      // calculated mean of inner 50%
       initstats ("INNER_MEAN");
       liststats (list, dlist, N, &stats);
       stats.sigma = MAX (MIN_ERROR, stats.sigma); /* if measurements agree too well, sigma -> 0.0 */
+
+      // ignore entries > 3sigma from inner mean
       for (k = m = 0; k < N; k++) {
-	if (fabs (list[k] - stats.median) < Ns*stats.sigma) {
+	if (fabs (list[k] - stats.median) < NSIGMA_CLIP*stats.sigma) {
 	  list[m] = list[k];
 	  m++;
 	}
       }
+      // recalculate the mean & sigma of the accepted measurements
       initstats ("MEAN");
       liststats (list, dlist, m, &stats);
@@ -483,7 +491,7 @@
       if (N < TOOFEW) continue;
 
-      /* mark bad measures */
+      /* mark bad measures (> 3 sigma deviant) */
       for (k = 0; k < N; k++) {
-	if (fabs (list[k] - stats.median) > Ns*stats.sigma) {
+	if (fabs (list[k] - stats.median) > NSIGMA_REJECT*stats.sigma) {
 	  catalog[i].measure[ilist[k]].dbFlags |= ID_MEAS_POOR_PHOTOM;
 	  Ndel ++;
@@ -494,5 +502,5 @@
   }
   initstats (STATMODE);
-  if (VERBOSE) fprintf (stderr, "%lld measures marked poor, %lld total\n", (long long) Ndel, (long long) Nave);
+  if (VERBOSE) fprintf (stderr, OFF_T_FMT" measures marked poor, "OFF_T_FMT" total\n", Ndel, Nave);
   free (ilist);
   free (tlist);
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/bcatalog.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/bcatalog.c	(revision 28304)
@@ -7,4 +7,5 @@
   off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
   float mag;
+  int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew;
 
   // XXX PhotNsec as a global is a bad idea; either get it from catalog
@@ -20,4 +21,6 @@
   ALLOCATE (subcatalog[0].measure, Measure, NMEASURE);
   Nmeasure = Naverage = 0;
+
+  Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = 0;
 
   /* exclude stars not in range or with too few measurements */
@@ -46,10 +49,10 @@
       /* select measurements by photcode */
       ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode);
-      if (ecode != photcode[0].code) continue;
+      if (ecode != photcode[0].code) { Ncode ++; continue; }
 
       /* select measurements by time */
       if (TimeSelect) {
-	if (catalog[0].measure[offset].t < TSTART) continue;
-	if (catalog[0].measure[offset].t > TSTOP) continue;
+	if (catalog[0].measure[offset].t < TSTART) { Ntime ++; continue; }
+	if (catalog[0].measure[offset].t > TSTOP)  { Ntime ++; continue; }
       }
 
@@ -57,18 +60,18 @@
       // XXX ignore this criterion for REF measurements?
       // XXX chnage this to select by bitflags
-      if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) continue;
+      if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; }
 
       /* select measurements by mag limit */
       mag = PhotCat (&catalog[0].measure[offset]);
-      if (mag > MAG_LIM) continue;
+      if (mag > MAG_LIM) { Nmag ++; continue; } 
 
       /* select measurements by measurement error */
-      if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) continue;
+      if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) { Nsigma ++; continue; }
 
       /* select measurements by mag limit */
       if (ImagSelect) {
 	mag = PhotInst (&catalog[0].measure[offset]);
-	if (mag < ImagMin) continue;
-	if (mag > ImagMax) continue;
+	if (mag < ImagMin) { Nimag ++; continue; }
+	if (mag > ImagMax) { Nimag ++; continue; }
       }
 
@@ -94,4 +97,5 @@
     if (Nm <= STAR_TOOFEW) { /* enough measurements in band? */
       Nmeasure -= Nm;
+      Nfew ++;
       continue; 
     }
@@ -114,6 +118,8 @@
 
   if (VERBOSE) {
-    fprintf (stderr, "%lld: using %lld stars (%lld measures) for catalog\n", (long long) i, 
-	     (long long) subcatalog[0].Naverage, (long long) subcatalog[0].Nmeasure);
+    fprintf (stderr, "using "OFF_T_FMT" stars ("OFF_T_FMT" measures) of "OFF_T_FMT" for catalog\n", 
+	      subcatalog[0].Naverage,  subcatalog[0].Nmeasure,  i);
+    fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few\n", 
+	     Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew);
   }
   return (TRUE);
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/load_catalogs.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/load_catalogs.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/load_catalogs.c	(revision 28304)
@@ -47,4 +47,7 @@
 
   fprintf (stderr, "using %d of %d stars (%d of %d measurements)\n", Nstar, Nstar_total, Nmeas, Nmeas_total);
+  if (Nstar < 1) {
+      Shutdown ("ERROR: no stars match the minimum requirements; exiting\n");
+  }
 
   // XXX consider only returning the populated catalogs
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/load_images.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/load_images.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/load_images.c	(revision 28304)
@@ -47,5 +47,5 @@
   vtable = &db[0].vtable;
 
-  gfits_scan (vtable[0].header, "NAXIS1", "%lld", 1, (long long *) &Nx);
+  gfits_scan (vtable[0].header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
   for (i = 0; i < Nimage; i++) {
     memcpy (vtable[0].buffer[i], &image[i], Nx);
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/relphot_objects.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/relphot_objects.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/relphot_objects.c	(revision 28304)
@@ -55,4 +55,5 @@
 	for (k = 0; k < catalog.average[j].Nmeasure; k++) {
 	  catalog.measure[m+k].dbFlags = 0;
+	  catalog.measure[m+k].Mcal = 0;
 	}
       }
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/select_images.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/select_images.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/select_images.c	(revision 28304)
@@ -101,5 +101,5 @@
     
     if (!FindMosaicForImage (timage, Ntimage, i)) {
-      fprintf (stderr, "cannot find mosaic for %lld\n", (long long) i);
+      fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
       continue;
     }
@@ -175,5 +175,5 @@
   }
       
-  if (VERBOSE) fprintf (stderr, "found %lld images\n", (long long) nimage);
+  if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" images\n", nimage);
 
   REALLOCATE (image, Image, MAX (nimage, 1));
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/setExclusions.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/setExclusions.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/setExclusions.c	(revision 28304)
@@ -50,7 +50,7 @@
     }
   }
-  if (VERBOSE) fprintf (stderr, "%lld measurements marked by area\n",    (long long) Narea);
-  if (VERBOSE) fprintf (stderr, "%lld measurements marked nocal\n",      (long long) Nnocal);
-  if (VERBOSE) fprintf (stderr, "%lld measurements kept for analysis\n", (long long) Ngood);
+  if (VERBOSE) fprintf (stderr, OFF_T_FMT" measurements marked by area\n",    Narea);
+  if (VERBOSE) fprintf (stderr, OFF_T_FMT" measurements marked nocal\n",      Nnocal);
+  if (VERBOSE) fprintf (stderr, OFF_T_FMT" measurements kept for analysis\n", Ngood);
   return (TRUE);
 }
Index: /branches/czw_branch/20100519/Ohana/src/relphot/src/setMrelFinal.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/relphot/src/setMrelFinal.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/relphot/src/setMrelFinal.c	(revision 28304)
@@ -138,6 +138,6 @@
     }
   }
-  if (VERBOSE) fprintf (stderr, "pass %d, Ntot: %lld, Ntry: %lld, Nskip: %lld, Nkeep: %lld\n",
-			pass, (long long) Ntot, (long long) Ntry, (long long) Nskip, (long long) Nkeep);
+  if (VERBOSE) fprintf (stderr, "pass %d, Ntot: "OFF_T_FMT", Ntry: "OFF_T_FMT", Nskip: "OFF_T_FMT", Nkeep: "OFF_T_FMT"\n",
+			pass, Ntot, Ntry, Nskip, Nkeep);
 }
 
Index: /branches/czw_branch/20100519/Ohana/src/tools/src/ftable.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/tools/src/ftable.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/tools/src/ftable.c	(revision 28304)
@@ -1,4 +1,5 @@
 # include <ohana.h>
 # include <gfitsio.h>
+# include "inttypes.h"
 
 char *print_table_row (char *row, Header *header);
@@ -95,6 +96,6 @@
   table.datasize = Nbytes;
 
-  gfits_scan (table.header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (table.header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (table.header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (table.header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
 
   /* print a column */
@@ -125,5 +126,5 @@
   char field[16], type[16], format[16], *line;
 
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
 
@@ -209,9 +210,9 @@
     for (i = 0; i < Naxis; i++) {
       sprintf (axisname, "NAXIS%d", i+1);
-      status = gfits_scan (&header, axisname,  "%lld", 1, (long long *) &Nelem);
+      status = gfits_scan (&header, axisname,  OFF_T_FMT, 1,  &Nelem);
       if (!status) {
 	fprintf (stderr, "missing %s\n", axisname);
       }
-      fprintf (stdout, " %7lld", (long long) Nelem);
+      fprintf (stdout, " "OFF_T_FMT,  Nelem);
     }
     fprintf (stdout, "\n");
@@ -294,6 +295,6 @@
 
   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
-  gfits_scan (header, "NAXIS1",  "%lld", 1, (long long *) &Nx);
-  gfits_scan (header, "NAXIS2",  "%lld", 1, (long long *) &Ny);
+  gfits_scan (header, "NAXIS1",  OFF_T_FMT, 1,  &Nx);
+  gfits_scan (header, "NAXIS2",  OFF_T_FMT, 1,  &Ny);
 
   if (Colname != (char *) NULL) {
@@ -358,5 +359,5 @@
 	  if (!strcmp (type, "int64_t")) {
 	    memcpy (line, &data[i*Nv*Nb + Nb*j], Nb);
-	    fprintf (stdout, "%lld ", (long long) *(int64_t*)line);
+	    fprintf (stdout, "%" PRId64" ",  *(int64_t*)line);
 	  }
 	  if (!strcmp (type, "float")) {
Index: /branches/czw_branch/20100519/Ohana/src/uniphot/src/load_images.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/uniphot/src/load_images.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/uniphot/src/load_images.c	(revision 28304)
@@ -23,5 +23,5 @@
   image = gfits_table_get_Image (&db[0].ftable, Nimage, &db[0].swapped);
 
-  fprintf (stderr, "loaded %lld images\n", (long long) *Nimage);
+  fprintf (stderr, "loaded "OFF_T_FMT" images\n", *Nimage);
 
   return (image);
Index: /branches/czw_branch/20100519/Ohana/src/uniphot/src/update_catalog_setphot.c
===================================================================
--- /branches/czw_branch/20100519/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 28303)
+++ /branches/czw_branch/20100519/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 28304)
@@ -93,5 +93,5 @@
 
   if (found) {
-    fprintf (stderr, "found %lld matches\n", (long long) found);
+    fprintf (stderr, "found "OFF_T_FMT" matches\n", found);
   }
 }
Index: /branches/czw_branch/20100519/PS-IPP-Config/lib/PS/IPP/Config.pm
===================================================================
--- /branches/czw_branch/20100519/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 28303)
+++ /branches/czw_branch/20100519/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 28304)
@@ -1011,9 +1011,18 @@
     $filename =~ s/\{OUTPUT\}/$output/;
     if ($filename =~ /\{CHIP\.NAME\}/) {
-        my ($chip, $cell) = ($component, $component); # Chip and cell names
+        my $chip = $component; # Chip name (only one component is allowed, will be used for all elements)
         $chip = "fpa" unless defined $chip;
+        $filename =~ s/\{CHIP\.NAME\}/$chip/;
+    }
+    if ($filename =~ /\{CELL\.NAME\}/) {
+        my $cell = $component; # Cell name 
         $cell = "chip" unless defined $cell;
-        $filename =~ s/\{CHIP\.NAME\}/$chip/;
         $filename =~ s/\{CELL\.NAME\}/$cell/;
+    }
+    if ($filename =~ /\{FILE\.ID\}/) {
+        my $fileID = $component; # FILE.ID
+        $fileID = 0 unless defined $fileID;
+	my $fileN = sprintf ("%03d", $fileID);
+        $filename =~ s/\{FILE\.ID\}/$fileN/;
     }
 
Index: /branches/czw_branch/20100519/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- /branches/czw_branch/20100519/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 28303)
+++ /branches/czw_branch/20100519/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 28304)
@@ -475,5 +475,5 @@
     my $inverse = $option_mask & $PSTAMP_SELECT_INVERSE;
 
-    my $command = "$difftool -dbname $imagedb";
+    my $command = "$difftool -dbname $imagedb -pstamp_order";
     
     my $listrun = 0;
@@ -482,6 +482,9 @@
             $command .= " -diffskyfile -diff_id $id -skycell_id $skycell_id";
         } else {
+            $listrun = 1;
             $command .= " -listrun -diff_id $id";
-            $listrun = 1;
+            # the following is a work around for the problem reported in ticket #1394
+            # 'difftool -listrun returns multiple rows for stack-stack diffs'
+            $command .= " -limit 1";
         }
     } else {
@@ -492,5 +495,5 @@
 
     my $n = $output ? scalar @$output : 0;
-    if (!$listrun && ($n > 1)) {
+    if ($n > 1) {
         die ("difftool returned an unexpected number of diffskyfiles: $n");
     } elsif ($n == 0) {
@@ -1045,4 +1048,6 @@
     $last_project = $proj_hash->[0];
 
+    $ipprc->define_camera($last_project->{camera});
+
     return $last_project;
 }
@@ -1105,6 +1110,4 @@
     close $pointsList;
 
-    # XXX: need to loop over these
-    # my $run = $runList->[0];
     if (($req_type eq "byid") or ($req_type eq "byexp")) {
         my ($last_tess_id, $tess_dir_abs, $astrom_file) = ("", "", "");
@@ -1114,5 +1117,15 @@
                 # XXX: use file rule and handle cameras where the astrometry is solved at
                 # the chip stage.
-                $astrom_file = $run->{cam_path_base} . ".smf";
+                my $cam_path_base = $run->{cam_path_base};
+                if ($cam_path_base) {
+                    $astrom_file = $run->{cam_path_base} . ".smf";
+                } else {
+                    if (! find_astrometry($ipprc, $imagedb, $run, $verbose) ) {
+                        setErrorCodes($rowList, $PSTAMP_NOT_AVAILABLE);
+                        next;
+                    }
+                    $cam_path_base = $run->{cam_path_base};
+                    $astrom_file = $run->{astrom_file};
+                }
                 my $astrom_file_resolved = $ipprc->file_resolve($astrom_file);
                 if (!$astrom_file_resolved) {
Index: /branches/czw_branch/20100519/archive/noise_model/gauss.dat
===================================================================
--- /branches/czw_branch/20100519/archive/noise_model/gauss.dat	(revision 28304)
+++ /branches/czw_branch/20100519/archive/noise_model/gauss.dat	(revision 28304)
@@ -0,0 +1,10000 @@
+-5 1.4867195147343e-07
+-4.999 1.49417098022831e-07
+-4.998 1.50165829094509e-07
+-4.997 1.5091816114934e-07
+-4.996 1.51674110719848e-07
+-4.995 1.52433694410494e-07
+-4.994 1.53196928897976e-07
+-4.993 1.5396383093152e-07
+-4.992 1.54734417333176e-07
+-4.991 1.55508704998116e-07
+-4.99 1.56286710894932e-07
+-4.989 1.57068452065935e-07
+-4.988 1.57853945627457e-07
+-4.987 1.5864320877015e-07
+-4.986 1.59436258759291e-07
+-4.98499999999999 1.60233112935085e-07
+-4.98399999999999 1.61033788712969e-07
+-4.98299999999999 1.61838303583922e-07
+-4.98199999999999 1.62646675114767e-07
+-4.98099999999999 1.63458920948483e-07
+-4.97999999999999 1.64275058804513e-07
+-4.97899999999999 1.65095106479076e-07
+-4.97799999999999 1.6591908184548e-07
+-4.97699999999999 1.66747002854431e-07
+-4.97599999999999 1.67578887534352e-07
+-4.97499999999999 1.68414753991694e-07
+-4.97399999999999 1.69254620411259e-07
+-4.97299999999999 1.7009850505651e-07
+-4.97199999999999 1.70946426269898e-07
+-4.97099999999999 1.71798402473173e-07
+-4.96999999999999 1.72654452167716e-07
+-4.96899999999999 1.73514593934853e-07
+-4.96799999999999 1.74378846436185e-07
+-4.96699999999999 1.75247228413908e-07
+-4.96599999999999 1.76119758691143e-07
+-4.96499999999999 1.76996456172261e-07
+-4.96399999999999 1.77877339843214e-07
+-4.96299999999999 1.78762428771864e-07
+-4.96199999999999 1.79651742108312e-07
+-4.96099999999999 1.80545299085235e-07
+-4.95999999999999 1.81443119018215e-07
+-4.95899999999999 1.82345221306078e-07
+-4.95799999999999 1.83251625431227e-07
+-4.95699999999999 1.84162350959981e-07
+-4.95599999999999 1.85077417542913e-07
+-4.95499999999998 1.85996844915189e-07
+-4.95399999999998 1.86920652896914e-07
+-4.95299999999998 1.87848861393466e-07
+-4.95199999999998 1.8878149039585e-07
+-4.95099999999998 1.89718559981033e-07
+-4.94999999999998 1.90660090312297e-07
+-4.94899999999998 1.91606101639584e-07
+-4.94799999999998 1.92556614299847e-07
+-4.94699999999998 1.93511648717395e-07
+-4.94599999999998 1.94471225404252e-07
+-4.94499999999998 1.95435364960502e-07
+-4.94399999999998 1.96404088074651e-07
+-4.94299999999998 1.97377415523976e-07
+-4.94199999999998 1.98355368174882e-07
+-4.94099999999998 1.99337966983266e-07
+-4.93999999999998 2.00325232994869e-07
+-4.93899999999998 2.01317187345643e-07
+-4.93799999999998 2.02313851262108e-07
+-4.93699999999998 2.03315246061718e-07
+-4.93599999999998 2.04321393153226e-07
+-4.93499999999998 2.05332314037047e-07
+-4.93399999999998 2.06348030305631e-07
+-4.93299999999998 2.07368563643824e-07
+-4.93199999999998 2.08393935829246e-07
+-4.93099999999998 2.09424168732659e-07
+-4.92999999999998 2.10459284318337e-07
+-4.92899999999998 2.11499304644445e-07
+-4.92799999999998 2.12544251863414e-07
+-4.92699999999998 2.13594148222314e-07
+-4.92599999999998 2.14649016063236e-07
+-4.92499999999997 2.15708877823671e-07
+-4.92399999999997 2.16773756036892e-07
+-4.92299999999997 2.17843673332334e-07
+-4.92199999999997 2.1891865243598e-07
+-4.92099999999997 2.19998716170747e-07
+-4.91999999999997 2.21083887456871e-07
+-4.91899999999997 2.22174189312295e-07
+-4.91799999999997 2.23269644853062e-07
+-4.91699999999997 2.24370277293701e-07
+-4.91599999999997 2.25476109947626e-07
+-4.91499999999997 2.26587166227522e-07
+-4.91399999999997 2.27703469645747e-07
+-4.91299999999997 2.28825043814727e-07
+-4.91199999999997 2.29951912447353e-07
+-4.91099999999997 2.3108409935738e-07
+-4.90999999999997 2.32221628459834e-07
+-4.90899999999997 2.33364523771406e-07
+-4.90799999999997 2.34512809410864e-07
+-4.90699999999997 2.35666509599453e-07
+-4.90599999999997 2.36825648661307e-07
+-4.90499999999997 2.37990251023852e-07
+-4.90399999999997 2.39160341218221e-07
+-4.90299999999997 2.40335943879665e-07
+-4.90199999999997 2.41517083747962e-07
+-4.90099999999997 2.42703785667838e-07
+-4.89999999999997 2.43896074589376e-07
+-4.89899999999997 2.4509397556844e-07
+-4.89799999999997 2.46297513767091e-07
+-4.89699999999997 2.47506714454008e-07
+-4.89599999999997 2.4872160300491e-07
+-4.89499999999996 2.49942204902981e-07
+-4.89399999999996 2.51168545739293e-07
+-4.89299999999996 2.52400651213236e-07
+-4.89199999999996 2.53638547132945e-07
+-4.89099999999996 2.54882259415728e-07
+-4.88999999999996 2.561318140885e-07
+-4.88899999999996 2.57387237288216e-07
+-4.88799999999996 2.58648555262304e-07
+-4.88699999999996 2.59915794369103e-07
+-4.88599999999996 2.61188981078299e-07
+-4.88499999999996 2.62468141971367e-07
+-4.88399999999996 2.6375330374201e-07
+-4.88299999999996 2.65044493196601e-07
+-4.88199999999996 2.66341737254629e-07
+-4.88099999999996 2.67645062949144e-07
+-4.87999999999996 2.68954497427205e-07
+-4.87899999999996 2.70270067950328e-07
+-4.87799999999996 2.71591801894936e-07
+-4.87699999999996 2.72919726752816e-07
+-4.87599999999996 2.74253870131565e-07
+-4.87499999999996 2.75594259755054e-07
+-4.87399999999996 2.76940923463877e-07
+-4.87299999999996 2.78293889215818e-07
+-4.87199999999996 2.79653185086305e-07
+-4.87099999999996 2.81018839268877e-07
+-4.86999999999996 2.82390880075642e-07
+-4.86899999999996 2.8376933593775e-07
+-4.86799999999996 2.85154235405854e-07
+-4.86699999999996 2.86545607150581e-07
+-4.86599999999996 2.87943479963004e-07
+-4.86499999999995 2.89347882755111e-07
+-4.86399999999995 2.90758844560285e-07
+-4.86299999999995 2.9217639453377e-07
+-4.86199999999995 2.93600561953156e-07
+-4.86099999999995 2.95031376218859e-07
+-4.85999999999995 2.96468866854595e-07
+-4.85899999999995 2.97913063507867e-07
+-4.85799999999995 2.99363995950451e-07
+-4.85699999999995 3.00821694078874e-07
+-4.85599999999995 3.02286187914915e-07
+-4.85499999999995 3.03757507606079e-07
+-4.85399999999995 3.05235683426102e-07
+-4.85299999999995 3.06720745775434e-07
+-4.85199999999995 3.08212725181739e-07
+-4.85099999999995 3.09711652300391e-07
+-4.84999999999995 3.1121755791497e-07
+-4.84899999999995 3.12730472937765e-07
+-4.84799999999995 3.14250428410272e-07
+-4.84699999999995 3.15777455503704e-07
+-4.84599999999995 3.1731158551949e-07
+-4.84499999999995 3.18852849889783e-07
+-4.84399999999995 3.20401280177976e-07
+-4.84299999999995 3.21956908079203e-07
+-4.84199999999995 3.23519765420858e-07
+-4.84099999999995 3.25089884163109e-07
+-4.83999999999995 3.26667296399412e-07
+-4.83899999999995 3.28252034357031e-07
+-4.83799999999995 3.29844130397558e-07
+-4.83699999999995 3.31443617017433e-07
+-4.83599999999995 3.33050526848471e-07
+-4.83499999999994 3.34664892658386e-07
+-4.83399999999994 3.36286747351316e-07
+-4.83299999999994 3.37916123968357e-07
+-4.83199999999994 3.3955305568809e-07
+-4.83099999999994 3.41197575827118e-07
+-4.82999999999994 3.42849717840598e-07
+-4.82899999999994 3.44509515322779e-07
+-4.82799999999994 3.46177002007539e-07
+-4.82699999999994 3.47852211768931e-07
+-4.82599999999994 3.49535178621719e-07
+-4.82499999999994 3.51225936721928e-07
+-4.82399999999994 3.52924520367385e-07
+-4.82299999999994 3.54630963998274e-07
+-4.82199999999994 3.56345302197682e-07
+-4.82099999999994 3.58067569692149e-07
+-4.81999999999994 3.5979780135223e-07
+-4.81899999999994 3.61536032193043e-07
+-4.81799999999994 3.63282297374832e-07
+-4.81699999999994 3.65036632203527e-07
+-4.81599999999994 3.66799072131305e-07
+-4.81499999999994 3.68569652757151e-07
+-4.81399999999994 3.70348409827432e-07
+-4.81299999999994 3.72135379236455e-07
+-4.81199999999994 3.73930597027048e-07
+-4.81099999999994 3.75734099391121e-07
+-4.80999999999994 3.7754592267025e-07
+-4.80899999999994 3.79366103356244e-07
+-4.80799999999994 3.81194678091734e-07
+-4.80699999999994 3.83031683670741e-07
+-4.80599999999994 3.84877157039268e-07
+-4.80499999999993 3.86731135295877e-07
+-4.80399999999993 3.88593655692283e-07
+-4.80299999999993 3.90464755633935e-07
+-4.80199999999993 3.9234447268061e-07
+-4.80099999999993 3.94232844547006e-07
+-4.79999999999993 3.96129909103334e-07
+-4.79899999999993 3.98035704375919e-07
+-4.79799999999993 3.99950268547792e-07
+-4.79699999999993 4.01873639959298e-07
+-4.79599999999993 4.03805857108695e-07
+-4.79499999999993 4.05746958652758e-07
+-4.79399999999993 4.07696983407392e-07
+-4.79299999999993 4.09655970348233e-07
+-4.79199999999993 4.11623958611265e-07
+-4.79099999999993 4.13600987493434e-07
+-4.78999999999993 4.1558709645326e-07
+-4.78899999999993 4.17582325111456e-07
+-4.78799999999993 4.19586713251552e-07
+-4.78699999999993 4.21600300820511e-07
+-4.78599999999993 4.23623127929356e-07
+-4.78499999999993 4.256552348538e-07
+-4.78399999999993 4.27696662034866e-07
+-4.78299999999993 4.29747450079529e-07
+-4.78199999999993 4.31807639761339e-07
+-4.78099999999993 4.33877272021062e-07
+-4.77999999999993 4.35956387967317e-07
+-4.77899999999993 4.38045028877213e-07
+-4.77799999999993 4.40143236196995e-07
+-4.77699999999993 4.42251051542681e-07
+-4.77599999999993 4.44368516700719e-07
+-4.77499999999992 4.46495673628624e-07
+-4.77399999999992 4.48632564455639e-07
+-4.77299999999992 4.50779231483382e-07
+-4.77199999999992 4.52935717186502e-07
+-4.77099999999992 4.55102064213339e-07
+-4.76999999999992 4.57278315386581e-07
+-4.76899999999992 4.5946451370393e-07
+-4.76799999999992 4.61660702338763e-07
+-4.76699999999992 4.63866924640798e-07
+-4.76599999999992 4.66083224136769e-07
+-4.76499999999992 4.68309644531091e-07
+-4.76399999999992 4.70546229706536e-07
+-4.76299999999992 4.72793023724911e-07
+-4.76199999999992 4.75050070827734e-07
+-4.76099999999992 4.77317415436913e-07
+-4.75999999999992 4.79595102155435e-07
+-4.75899999999992 4.81883175768045e-07
+-4.75799999999992 4.84181681241938e-07
+-4.75699999999992 4.86490663727448e-07
+-4.75599999999992 4.88810168558739e-07
+-4.75499999999992 4.91140241254501e-07
+-4.75399999999992 4.9348092751865e-07
+-4.75299999999992 4.9583227324102e-07
+-4.75199999999992 4.98194324498075e-07
+-4.75099999999992 5.00567127553607e-07
+-4.74999999999992 5.02950728859444e-07
+-4.74899999999992 5.05345175056161e-07
+-4.74799999999992 5.07750512973787e-07
+-4.74699999999992 5.10166789632529e-07
+-4.74599999999992 5.12594052243477e-07
+-4.74499999999991 5.15032348209332e-07
+-4.74399999999991 5.17481725125122e-07
+-4.74299999999991 5.1994223077893e-07
+-4.74199999999991 5.22413913152616e-07
+-4.74099999999991 5.24896820422551e-07
+-4.73999999999991 5.27391000960348e-07
+-4.73899999999991 5.29896503333588e-07
+-4.73799999999991 5.32413376306569e-07
+-4.73699999999991 5.34941668841035e-07
+-4.73599999999991 5.37481430096922e-07
+-4.73499999999991 5.40032709433102e-07
+-4.73399999999991 5.42595556408129e-07
+-4.73299999999991 5.45170020780984e-07
+-4.73199999999991 5.47756152511837e-07
+-4.73099999999991 5.50354001762791e-07
+-4.72999999999991 5.52963618898642e-07
+-4.72899999999991 5.55585054487642e-07
+-4.72799999999991 5.58218359302256e-07
+-4.72699999999991 5.60863584319927e-07
+-4.72599999999991 5.6352078072385e-07
+-4.72499999999991 5.6618999990373e-07
+-4.72399999999991 5.68871293456566e-07
+-4.72299999999991 5.71564713187418e-07
+-4.72199999999991 5.74270311110188e-07
+-4.72099999999991 5.76988139448401e-07
+-4.71999999999991 5.79718250635984e-07
+-4.71899999999991 5.82460697318057e-07
+-4.71799999999991 5.85215532351715e-07
+-4.71699999999991 5.87982808806825e-07
+-4.71599999999991 5.90762579966816e-07
+-4.7149999999999 5.93554899329476e-07
+-4.7139999999999 5.9635982060775e-07
+-4.7129999999999 5.99177397730543e-07
+-4.7119999999999 6.02007684843524e-07
+-4.7109999999999 6.04850736309932e-07
+-4.7099999999999 6.07706606711389e-07
+-4.7089999999999 6.10575350848707e-07
+-4.7079999999999 6.13457023742708e-07
+-4.7069999999999 6.16351680635039e-07
+-4.7059999999999 6.19259376988995e-07
+-4.7049999999999 6.22180168490344e-07
+-4.7039999999999 6.25114111048145e-07
+-4.7029999999999 6.28061260795587e-07
+-4.7019999999999 6.31021674090815e-07
+-4.7009999999999 6.33995407517767e-07
+-4.6999999999999 6.3698251788701e-07
+-4.6989999999999 6.39983062236581e-07
+-4.6979999999999 6.42997097832831e-07
+-4.6969999999999 6.46024682171269e-07
+-4.6959999999999 6.49065872977409e-07
+-4.6949999999999 6.52120728207627e-07
+-4.6939999999999 6.55189306050014e-07
+-4.6929999999999 6.58271664925228e-07
+-4.6919999999999 6.61367863487359e-07
+-4.6909999999999 6.64477960624792e-07
+-4.6899999999999 6.67602015461071e-07
+-4.6889999999999 6.70740087355768e-07
+-4.6879999999999 6.73892235905358e-07
+-4.6869999999999 6.77058520944085e-07
+-4.6859999999999 6.80239002544853e-07
+-4.68499999999989 6.83433741020092e-07
+-4.68399999999989 6.86642796922654e-07
+-4.68299999999989 6.89866231046688e-07
+-4.68199999999989 6.93104104428542e-07
+-4.68099999999989 6.96356478347639e-07
+-4.67999999999989 6.9962341432739e-07
+-4.67899999999989 7.02904974136076e-07
+-4.67799999999989 7.06201219787765e-07
+-4.67699999999989 7.095122135432e-07
+-4.67599999999989 7.12838017910717e-07
+-4.67499999999989 7.16178695647157e-07
+-4.67399999999989 7.19534309758764e-07
+-4.67299999999989 7.22904923502124e-07
+-4.67199999999989 7.26290600385061e-07
+-4.67099999999989 7.29691404167578e-07
+-4.66999999999989 7.33107398862771e-07
+-4.66899999999989 7.36538648737763e-07
+-4.66799999999989 7.39985218314632e-07
+-4.66699999999989 7.4344717237135e-07
+-4.66599999999989 7.46924575942714e-07
+-4.66499999999989 7.50417494321295e-07
+-4.66399999999989 7.53925993058375e-07
+-4.66299999999989 7.57450137964899e-07
+-4.66199999999989 7.60989995112419e-07
+-4.66099999999989 7.64545630834058e-07
+-4.65999999999989 7.68117111725452e-07
+-4.65899999999989 7.71704504645724e-07
+-4.65799999999989 7.75307876718435e-07
+-4.65699999999989 7.78927295332557e-07
+-4.65599999999989 7.82562828143442e-07
+-4.65499999999988 7.86214543073787e-07
+-4.65399999999988 7.89882508314622e-07
+-4.65299999999988 7.93566792326274e-07
+-4.65199999999988 7.97267463839364e-07
+-4.65099999999988 8.00984591855779e-07
+-4.64999999999988 8.04718245649668e-07
+-4.64899999999988 8.08468494768431e-07
+-4.64799999999988 8.12235409033717e-07
+-4.64699999999988 8.16019058542416e-07
+-4.64599999999988 8.19819513667667e-07
+-4.64499999999988 8.23636845059856e-07
+-4.64399999999988 8.27471123647634e-07
+-4.64299999999988 8.31322420638917e-07
+-4.64199999999988 8.35190807521906e-07
+-4.64099999999988 8.39076356066107e-07
+-4.63999999999988 8.42979138323347e-07
+-4.63899999999988 8.46899226628803e-07
+-4.63799999999988 8.50836693602028e-07
+-4.63699999999988 8.54791612147982e-07
+-4.63599999999988 8.58764055458069e-07
+-4.63499999999988 8.6275409701117e-07
+-4.63399999999988 8.66761810574691e-07
+-4.63299999999988 8.70787270205603e-07
+-4.63199999999988 8.74830550251489e-07
+-4.63099999999988 8.78891725351601e-07
+-4.62999999999988 8.82970870437913e-07
+-4.62899999999988 8.87068060736178e-07
+-4.62799999999988 8.91183371766991e-07
+-4.62699999999988 8.95316879346848e-07
+-4.62599999999988 8.9946865958923e-07
+-4.62499999999987 9.03638788905661e-07
+-4.62399999999987 9.07827344006789e-07
+-4.62299999999987 9.12034401903464e-07
+-4.62199999999987 9.16260039907826e-07
+-4.62099999999987 9.20504335634381e-07
+-4.61999999999987 9.24767367001104e-07
+-4.61899999999987 9.29049212230519e-07
+-4.61799999999987 9.33349949850804e-07
+-4.61699999999987 9.3766965869689e-07
+-4.61599999999987 9.42008417911562e-07
+-4.61499999999987 9.46366306946574e-07
+-4.61399999999987 9.50743405563747e-07
+-4.61299999999987 9.55139793836099e-07
+-4.61199999999987 9.59555552148953e-07
+-4.61099999999987 9.63990761201059e-07
+-4.60999999999987 9.68445502005727e-07
+-4.60899999999987 9.72919855891946e-07
+-4.60799999999987 9.77413904505527e-07
+-4.60699999999987 9.81927729810231e-07
+-4.60599999999987 9.86461414088915e-07
+-4.60499999999987 9.91015039944673e-07
+-4.60399999999987 9.95588690301981e-07
+-4.60299999999987 1.00018244840785e-06
+-4.60199999999987 1.00479639783299e-06
+-4.60099999999987 1.00943062247295e-06
+-4.59999999999987 1.0140852065493e-06
+-4.59899999999987 1.01876023461077e-06
+-4.59799999999987 1.02345579153445e-06
+-4.59699999999987 1.02817196252696e-06
+-4.59599999999987 1.0329088331256e-06
+-4.59499999999986 1.03766648919955e-06
+-4.59399999999986 1.04244501695106e-06
+-4.59299999999986 1.04724450291663e-06
+-4.59199999999986 1.05206503396819e-06
+-4.59099999999986 1.05690669731435e-06
+-4.58999999999986 1.06176958050151e-06
+-4.58899999999986 1.06665377141514e-06
+-4.58799999999986 1.07155935828096e-06
+-4.58699999999986 1.07648642966615e-06
+-4.58599999999986 1.08143507448057e-06
+-4.58499999999986 1.08640538197798e-06
+-4.58399999999986 1.09139744175725e-06
+-4.58299999999986 1.0964113437636e-06
+-4.58199999999986 1.10144717828984e-06
+-4.58099999999986 1.10650503597758e-06
+-4.57999999999986 1.11158500781849e-06
+-4.57899999999986 1.11668718515553e-06
+-4.57799999999986 1.1218116596842e-06
+-4.57699999999986 1.12695852345379e-06
+-4.57599999999986 1.13212786886865e-06
+-4.57499999999986 1.1373197886894e-06
+-4.57399999999986 1.14253437603428e-06
+-4.57299999999986 1.14777172438032e-06
+-4.57199999999986 1.15303192756466e-06
+-4.57099999999986 1.15831507978584e-06
+-4.56999999999986 1.16362127560503e-06
+-4.56899999999986 1.16895060994736e-06
+-4.56799999999986 1.17430317810318e-06
+-4.56699999999986 1.17967907572935e-06
+-4.56599999999986 1.18507839885055e-06
+-4.56499999999985 1.19050124386057e-06
+-4.56399999999985 1.1959477075236e-06
+-4.56299999999985 1.20141788697557e-06
+-4.56199999999985 1.20691187972544e-06
+-4.56099999999985 1.21242978365648e-06
+-4.55999999999985 1.21797169702769e-06
+-4.55899999999985 1.223537718475e-06
+-4.55799999999985 1.22912794701269e-06
+-4.55699999999985 1.23474248203468e-06
+-4.55599999999985 1.24038142331589e-06
+-4.55499999999985 1.24604487101354e-06
+-4.55399999999985 1.25173292566854e-06
+-4.55299999999985 1.25744568820681e-06
+-4.55199999999985 1.26318325994065e-06
+-4.55099999999985 1.26894574257008e-06
+-4.54999999999985 1.27473323818422e-06
+-4.54899999999985 1.28054584926263e-06
+-4.54799999999985 1.28638367867672e-06
+-4.54699999999985 1.29224682969108e-06
+-4.54599999999985 1.29813540596489e-06
+-4.54499999999985 1.3040495115533e-06
+-4.54399999999985 1.30998925090878e-06
+-4.54299999999985 1.31595472888256e-06
+-4.54199999999985 1.32194605072603e-06
+-4.54099999999985 1.32796332209206e-06
+-4.53999999999985 1.33400664903651e-06
+-4.53899999999985 1.34007613801958e-06
+-4.53799999999985 1.34617189590721e-06
+-4.53699999999985 1.35229402997256e-06
+-4.53599999999985 1.35844264789734e-06
+-4.53499999999984 1.36461785777335e-06
+-4.53399999999984 1.37081976810382e-06
+-4.53299999999984 1.37704848780486e-06
+-4.53199999999984 1.38330412620695e-06
+-4.53099999999984 1.38958679305633e-06
+-4.52999999999984 1.39589659851647e-06
+-4.52899999999984 1.40223365316953e-06
+-4.52799999999984 1.40859806801782e-06
+-4.52699999999984 1.41498995448522e-06
+-4.52599999999984 1.42140942441871e-06
+-4.52499999999984 1.4278565900898e-06
+-4.52399999999984 1.43433156419602e-06
+-4.52299999999984 1.44083445986239e-06
+-4.52199999999984 1.44736539064293e-06
+-4.52099999999984 1.45392447052209e-06
+-4.51999999999984 1.46051181391635e-06
+-4.51899999999984 1.4671275356756e-06
+-4.51799999999984 1.47377175108473e-06
+-4.51699999999984 1.48044457586509e-06
+-4.51599999999984 1.48714612617603e-06
+-4.51499999999984 1.4938765186164e-06
+-4.51399999999984 1.50063587022609e-06
+-4.51299999999984 1.50742429848753e-06
+-4.51199999999984 1.51424192132725e-06
+-4.51099999999984 1.5210888571174e-06
+-4.50999999999984 1.52796522467729e-06
+-4.50899999999984 1.53487114327494e-06
+-4.50799999999984 1.54180673262864e-06
+-4.50699999999984 1.54877211290848e-06
+-4.50599999999984 1.55576740473794e-06
+-4.50499999999983 1.56279272919544e-06
+-4.50399999999983 1.56984820781588e-06
+-4.50299999999983 1.57693396259229e-06
+-4.50199999999983 1.58405011597732e-06
+-4.50099999999983 1.59119679088489e-06
+-4.49999999999983 1.59837411069175e-06
+-4.49899999999983 1.60558219923908e-06
+-4.49799999999983 1.61282118083407e-06
+-4.49699999999983 1.62009118025157e-06
+-4.49599999999983 1.62739232273565e-06
+-4.49499999999983 1.63472473400123e-06
+-4.49399999999983 1.6420885402357e-06
+-4.49299999999983 1.64948386810054e-06
+-4.49199999999983 1.65691084473297e-06
+-4.49099999999983 1.66436959774754e-06
+-4.48999999999983 1.67186025523779e-06
+-4.48899999999983 1.67938294577791e-06
+-4.48799999999983 1.68693779842435e-06
+-4.48699999999983 1.69452494271752e-06
+-4.48599999999983 1.7021445086834e-06
+-4.48499999999983 1.70979662683522e-06
+-4.48399999999983 1.71748142817516e-06
+-4.48299999999983 1.72519904419595e-06
+-4.48199999999983 1.73294960688264e-06
+-4.48099999999983 1.74073324871421e-06
+-4.47999999999983 1.74855010266528e-06
+-4.47899999999983 1.75640030220781e-06
+-4.47799999999983 1.7642839813128e-06
+-4.47699999999983 1.77220127445199e-06
+-4.47599999999983 1.78015231659955e-06
+-4.47499999999982 1.78813724323384e-06
+-4.47399999999982 1.79615619033906e-06
+-4.47299999999982 1.80420929440705e-06
+-4.47199999999982 1.81229669243894e-06
+-4.47099999999982 1.82041852194698e-06
+-4.46999999999982 1.82857492095618e-06
+-4.46899999999982 1.83676602800613e-06
+-4.46799999999982 1.84499198215269e-06
+-4.46699999999982 1.85325292296981e-06
+-4.46599999999982 1.86154899055124e-06
+-4.46499999999982 1.8698803255123e-06
+-4.46399999999982 1.8782470689917e-06
+-4.46299999999982 1.88664936265324e-06
+-4.46199999999982 1.89508734868765e-06
+-4.46099999999982 1.90356116981437e-06
+-4.45999999999982 1.91207096928331e-06
+-4.45899999999982 1.92061689087668e-06
+-4.45799999999982 1.92919907891079e-06
+-4.45699999999982 1.93781767823782e-06
+-4.45599999999982 1.94647283424771e-06
+-4.45499999999982 1.9551646928699e-06
+-4.45399999999982 1.9638934005752e-06
+-4.45299999999982 1.97265910437761e-06
+-4.45199999999982 1.98146195183615e-06
+-4.45099999999982 1.99030209105672e-06
+-4.44999999999982 1.99917967069392e-06
+-4.44899999999982 2.0080948399529e-06
+-4.44799999999982 2.01704774859127e-06
+-4.44699999999982 2.0260385469209e-06
+-4.44599999999981 2.03506738580982e-06
+-4.44499999999981 2.04413441668407e-06
+-4.44399999999981 2.05323979152964e-06
+-4.44299999999981 2.06238366289427e-06
+-4.44199999999981 2.07156618388941e-06
+-4.44099999999981 2.08078750819207e-06
+-4.43999999999981 2.09004779004678e-06
+-4.43899999999981 2.09934718426742e-06
+-4.43799999999981 2.10868584623919e-06
+-4.43699999999981 2.11806393192051e-06
+-4.43599999999981 2.12748159784496e-06
+-4.43499999999981 2.13693900112319e-06
+-4.43399999999981 2.14643629944485e-06
+-4.43299999999981 2.15597365108056e-06
+-4.43199999999981 2.16555121488385e-06
+-4.43099999999981 2.1751691502931e-06
+-4.42999999999981 2.18482761733349e-06
+-4.42899999999981 2.19452677661899e-06
+-4.42799999999981 2.20426678935435e-06
+-4.42699999999981 2.21404781733699e-06
+-4.42599999999981 2.22387002295909e-06
+-4.42499999999981 2.2337335692095e-06
+-4.42399999999981 2.24363861967576e-06
+-4.42299999999981 2.25358533854612e-06
+-4.42199999999981 2.26357389061151e-06
+-4.42099999999981 2.27360444126756e-06
+-4.41999999999981 2.28367715651665e-06
+-4.41899999999981 2.29379220296987e-06
+-4.41799999999981 2.30394974784913e-06
+-4.41699999999981 2.31414995898911e-06
+-4.4159999999998 2.32439300483937e-06
+-4.4149999999998 2.33467905446637e-06
+-4.4139999999998 2.34500827755548e-06
+-4.4129999999998 2.35538084441314e-06
+-4.4119999999998 2.36579692596883e-06
+-4.4109999999998 2.37625669377718e-06
+-4.4099999999998 2.38676032002003e-06
+-4.4089999999998 2.39730797750857e-06
+-4.4079999999998 2.40789983968534e-06
+-4.4069999999998 2.41853608062638e-06
+-4.4059999999998 2.42921687504334e-06
+-4.4049999999998 2.43994239828554e-06
+-4.4039999999998 2.45071282634214e-06
+-4.4029999999998 2.46152833584419e-06
+-4.4019999999998 2.47238910406685e-06
+-4.4009999999998 2.48329530893142e-06
+-4.3999999999998 2.49424712900756e-06
+-4.3989999999998 2.50524474351536e-06
+-4.3979999999998 2.51628833232757e-06
+-4.3969999999998 2.5273780759717e-06
+-4.3959999999998 2.5385141556322e-06
+-4.3949999999998 2.54969675315262e-06
+-4.3939999999998 2.56092605103779e-06
+-4.3929999999998 2.57220223245604e-06
+-4.3919999999998 2.58352548124131e-06
+-4.3909999999998 2.5948959818954e-06
+-4.3899999999998 2.60631391959016e-06
+-4.3889999999998 2.61777948016971e-06
+-4.3879999999998 2.62929285015259e-06
+-4.3869999999998 2.64085421673407e-06
+-4.38599999999979 2.65246376778832e-06
+-4.38499999999979 2.66412169187064e-06
+-4.38399999999979 2.67582817821971e-06
+-4.38299999999979 2.68758341675987e-06
+-4.38199999999979 2.69938759810331e-06
+-4.38099999999979 2.71124091355235e-06
+-4.37999999999979 2.72314355510173e-06
+-4.37899999999979 2.73509571544085e-06
+-4.37799999999979 2.74709758795607e-06
+-4.37699999999979 2.75914936673297e-06
+-4.37599999999979 2.77125124655864e-06
+-4.37499999999979 2.78340342292403e-06
+-4.37399999999979 2.79560609202617e-06
+-4.37299999999979 2.80785945077054e-06
+-4.37199999999979 2.82016369677338e-06
+-4.37099999999979 2.83251902836398e-06
+-4.36999999999979 2.84492564458705e-06
+-4.36899999999979 2.85738374520502e-06
+-4.36799999999979 2.86989353070041e-06
+-4.36699999999979 2.88245520227818e-06
+-4.36599999999979 2.89506896186806e-06
+-4.36499999999979 2.90773501212694e-06
+-4.36399999999979 2.92045355644123e-06
+-4.36299999999979 2.93322479892923e-06
+-4.36199999999979 2.94604894444351e-06
+-4.36099999999979 2.95892619857333e-06
+-4.35999999999979 2.97185676764699e-06
+-4.35899999999979 2.98484085873429e-06
+-4.35799999999979 2.99787867964889e-06
+-4.35699999999979 3.01097043895073e-06
+-4.35599999999978 3.0241163459485e-06
+-4.35499999999978 3.03731661070202e-06
+-4.35399999999978 3.0505714440247e-06
+-4.35299999999978 3.06388105748599e-06
+-4.35199999999978 3.07724566341382e-06
+-4.35099999999978 3.09066547489704e-06
+-4.34999999999978 3.10414070578795e-06
+-4.34899999999978 3.11767157070469e-06
+-4.34799999999978 3.13125828503376e-06
+-4.34699999999978 3.14490106493252e-06
+-4.34599999999978 3.15860012733166e-06
+-4.34499999999978 3.17235568993769e-06
+-4.34399999999978 3.18616797123549e-06
+-4.34299999999978 3.20003719049076e-06
+-4.34199999999978 3.21396356775261e-06
+-4.34099999999978 3.22794732385604e-06
+-4.33999999999978 3.24198868042448e-06
+-4.33899999999978 3.25608785987236e-06
+-4.33799999999978 3.27024508540762e-06
+-4.33699999999978 3.28446058103431e-06
+-4.33599999999978 3.29873457155511e-06
+-4.33499999999978 3.31306728257394e-06
+-4.33399999999978 3.3274589404985e-06
+-4.33299999999978 3.34190977254288e-06
+-4.33199999999978 3.35642000673014e-06
+-4.33099999999978 3.37098987189493e-06
+-4.32999999999978 3.38561959768607e-06
+-4.32899999999978 3.40030941456916e-06
+-4.32799999999978 3.41505955382926e-06
+-4.32699999999978 3.42987024757342e-06
+-4.32599999999977 3.4447417287334e-06
+-4.32499999999977 3.45967423106827e-06
+-4.32399999999977 3.47466798916709e-06
+-4.32299999999977 3.48972323845152e-06
+-4.32199999999977 3.50484021517855e-06
+-4.32099999999977 3.52001915644311e-06
+-4.31999999999977 3.53526030018078e-06
+-4.31899999999977 3.55056388517048e-06
+-4.31799999999977 3.56593015103715e-06
+-4.31699999999977 3.58135933825446e-06
+-4.31599999999977 3.59685168814752e-06
+-4.31499999999977 3.61240744289561e-06
+-4.31399999999977 3.62802684553486e-06
+-4.31299999999977 3.64371013996102e-06
+-4.31199999999977 3.6594575709322e-06
+-4.31099999999977 3.67526938407161e-06
+-4.30999999999977 3.69114582587028e-06
+-4.30899999999977 3.70708714368988e-06
+-4.30799999999977 3.72309358576546e-06
+-4.30699999999977 3.73916540120822e-06
+-4.30599999999977 3.7553028400083e-06
+-4.30499999999977 3.77150615303758e-06
+-4.30399999999977 3.78777559205247e-06
+-4.30299999999977 3.80411140969673e-06
+-4.30199999999977 3.82051385950427e-06
+-4.30099999999977 3.83698319590199e-06
+-4.29999999999977 3.85351967421258e-06
+-4.29899999999977 3.8701235506574e-06
+-4.29799999999977 3.88679508235929e-06
+-4.29699999999977 3.90353452734545e-06
+-4.29599999999976 3.92034214455026e-06
+-4.29499999999976 3.93721819381822e-06
+-4.29399999999976 3.95416293590677e-06
+-4.29299999999976 3.97117663248916e-06
+-4.29199999999976 3.9882595461574e-06
+-4.29099999999976 4.00541194042516e-06
+-4.28999999999976 4.02263407973059e-06
+-4.28899999999976 4.03992622943934e-06
+-4.28799999999976 4.05728865584743e-06
+-4.28699999999976 4.07472162618418e-06
+-4.28599999999976 4.09222540861521e-06
+-4.28499999999976 4.10980027224527e-06
+-4.28399999999976 4.12744648712133e-06
+-4.28299999999976 4.14516432423544e-06
+-4.28199999999976 4.16295405552777e-06
+-4.28099999999976 4.18081595388954e-06
+-4.27999999999976 4.19875029316605e-06
+-4.27899999999976 4.21675734815965e-06
+-4.27799999999976 4.23483739463272e-06
+-4.27699999999976 4.25299070931078e-06
+-4.27599999999976 4.27121756988536e-06
+-4.27499999999976 4.28951825501716e-06
+-4.27399999999976 4.30789304433904e-06
+-4.27299999999976 4.32634221845904e-06
+-4.27199999999976 4.34486605896345e-06
+-4.27099999999976 4.3634648484199e-06
+-4.26999999999976 4.38213887038037e-06
+-4.26899999999976 4.40088840938432e-06
+-4.26799999999976 4.41971375096177e-06
+-4.26699999999976 4.43861518163634e-06
+-4.26599999999975 4.45759298892843e-06
+-4.26499999999975 4.47664746135826e-06
+-4.26399999999975 4.49577888844903e-06
+-4.26299999999975 4.51498756073005e-06
+-4.26199999999975 4.53427376973985e-06
+-4.26099999999975 4.55363780802934e-06
+-4.25999999999975 4.57307996916494e-06
+-4.25899999999975 4.59260054773178e-06
+-4.25799999999975 4.61219983933681e-06
+-4.25699999999975 4.63187814061207e-06
+-4.25599999999975 4.65163574921776e-06
+-4.25499999999975 4.67147296384552e-06
+-4.25399999999975 4.6913900842216e-06
+-4.25299999999975 4.71138741111007e-06
+-4.25199999999975 4.73146524631605e-06
+-4.25099999999975 4.75162389268892e-06
+-4.24999999999975 4.77186365412557e-06
+-4.24899999999975 4.79218483557366e-06
+-4.24799999999975 4.81258774303484e-06
+-4.24699999999975 4.83307268356801e-06
+-4.24599999999975 4.85363996529264e-06
+-4.24499999999975 4.87428989739201e-06
+-4.24399999999975 4.89502279011648e-06
+-4.24299999999975 4.91583895478685e-06
+-4.24199999999975 4.9367387037976e-06
+-4.24099999999975 4.95772235062022e-06
+-4.23999999999975 4.97879020980658e-06
+-4.23899999999975 4.99994259699218e-06
+-4.23799999999975 5.02117982889957e-06
+-4.23699999999975 5.04250222334163e-06
+-4.23599999999974 5.063910099225e-06
+-4.23499999999974 5.08540377655337e-06
+-4.23399999999974 5.10698357643089e-06
+-4.23299999999974 5.12864982106558e-06
+-4.23199999999974 5.15040283377267e-06
+-4.23099999999974 5.17224293897805e-06
+-4.22999999999974 5.19417046222164e-06
+-4.22899999999974 5.21618573016084e-06
+-4.22799999999974 5.23828907057394e-06
+-4.22699999999974 5.26048081236357e-06
+-4.22599999999974 5.28276128556011e-06
+-4.22499999999974 5.30513082132523e-06
+-4.22399999999974 5.32758975195524e-06
+-4.22299999999974 5.35013841088463e-06
+-4.22199999999974 5.37277713268959e-06
+-4.22099999999974 5.39550625309138e-06
+-4.21999999999974 5.41832610895997e-06
+-4.21899999999974 5.44123703831742e-06
+-4.21799999999974 5.46423938034152e-06
+-4.21699999999974 5.48733347536921e-06
+-4.21599999999974 5.51051966490016e-06
+-4.21499999999974 5.53379829160038e-06
+-4.21399999999974 5.55716969930563e-06
+-4.21299999999974 5.58063423302513e-06
+-4.21199999999974 5.60419223894503e-06
+-4.21099999999974 5.62784406443203e-06
+-4.20999999999974 5.65159005803702e-06
+-4.20899999999974 5.67543056949857e-06
+-4.20799999999974 5.69936594974664e-06
+-4.20699999999974 5.72339655090615e-06
+-4.20599999999973 5.74752272630061e-06
+-4.20499999999973 5.77174483045579e-06
+-4.20399999999973 5.79606321910332e-06
+-4.20299999999973 5.82047824918437e-06
+-4.20199999999973 5.84499027885334e-06
+-4.20099999999973 5.86959966748147e-06
+-4.19999999999973 5.8943067756606e-06
+-4.19899999999973 5.9191119652068e-06
+-4.19799999999973 5.94401559916413e-06
+-4.19699999999973 5.96901804180829e-06
+-4.19599999999973 5.99411965865039e-06
+-4.19499999999973 6.01932081644068e-06
+-4.19399999999973 6.04462188317223e-06
+-4.19299999999973 6.07002322808479e-06
+-4.19199999999973 6.09552522166844e-06
+-4.19099999999973 6.12112823566742e-06
+-4.18999999999973 6.1468326430839e-06
+-4.18899999999973 6.17263881818176e-06
+-4.18799999999973 6.1985471364904e-06
+-4.18699999999973 6.22455797480853e-06
+-4.18599999999973 6.25067171120799e-06
+-4.18499999999973 6.27688872503759e-06
+-4.18399999999973 6.30320939692695e-06
+-4.18299999999973 6.32963410879034e-06
+-4.18199999999973 6.3561632438305e-06
+-4.18099999999973 6.38279718654257e-06
+-4.17999999999973 6.40953632271793e-06
+-4.17899999999973 6.43638103944808e-06
+-4.17799999999973 6.46333172512856e-06
+-4.17699999999973 6.49038876946281e-06
+-4.17599999999972 6.51755256346613e-06
+-4.17499999999972 6.5448234994696e-06
+-4.17399999999972 6.57220197112399e-06
+-4.17299999999972 6.59968837340371e-06
+-4.17199999999972 6.62728310261077e-06
+-4.17099999999972 6.65498655637875e-06
+-4.16999999999972 6.68279913367679e-06
+-4.16899999999972 6.71072123481349e-06
+-4.16799999999972 6.73875326144105e-06
+-4.16699999999972 6.7668956165591e-06
+-4.16599999999972 6.79514870451885e-06
+-4.16499999999972 6.82351293102707e-06
+-4.16399999999972 6.85198870315011e-06
+-4.16299999999972 6.88057642931793e-06
+-4.16199999999972 6.9092765193282e-06
+-4.16099999999972 6.93808938435033e-06
+-4.15999999999972 6.96701543692956e-06
+-4.15899999999972 6.99605509099104e-06
+-4.15799999999972 7.0252087618439e-06
+-4.15699999999972 7.0544768661854e-06
+-4.15599999999972 7.08385982210499e-06
+-4.15499999999972 7.11335804908849e-06
+-4.15399999999972 7.14297196802219e-06
+-4.15299999999972 7.172702001197e-06
+-4.15199999999972 7.20254857231259e-06
+-4.15099999999972 7.2325121064816e-06
+-4.14999999999972 7.2625930302338e-06
+-4.14899999999972 7.29279177152023e-06
+-4.14799999999972 7.32310875971741e-06
+-4.14699999999972 7.35354442563164e-06
+-4.14599999999971 7.38409920150309e-06
+-4.14499999999971 7.41477352101009e-06
+-4.14399999999971 7.44556781927334e-06
+-4.14299999999971 7.47648253286022e-06
+-4.14199999999971 7.50751809978896e-06
+-4.14099999999971 7.53867495953297e-06
+-4.13999999999971 7.56995355302512e-06
+-4.13899999999971 7.60135432266195e-06
+-4.13799999999971 7.6328777123081e-06
+-4.13699999999971 7.6645241673005e-06
+-4.13599999999971 7.69629413445278e-06
+-4.13499999999971 7.72818806205951e-06
+-4.13399999999971 7.76020639990065e-06
+-4.13299999999971 7.79234959924583e-06
+-4.13199999999971 7.82461811285871e-06
+-4.13099999999971 7.85701239500139e-06
+-4.12999999999971 7.88953290143877e-06
+-4.12899999999971 7.92218008944297e-06
+-4.12799999999971 7.9549544177977e-06
+-4.12699999999971 7.98785634680269e-06
+-4.12599999999971 8.02088633827813e-06
+-4.12499999999971 8.05404485556913e-06
+-4.12399999999971 8.08733236355006e-06
+-4.12299999999971 8.12074932862919e-06
+-4.12199999999971 8.15429621875295e-06
+-4.12099999999971 8.18797350341058e-06
+-4.11999999999971 8.22178165363855e-06
+-4.11899999999971 8.25572114202506e-06
+-4.11799999999971 8.28979244271454e-06
+-4.11699999999971 8.32399603141226e-06
+-4.1159999999997 8.35833238538874e-06
+-4.1149999999997 8.39280198348437e-06
+-4.1139999999997 8.42740530611396e-06
+-4.1129999999997 8.4621428352713e-06
+-4.1119999999997 8.49701505453375e-06
+-4.1109999999997 8.5320224490668e-06
+-4.1099999999997 8.56716550562866e-06
+-4.1089999999997 8.60244471257497e-06
+-4.1079999999997 8.63786055986328e-06
+-4.1069999999997 8.67341353905779e-06
+-4.1059999999997 8.70910414333394e-06
+-4.1049999999997 8.7449328674831e-06
+-4.1039999999997 8.7809002079172e-06
+-4.1029999999997 8.81700666267344e-06
+-4.1019999999997 8.85325273141897e-06
+-4.1009999999997 8.88963891545553e-06
+-4.0999999999997 8.92616571772428e-06
+-4.0989999999997 8.96283364281045e-06
+-4.0979999999997 8.99964319694801e-06
+-4.0969999999997 9.03659488802457e-06
+-4.0959999999997 9.07368922558599e-06
+-4.0949999999997 9.11092672084123e-06
+-4.0939999999997 9.1483078866671e-06
+-4.0929999999997 9.18583323761301e-06
+-4.0919999999997 9.2235032899059e-06
+-4.0909999999997 9.26131856145487e-06
+-4.0899999999997 9.29927957185614e-06
+-4.0889999999997 9.33738684239784e-06
+-4.0879999999997 9.37564089606486e-06
+-4.0869999999997 9.41404225754368e-06
+-4.08599999999969 9.45259145322727e-06
+-4.08499999999969 9.49128901121996e-06
+-4.08399999999969 9.53013546134234e-06
+-4.08299999999969 9.56913133513616e-06
+-4.08199999999969 9.6082771658692e-06
+-4.08099999999969 9.64757348854025e-06
+-4.07999999999969 9.68702083988408e-06
+-4.07899999999969 9.72661975837623e-06
+-4.07799999999969 9.76637078423821e-06
+-4.07699999999969 9.80627445944222e-06
+-4.07599999999969 9.84633132771632e-06
+-4.07499999999969 9.88654193454937e-06
+-4.07399999999969 9.92690682719593e-06
+-4.07299999999969 9.9674265546815e-06
+-4.07199999999969 1.00081016678073e-05
+-4.07099999999969 1.00489327191555e-05
+-4.06999999999969 1.00899202630942e-05
+-4.06899999999969 1.01310648557825e-05
+-4.06799999999969 1.01723670551755e-05
+-4.06699999999969 1.02138274210296e-05
+-4.06599999999969 1.02554465149072e-05
+-4.06499999999969 1.02972249001825e-05
+-4.06399999999969 1.03391631420458e-05
+-4.06299999999969 1.03812618075092e-05
+-4.06199999999969 1.04235214654116e-05
+-4.06099999999969 1.04659426864237e-05
+-4.05999999999969 1.05085260430534e-05
+-4.05899999999969 1.05512721096509e-05
+-4.05799999999969 1.05941814624139e-05
+-4.05699999999969 1.06372546793927e-05
+-4.05599999999968 1.06804923404954e-05
+-4.05499999999968 1.07238950274936e-05
+-4.05399999999968 1.07674633240269e-05
+-4.05299999999968 1.08111978156088e-05
+-4.05199999999968 1.08550990896314e-05
+-4.05099999999968 1.08991677353712e-05
+-4.04999999999968 1.09434043439941e-05
+-4.04899999999968 1.09878095085608e-05
+-4.04799999999968 1.10323838240319e-05
+-4.04699999999968 1.10771278872736e-05
+-4.04599999999968 1.11220422970628e-05
+-4.04499999999968 1.11671276540924e-05
+-4.04399999999968 1.12123845609767e-05
+-4.04299999999968 1.1257813622257e-05
+-4.04199999999968 1.13034154444066e-05
+-4.04099999999968 1.13491906358367e-05
+-4.03999999999968 1.13951398069012e-05
+-4.03899999999968 1.14412635699026e-05
+-4.03799999999968 1.14875625390972e-05
+-4.03699999999968 1.15340373307007e-05
+-4.03599999999968 1.15806885628935e-05
+-4.03499999999968 1.16275168558262e-05
+-4.03399999999968 1.16745228316253e-05
+-4.03299999999968 1.17217071143984e-05
+-4.03199999999968 1.17690703302399e-05
+-4.03099999999968 1.18166131072363e-05
+-4.02999999999968 1.18643360754721e-05
+-4.02899999999968 1.1912239867035e-05
+-4.02799999999968 1.19603251160216e-05
+-4.02699999999968 1.2008592458543e-05
+-4.02599999999967 1.20570425327303e-05
+-4.02499999999967 1.21056759787403e-05
+-4.02399999999967 1.2154493438761e-05
+-4.02299999999967 1.22034955570171e-05
+-4.02199999999967 1.22526829797762e-05
+-4.02099999999967 1.23020563553536e-05
+-4.01999999999967 1.23516163341186e-05
+-4.01899999999967 1.24013635685e-05
+-4.01799999999967 1.24512987129916e-05
+-4.01699999999967 1.25014224241582e-05
+-4.01599999999967 1.25517353606411e-05
+-4.01499999999967 1.26022381831637e-05
+-4.01399999999967 1.26529315545376e-05
+-4.01299999999967 1.27038161396682e-05
+-4.01199999999967 1.27548926055601e-05
+-4.01099999999967 1.28061616213234e-05
+-4.00999999999967 1.28576238581791e-05
+-4.00899999999967 1.29092799894653e-05
+-4.00799999999967 1.29611306906426e-05
+-4.00699999999967 1.30131766392999e-05
+-4.00599999999967 1.30654185151607e-05
+-4.00499999999967 1.31178570000885e-05
+-4.00399999999967 1.31704927780929e-05
+-4.00299999999967 1.32233265353352e-05
+-4.00199999999967 1.32763589601348e-05
+-4.00099999999967 1.33295907429743e-05
+-3.99999999999967 1.33830225765064e-05
+-3.99899999999967 1.34366551555589e-05
+-3.99799999999967 1.34904891771412e-05
+-3.99699999999967 1.354452534045e-05
+-3.99599999999967 1.35987643468755e-05
+-3.99499999999967 1.36532069000072e-05
+-3.99399999999967 1.37078537056396e-05
+-3.99299999999967 1.3762705471779e-05
+-3.99199999999967 1.38177629086485e-05
+-3.99099999999967 1.3873026728695e-05
+-3.98999999999967 1.39284976465945e-05
+-3.98899999999967 1.39841763792585e-05
+-3.98799999999967 1.404006364584e-05
+-3.98699999999967 1.40961601677398e-05
+-3.98599999999967 1.41524666686119e-05
+-3.98499999999967 1.42089838743705e-05
+-3.98399999999967 1.42657125131955e-05
+-3.98299999999967 1.43226533155389e-05
+-3.98199999999967 1.43798070141308e-05
+-3.98099999999967 1.44371743439856e-05
+-3.97999999999967 1.44947560424082e-05
+-3.97899999999967 1.45525528490004e-05
+-3.97799999999967 1.46105655056665e-05
+-3.97699999999967 1.46687947566201e-05
+-3.97599999999967 1.47272413483901e-05
+-3.97499999999967 1.47859060298268e-05
+-3.97399999999967 1.48447895521085e-05
+-3.97299999999967 1.49038926687473e-05
+-3.97199999999967 1.49632161355958e-05
+-3.97099999999967 1.50227607108532e-05
+-3.96999999999967 1.50825271550716e-05
+-3.96899999999967 1.51425162311621e-05
+-3.96799999999967 1.52027287044017e-05
+-3.96699999999967 1.52631653424391e-05
+-3.96599999999967 1.53238269153012e-05
+-3.96499999999967 1.53847141953998e-05
+-3.96399999999967 1.54458279575374e-05
+-3.96299999999967 1.5507168978914e-05
+-3.96199999999967 1.55687380391335e-05
+-3.96099999999967 1.56305359202098e-05
+-3.95999999999967 1.56925634065737e-05
+-3.95899999999967 1.57548212850789e-05
+-3.95799999999967 1.58173103450089e-05
+-3.95699999999967 1.58800313780831e-05
+-3.95599999999967 1.59429851784635e-05
+-3.95499999999967 1.60061725427609e-05
+-3.95399999999967 1.60695942700421e-05
+-3.95299999999967 1.61332511618356e-05
+-3.95199999999967 1.61971440221387e-05
+-3.95099999999967 1.62612736574239e-05
+-3.94999999999967 1.63256408766454e-05
+-3.94899999999967 1.63902464912456e-05
+-3.94799999999967 1.64550913151622e-05
+-3.94699999999967 1.6520176164834e-05
+-3.94599999999967 1.65855018592084e-05
+-3.94499999999967 1.66510692197474e-05
+-3.94399999999967 1.67168790704343e-05
+-3.94299999999967 1.67829322377808e-05
+-3.94199999999967 1.68492295508333e-05
+-3.94099999999967 1.69157718411798e-05
+-3.93999999999967 1.69825599429562e-05
+-3.93899999999967 1.70495946928538e-05
+-3.93799999999967 1.7116876930125e-05
+-3.93699999999967 1.71844074965912e-05
+-3.93599999999967 1.72521872366485e-05
+-3.93499999999967 1.73202169972751e-05
+-3.93399999999967 1.73884976280381e-05
+-3.93299999999967 1.74570299810999e-05
+-3.93199999999967 1.75258149112254e-05
+-3.93099999999967 1.75948532757887e-05
+-3.92999999999967 1.76641459347797e-05
+-3.92899999999967 1.77336937508115e-05
+-3.92799999999967 1.78034975891268e-05
+-3.92699999999967 1.78735583176049e-05
+-3.92599999999967 1.79438768067688e-05
+-3.92499999999967 1.80144539297919e-05
+-3.92399999999967 1.80852905625048e-05
+-3.92299999999967 1.81563875834028e-05
+-3.92199999999968 1.82277458736522e-05
+-3.92099999999968 1.82993663170977e-05
+-3.91999999999968 1.83712498002691e-05
+-3.91899999999968 1.84433972123885e-05
+-3.91799999999968 1.85158094453775e-05
+-3.91699999999968 1.85884873938635e-05
+-3.91599999999968 1.86614319551875e-05
+-3.91499999999968 1.8734644029411e-05
+-3.91399999999968 1.88081245193227e-05
+-3.91299999999968 1.88818743304458e-05
+-3.91199999999968 1.89558943710453e-05
+-3.91099999999968 1.90301855521349e-05
+-3.90999999999968 1.9104748787484e-05
+-3.90899999999968 1.9179584993625e-05
+-3.90799999999968 1.92546950898607e-05
+-3.90699999999968 1.93300799982709e-05
+-3.90599999999968 1.94057406437201e-05
+-3.90499999999968 1.94816779538643e-05
+-3.90399999999968 1.95578928591586e-05
+-3.90299999999968 1.96343862928641e-05
+-3.90199999999968 1.97111591910551e-05
+-3.90099999999968 1.97882124926269e-05
+-3.89999999999968 1.98655471393023e-05
+-3.89899999999968 1.99431640756394e-05
+-3.89799999999968 2.00210642490387e-05
+-3.89699999999968 2.00992486097506e-05
+-3.89599999999968 2.01777181108824e-05
+-3.89499999999968 2.0256473708406e-05
+-3.89399999999968 2.03355163611648e-05
+-3.89299999999968 2.04148470308815e-05
+-3.89199999999968 2.04944666821654e-05
+-3.89099999999968 2.05743762825196e-05
+-3.88999999999968 2.06545768023484e-05
+-3.88899999999968 2.07350692149651e-05
+-3.88799999999968 2.08158544965989e-05
+-3.88699999999968 2.08969336264029e-05
+-3.88599999999968 2.09783075864611e-05
+-3.88499999999968 2.10599773617963e-05
+-3.88399999999968 2.11419439403769e-05
+-3.88299999999968 2.12242083131255e-05
+-3.88199999999968 2.13067714739254e-05
+-3.88099999999968 2.13896344196286e-05
+-3.87999999999968 2.14727981500634e-05
+-3.87899999999968 2.15562636680418e-05
+-3.87799999999968 2.16400319793671e-05
+-3.87699999999968 2.17241040928417e-05
+-3.87599999999968 2.18084810202745e-05
+-3.87499999999968 2.18931637764883e-05
+-3.87399999999968 2.19781533793282e-05
+-3.87299999999968 2.20634508496685e-05
+-3.87199999999968 2.21490572114205e-05
+-3.87099999999968 2.22349734915407e-05
+-3.86999999999968 2.23212007200378e-05
+-3.86899999999968 2.24077399299809e-05
+-3.86799999999968 2.24945921575071e-05
+-3.86699999999968 2.2581758441829e-05
+-3.86599999999968 2.26692398252429e-05
+-3.86499999999968 2.27570373531362e-05
+-3.86399999999968 2.28451520739954e-05
+-3.86299999999968 2.29335850394137e-05
+-3.86199999999968 2.3022337304099e-05
+-3.86099999999968 2.31114099258818e-05
+-3.85999999999968 2.32008039657227e-05
+-3.85899999999968 2.32905204877206e-05
+-3.85799999999968 2.33805605591203e-05
+-3.85699999999968 2.34709252503208e-05
+-3.85599999999968 2.35616156348826e-05
+-3.85499999999968 2.36526327895362e-05
+-3.85399999999968 2.37439777941897e-05
+-3.85299999999968 2.38356517319367e-05
+-3.85199999999968 2.39276556890648e-05
+-3.85099999999968 2.40199907550626e-05
+-3.84999999999968 2.41126580226288e-05
+-3.84899999999968 2.42056585876792e-05
+-3.84799999999968 2.42989935493556e-05
+-3.84699999999968 2.43926640100332e-05
+-3.84599999999968 2.44866710753288e-05
+-3.84499999999968 2.45810158541092e-05
+-3.84399999999968 2.46756994584988e-05
+-3.84299999999968 2.47707230038881e-05
+-3.84199999999968 2.48660876089413e-05
+-3.84099999999968 2.49617943956052e-05
+-3.83999999999968 2.50578444891165e-05
+-3.83899999999968 2.51542390180105e-05
+-3.83799999999968 2.52509791141293e-05
+-3.83699999999968 2.53480659126294e-05
+-3.83599999999968 2.54455005519906e-05
+-3.83499999999968 2.55432841740239e-05
+-3.83399999999968 2.56414179238795e-05
+-3.83299999999968 2.57399029500556e-05
+-3.83199999999968 2.58387404044061e-05
+-3.83099999999969 2.59379314421492e-05
+-3.82999999999969 2.60374772218757e-05
+-3.82899999999969 2.61373789055569e-05
+-3.82799999999969 2.62376376585536e-05
+-3.82699999999969 2.63382546496238e-05
+-3.82599999999969 2.64392310509315e-05
+-3.82499999999969 2.65405680380548e-05
+-3.82399999999969 2.66422667899941e-05
+-3.82299999999969 2.67443284891811e-05
+-3.82199999999969 2.68467543214867e-05
+-3.82099999999969 2.69495454762296e-05
+-3.81999999999969 2.70527031461845e-05
+-3.81899999999969 2.71562285275911e-05
+-3.81799999999969 2.72601228201621e-05
+-3.81699999999969 2.73643872270918e-05
+-3.81599999999969 2.74690229550644e-05
+-3.81499999999969 2.75740312142631e-05
+-3.81399999999969 2.76794132183779e-05
+-3.81299999999969 2.77851701846149e-05
+-3.81199999999969 2.7891303333704e-05
+-3.81099999999969 2.79978138899083e-05
+-3.80999999999969 2.81047030810321e-05
+-3.80899999999969 2.82119721384297e-05
+-3.80799999999969 2.83196222970143e-05
+-3.80699999999969 2.84276547952659e-05
+-3.80599999999969 2.8536070875241e-05
+-3.80499999999969 2.86448717825801e-05
+-3.80399999999969 2.87540587665174e-05
+-3.80299999999969 2.88636330798889e-05
+-3.80199999999969 2.89735959791412e-05
+-3.80099999999969 2.90839487243404e-05
+-3.79999999999969 2.91946925791806e-05
+-3.79899999999969 2.93058288109928e-05
+-3.79799999999969 2.94173586907538e-05
+-3.79699999999969 2.95292834930947e-05
+-3.79599999999969 2.96416044963099e-05
+-3.79499999999969 2.97543229823657e-05
+-3.79399999999969 2.98674402369095e-05
+-3.79299999999969 2.99809575492782e-05
+-3.79199999999969 3.00948762125074e-05
+-3.79099999999969 3.02091975233403e-05
+-3.78999999999969 3.03239227822361e-05
+-3.78899999999969 3.04390532933796e-05
+-3.78799999999969 3.05545903646895e-05
+-3.78699999999969 3.06705353078278e-05
+-3.78599999999969 3.07868894382085e-05
+-3.78499999999969 3.09036540750066e-05
+-3.78399999999969 3.10208305411672e-05
+-3.78299999999969 3.11384201634142e-05
+-3.78199999999969 3.12564242722598e-05
+-3.78099999999969 3.1374844202013e-05
+-3.77999999999969 3.1493681290789e-05
+-3.77899999999969 3.16129368805182e-05
+-3.77799999999969 3.1732612316955e-05
+-3.77699999999969 3.18527089496874e-05
+-3.77599999999969 3.19732281321456e-05
+-3.77499999999969 3.20941712216115e-05
+-3.77399999999969 3.22155395792273e-05
+-3.77299999999969 3.23373345700054e-05
+-3.77199999999969 3.2459557562837e-05
+-3.77099999999969 3.25822099305014e-05
+-3.76999999999969 3.27052930496755e-05
+-3.76899999999969 3.28288083009424e-05
+-3.76799999999969 3.29527570688012e-05
+-3.76699999999969 3.30771407416759e-05
+-3.76599999999969 3.3201960711925e-05
+-3.76499999999969 3.33272183758503e-05
+-3.76399999999969 3.34529151337064e-05
+-3.76299999999969 3.35790523897103e-05
+-3.76199999999969 3.37056315520503e-05
+-3.76099999999969 3.38326540328953e-05
+-3.75999999999969 3.39601212484047e-05
+-3.75899999999969 3.4088034618737e-05
+-3.75799999999969 3.42163955680599e-05
+-3.75699999999969 3.43452055245591e-05
+-3.75599999999969 3.44744659204481e-05
+-3.75499999999969 3.46041781919774e-05
+-3.75399999999969 3.47343437794442e-05
+-3.75299999999969 3.48649641272014e-05
+-3.75199999999969 3.49960406836676e-05
+-3.75099999999969 3.51275749013362e-05
+-3.74999999999969 3.5259568236785e-05
+-3.74899999999969 3.53920221506859e-05
+-3.74799999999969 3.55249381078141e-05
+-3.74699999999969 3.56583175770579e-05
+-3.74599999999969 3.57921620314282e-05
+-3.74499999999969 3.59264729480679e-05
+-3.74399999999969 3.6061251808262e-05
+-3.74299999999969 3.61965000974464e-05
+-3.74199999999969 3.63322193052182e-05
+-3.7409999999997 3.64684109253452e-05
+-3.7399999999997 3.66050764557753e-05
+-3.7389999999997 3.67422173986463e-05
+-3.7379999999997 3.68798352602957e-05
+-3.7369999999997 3.70179315512703e-05
+-3.7359999999997 3.71565077863359e-05
+-3.7349999999997 3.72955654844871e-05
+-3.7339999999997 3.74351061689567e-05
+-3.7329999999997 3.75751313672262e-05
+-3.7319999999997 3.77156426110348e-05
+-3.7309999999997 3.78566414363895e-05
+-3.7299999999997 3.79981293835752e-05
+-3.7289999999997 3.81401079971639e-05
+-3.7279999999997 3.8282578826025e-05
+-3.7269999999997 3.8425543423335e-05
+-3.7259999999997 3.85690033465875e-05
+-3.7249999999997 3.87129601576026e-05
+-3.7239999999997 3.88574154225377e-05
+-3.7229999999997 3.90023707118964e-05
+-3.7219999999997 3.9147827600539e-05
+-3.7209999999997 3.92937876676924e-05
+-3.7199999999997 3.94402524969601e-05
+-3.7189999999997 3.95872236763317e-05
+-3.7179999999997 3.97347027981937e-05
+-3.7169999999997 3.98826914593387e-05
+-3.7159999999997 4.00311912609759e-05
+-3.7149999999997 4.01802038087409e-05
+-3.7139999999997 4.03297307127059e-05
+-3.7129999999997 4.04797735873898e-05
+-3.7119999999997 4.06303340517681e-05
+-3.7109999999997 4.0781413729283e-05
+-3.7099999999997 4.09330142478537e-05
+-3.7089999999997 4.10851372398862e-05
+-3.7079999999997 4.1237784342284e-05
+-3.7069999999997 4.13909571964577e-05
+-3.7059999999997 4.15446574483351e-05
+-3.7049999999997 4.16988867483722e-05
+-3.7039999999997 4.18536467515624e-05
+-3.7029999999997 4.20089391174473e-05
+-3.7019999999997 4.21647655101268e-05
+-3.7009999999997 4.23211275982695e-05
+-3.6999999999997 4.24780270551224e-05
+-3.6989999999997 4.2635465558522e-05
+-3.6979999999997 4.27934447909038e-05
+-3.6969999999997 4.29519664393131e-05
+-3.6959999999997 4.31110321954154e-05
+-3.6949999999997 4.32706437555062e-05
+-3.6939999999997 4.34308028205218e-05
+-3.6929999999997 4.35915110960495e-05
+-3.6919999999997 4.3752770292338e-05
+-3.6909999999997 4.39145821243079e-05
+-3.6899999999997 4.40769483115619e-05
+-3.6889999999997 4.42398705783955e-05
+-3.6879999999997 4.4403350653807e-05
+-3.6869999999997 4.45673902715085e-05
+-3.6859999999997 4.47319911699361e-05
+-3.6849999999997 4.48971550922602e-05
+-3.6839999999997 4.50628837863964e-05
+-3.6829999999997 4.52291790050156e-05
+-3.6819999999997 4.5396042505555e-05
+-3.6809999999997 4.55634760502282e-05
+-3.6799999999997 4.57314814060359e-05
+-3.6789999999997 4.59000603447767e-05
+-3.6779999999997 4.60692146430574e-05
+-3.6769999999997 4.62389460823038e-05
+-3.6759999999997 4.6409256448771e-05
+-3.6749999999997 4.65801475335546e-05
+-3.6739999999997 4.67516211326009e-05
+-3.6729999999997 4.69236790467175e-05
+-3.6719999999997 4.70963230815844e-05
+-3.6709999999997 4.72695550477644e-05
+-3.6699999999997 4.74433767607138e-05
+-3.6689999999997 4.76177900407933e-05
+-3.6679999999997 4.77927967132785e-05
+-3.6669999999997 4.7968398608371e-05
+-3.6659999999997 4.81445975612088e-05
+-3.6649999999997 4.83213954118772e-05
+-3.6639999999997 4.84987940054197e-05
+-3.6629999999997 4.86767951918489e-05
+-3.6619999999997 4.88554008261569e-05
+-3.6609999999997 4.90346127683267e-05
+-3.6599999999997 4.92144328833427e-05
+-3.6589999999997 4.93948630412015e-05
+-3.6579999999997 4.95759051169231e-05
+-3.6569999999997 4.97575609905616e-05
+-3.6559999999997 4.99398325472163e-05
+-3.6549999999997 5.01227216770423e-05
+-3.6539999999997 5.03062302752617e-05
+-3.6529999999997 5.04903602421746e-05
+-3.6519999999997 5.06751134831699e-05
+-3.6509999999997 5.08604919087363e-05
+-3.64999999999971 5.10464974344735e-05
+-3.64899999999971 5.12331319811031e-05
+-3.64799999999971 5.14203974744796e-05
+-3.64699999999971 5.16082958456015e-05
+-3.64599999999971 5.17968290306221e-05
+-3.64499999999971 5.19859989708613e-05
+-3.64399999999971 5.21758076128159e-05
+-3.64299999999971 5.23662569081711e-05
+-3.64199999999971 5.25573488138113e-05
+-3.64099999999971 5.27490852918321e-05
+-3.63999999999971 5.29414683095501e-05
+-3.63899999999971 5.31344998395154e-05
+-3.63799999999971 5.33281818595218e-05
+-3.63699999999971 5.35225163526186e-05
+-3.63599999999971 5.37175053071215e-05
+-3.63499999999971 5.39131507166238e-05
+-3.63399999999971 5.4109454580008e-05
+-3.63299999999971 5.43064189014566e-05
+-3.63199999999971 5.45040456904636e-05
+-3.63099999999971 5.47023369618459e-05
+-3.62999999999971 5.49012947357542e-05
+-3.62899999999971 5.51009210376848e-05
+-3.62799999999971 5.53012178984905e-05
+-3.62699999999971 5.55021873543923e-05
+-3.62599999999971 5.57038314469903e-05
+-3.62499999999971 5.59061522232757e-05
+-3.62399999999971 5.61091517356415e-05
+-3.62299999999971 5.63128320418945e-05
+-3.62199999999971 5.65171952052662e-05
+-3.62099999999971 5.67222432944246e-05
+-3.61999999999971 5.69279783834854e-05
+-3.61899999999971 5.71344025520236e-05
+-3.61799999999971 5.7341517885085e-05
+-3.61699999999971 5.75493264731975e-05
+-3.61599999999971 5.77578304123827e-05
+-3.61499999999971 5.79670318041674e-05
+-3.61399999999971 5.81769327555952e-05
+-3.61299999999971 5.83875353792379e-05
+-3.61199999999971 5.85988417932072e-05
+-3.61099999999971 5.8810854121166e-05
+-3.60999999999971 5.90235744923405e-05
+-3.60899999999971 5.92370050415311e-05
+-3.60799999999971 5.94511479091246e-05
+-3.60699999999971 5.96660052411055e-05
+-3.60599999999971 5.98815791890679e-05
+-3.60499999999971 6.00978719102267e-05
+-3.60399999999971 6.03148855674298e-05
+-3.60299999999971 6.05326223291693e-05
+-3.60199999999971 6.07510843695937e-05
+-3.60099999999971 6.0970273868519e-05
+-3.59999999999971 6.1190193011441e-05
+-3.59899999999971 6.14108439895466e-05
+-3.59799999999971 6.1632228999726e-05
+-3.59699999999971 6.18543502445838e-05
+-3.59599999999971 6.20772099324515e-05
+-3.59499999999971 6.23008102773988e-05
+-3.59399999999971 6.25251534992454e-05
+-3.59299999999971 6.27502418235734e-05
+-3.59199999999971 6.29760774817382e-05
+-3.59099999999971 6.32026627108813e-05
+-3.58999999999971 6.34299997539414e-05
+-3.58899999999971 6.36580908596667e-05
+-3.58799999999971 6.38869382826265e-05
+-3.58699999999971 6.41165442832236e-05
+-3.58599999999971 6.43469111277056e-05
+-3.58499999999971 6.4578041088177e-05
+-3.58399999999971 6.48099364426116e-05
+-3.58299999999971 6.50425994748637e-05
+-3.58199999999971 6.52760324746808e-05
+-3.58099999999971 6.5510237737715e-05
+-3.57999999999971 6.57452175655353e-05
+-3.57899999999971 6.59809742656394e-05
+-3.57799999999971 6.62175101514662e-05
+-3.57699999999971 6.64548275424071e-05
+-3.57599999999971 6.66929287638187e-05
+-3.57499999999971 6.69318161470344e-05
+-3.57399999999971 6.71714920293768e-05
+-3.57299999999971 6.74119587541696e-05
+-3.57199999999971 6.76532186707497e-05
+-3.57099999999971 6.78952741344795e-05
+-3.56999999999971 6.81381275067588e-05
+-3.56899999999971 6.8381781155037e-05
+-3.56799999999971 6.86262374528253e-05
+-3.56699999999971 6.88714987797088e-05
+-3.56599999999971 6.9117567521359e-05
+-3.56499999999971 6.93644460695452e-05
+-3.56399999999971 6.96121368221477e-05
+-3.56299999999971 6.98606421831694e-05
+-3.56199999999971 7.01099645627479e-05
+-3.56099999999971 7.03601063771684e-05
+-3.55999999999971 7.06110700488753e-05
+-3.55899999999972 7.08628580064848e-05
+-3.55799999999972 7.11154726847973e-05
+-3.55699999999972 7.13689165248093e-05
+-3.55599999999972 7.16231919737258e-05
+-3.55499999999972 7.1878301484973e-05
+-3.55399999999972 7.21342475182104e-05
+-3.55299999999972 7.23910325393429e-05
+-3.55199999999972 7.26486590205335e-05
+-3.55099999999972 7.29071294402154e-05
+-3.54999999999972 7.31664462831048e-05
+-3.54899999999972 7.34266120402129e-05
+-3.54799999999972 7.36876292088582e-05
+-3.54699999999972 7.39495002926796e-05
+-3.54599999999972 7.4212227801648e-05
+-3.54499999999972 7.44758142520795e-05
+-3.54399999999972 7.47402621666471e-05
+-3.54299999999972 7.50055740743938e-05
+-3.54199999999972 7.52717525107448e-05
+-3.54099999999972 7.55388000175201e-05
+-3.53999999999972 7.5806719142947e-05
+-3.53899999999972 7.60755124416723e-05
+-3.53799999999972 7.63451824747754e-05
+-3.53699999999972 7.66157318097805e-05
+-3.53599999999972 7.68871630206691e-05
+-3.53499999999972 7.71594786878927e-05
+-3.53399999999972 7.74326813983854e-05
+-3.53299999999972 7.77067737455765e-05
+-3.53199999999972 7.79817583294031e-05
+-3.53099999999972 7.82576377563225e-05
+-3.52999999999972 7.8534414639325e-05
+-3.52899999999972 7.88120915979469e-05
+-3.52799999999972 7.90906712582824e-05
+-3.52699999999972 7.93701562529967e-05
+-3.52599999999972 7.96505492213391e-05
+-3.52499999999972 7.99318528091546e-05
+-3.52399999999972 8.02140696688977e-05
+-3.52299999999972 8.04972024596445e-05
+-3.52199999999972 8.07812538471055e-05
+-3.52099999999972 8.10662265036385e-05
+-3.51999999999972 8.13521231082612e-05
+-3.51899999999972 8.16389463466641e-05
+-3.51799999999972 8.19266989112231e-05
+-3.51699999999972 8.22153835010124e-05
+-3.51599999999972 8.25050028218173e-05
+-3.51499999999972 8.2795559586147e-05
+-3.51399999999972 8.30870565132472e-05
+-3.51299999999972 8.33794963291132e-05
+-3.51199999999972 8.36728817665029e-05
+-3.51099999999972 8.39672155649491e-05
+-3.50999999999972 8.42625004707729e-05
+-3.50899999999972 8.4558739237096e-05
+-3.50799999999972 8.48559346238542e-05
+-3.50699999999972 8.51540893978101e-05
+-3.50599999999972 8.54532063325656e-05
+-3.50499999999972 8.57532882085755e-05
+-3.50399999999972 8.60543378131599e-05
+-3.50299999999972 8.63563579405172e-05
+-3.50199999999972 8.66593513917375e-05
+-3.50099999999972 8.69633209748149e-05
+-3.49999999999972 8.72682695046611e-05
+-3.49899999999972 8.75741998031177e-05
+-3.49799999999972 8.788111469897e-05
+-3.49699999999972 8.81890170279595e-05
+-3.49599999999972 8.84979096327966e-05
+-3.49499999999972 8.88077953631745e-05
+-3.49399999999972 8.91186770757817e-05
+-3.49299999999972 8.9430557634315e-05
+-3.49199999999972 8.97434399094926e-05
+-3.49099999999972 9.00573267790674e-05
+-3.48999999999972 9.03722211278399e-05
+-3.48899999999972 9.06881258476714e-05
+-3.48799999999972 9.10050438374969e-05
+-3.48699999999972 9.13229780033382e-05
+-3.48599999999972 9.16419312583174e-05
+-3.48499999999972 9.19619065226696e-05
+-3.48399999999972 9.22829067237564e-05
+-3.48299999999972 9.26049347960788e-05
+-3.48199999999972 9.29279936812905e-05
+-3.48099999999972 9.32520863282106e-05
+-3.47999999999972 9.3577215692838e-05
+-3.47899999999972 9.39033847383629e-05
+-3.47799999999972 9.42305964351816e-05
+-3.47699999999972 9.45588537609085e-05
+-3.47599999999972 9.48881597003902e-05
+-3.47499999999972 9.52185172457182e-05
+-3.47399999999972 9.55499293962422e-05
+-3.47299999999972 9.58823991585835e-05
+-3.47199999999972 9.62159295466484e-05
+-3.47099999999972 9.65505235816411e-05
+-3.46999999999972 9.68861842920771e-05
+-3.46899999999972 9.72229147137968e-05
+-3.46799999999973 9.75607178899784e-05
+-3.46699999999973 9.78995968711513e-05
+-3.46599999999973 9.82395547152096e-05
+-3.46499999999973 9.85805944874253e-05
+-3.46399999999973 9.89227192604616e-05
+-3.46299999999973 9.92659321143864e-05
+-3.46199999999973 9.96102361366853e-05
+-3.46099999999973 9.99556344222756e-05
+-3.45999999999973 0.000100302130073519
+-3.45899999999973 0.000100649726200235
+-3.45799999999973 0.000100998425919716
+-3.45699999999973 0.000101348232356737
+-3.45599999999973 0.000101699148643573
+-3.45499999999973 0.00010205117792001
+-3.45399999999973 0.000102404323333359
+-3.45299999999973 0.000102758588038471
+-3.45199999999973 0.000103113975197747
+-3.45099999999973 0.000103470487981154
+-3.44999999999973 0.000103828129566239
+-3.44899999999973 0.00010418690313814
+-3.44799999999973 0.000104546811889603
+-3.44699999999973 0.00010490785902099
+-3.44599999999973 0.000105270047740299
+-3.44499999999973 0.000105633381263173
+-3.44399999999973 0.000105997862812915
+-3.44299999999973 0.000106363495620501
+-3.44199999999973 0.000106730282924594
+-3.44099999999973 0.000107098227971559
+-3.43999999999973 0.000107467334015474
+-3.43899999999973 0.000107837604318144
+-3.43799999999973 0.000108209042149114
+-3.43699999999973 0.000108581650785688
+-3.43599999999973 0.000108955433512934
+-3.43499999999973 0.000109330393623704
+-3.43399999999973 0.000109706534418645
+-3.43299999999973 0.000110083859206213
+-3.43199999999973 0.000110462371302686
+-3.43099999999973 0.00011084207403218
+-3.42999999999973 0.00011122297072666
+-3.42899999999973 0.000111605064725953
+-3.42799999999973 0.000111988359377766
+-3.42699999999973 0.000112372858037696
+-3.42599999999973 0.000112758564069242
+-3.42499999999973 0.000113145480843826
+-3.42399999999973 0.000113533611740796
+-3.42299999999973 0.000113922960147451
+-3.42199999999973 0.000114313529459045
+-3.42099999999973 0.000114705323078808
+-3.41999999999973 0.000115098344417955
+-3.41899999999973 0.0001154925968957
+-3.41799999999973 0.000115888083939274
+-3.41699999999973 0.000116284808983934
+-3.41599999999973 0.000116682775472978
+-3.41499999999973 0.00011708198685776
+-3.41399999999973 0.000117482446597703
+-3.41299999999973 0.000117884158160313
+-3.41199999999973 0.00011828712502119
+-3.41099999999973 0.000118691350664048
+-3.40999999999973 0.000119096838580721
+-3.40899999999973 0.000119503592271183
+-3.40799999999973 0.000119911615243561
+-3.40699999999973 0.000120320911014142
+-3.40599999999973 0.000120731483107399
+-3.40499999999973 0.000121143335055991
+-3.40399999999973 0.000121556470400788
+-3.40299999999973 0.000121970892690881
+-3.40199999999973 0.000122386605483591
+-3.40099999999973 0.000122803612344491
+-3.39999999999973 0.000123221916847414
+-3.39899999999973 0.00012364152257447
+-3.39799999999973 0.000124062433116058
+-3.39699999999973 0.000124484652070879
+-3.39599999999973 0.000124908183045955
+-3.39499999999973 0.000125333029656634
+-3.39399999999973 0.000125759195526614
+-3.39299999999973 0.000126186684287948
+-3.39199999999973 0.000126615499581064
+-3.39099999999973 0.000127045645054776
+-3.38999999999973 0.000127477124366298
+-3.38899999999973 0.00012790994118126
+-3.38799999999973 0.000128344099173717
+-3.38699999999973 0.000128779602026169
+-3.38599999999973 0.000129216453429571
+-3.38499999999973 0.000129654657083348
+-3.38399999999973 0.00013009421669541
+-3.38299999999973 0.000130535135982163
+-3.38199999999973 0.000130977418668525
+-3.38099999999973 0.00013142106848794
+-3.37999999999973 0.000131866089182392
+-3.37899999999973 0.000132312484502419
+-3.37799999999973 0.000132760258207124
+-3.37699999999974 0.000133209414064193
+-3.37599999999974 0.000133659955849907
+-3.37499999999974 0.000134111887349158
+-3.37399999999974 0.000134565212355457
+-3.37299999999974 0.000135019934670956
+-3.37199999999974 0.000135476058106458
+-3.37099999999974 0.000135933586481428
+-3.36999999999974 0.000136392523624012
+-3.36899999999974 0.00013685287337105
+-3.36799999999974 0.000137314639568087
+-3.36699999999974 0.000137777826069391
+-3.36599999999974 0.000138242436737963
+-3.36499999999974 0.000138708475445554
+-3.36399999999974 0.000139175946072677
+-3.36299999999974 0.000139644852508625
+-3.36199999999974 0.000140115198651477
+-3.36099999999974 0.000140586988408122
+-3.35999999999974 0.000141060225694263
+-3.35899999999974 0.00014153491443444
+-3.35799999999974 0.000142011058562038
+-3.35699999999974 0.000142488662019303
+-3.35599999999974 0.000142967728757356
+-3.35499999999974 0.000143448262736208
+-3.35399999999974 0.000143930267924772
+-3.35299999999974 0.000144413748300878
+-3.35199999999974 0.000144898707851288
+-3.35099999999974 0.000145385150571708
+-3.34999999999974 0.000145873080466803
+-3.34899999999974 0.000146362501550212
+-3.34799999999974 0.00014685341784456
+-3.34699999999974 0.000147345833381476
+-3.34599999999974 0.0001478397522016
+-3.34499999999974 0.000148335178354606
+-3.34399999999974 0.000148832115899206
+-3.34299999999974 0.000149330568903174
+-3.34199999999974 0.000149830541443354
+-3.34099999999974 0.000150332037605673
+-3.33999999999974 0.000150835061485162
+-3.33899999999974 0.000151339617185962
+-3.33799999999974 0.000151845708821342
+-3.33699999999974 0.000152353340513715
+-3.33599999999974 0.000152862516394647
+-3.33499999999974 0.000153373240604875
+-3.33399999999974 0.00015388551729432
+-3.33299999999974 0.000154399350622101
+-3.33199999999974 0.000154914744756547
+-3.33099999999974 0.000155431703875216
+-3.32999999999974 0.000155950232164904
+-3.32899999999974 0.000156470333821662
+-3.32799999999974 0.000156992013050808
+-3.32699999999974 0.000157515274066943
+-3.32599999999974 0.000158040121093965
+-3.32499999999974 0.000158566558365082
+-3.32399999999974 0.000159094590122826
+-3.32299999999974 0.000159624220619067
+-3.32199999999974 0.000160155454115028
+-3.32099999999974 0.000160688294881299
+-3.31999999999974 0.000161222747197851
+-3.31899999999974 0.000161758815354048
+-3.31799999999974 0.000162296503648665
+-3.31699999999974 0.000162835816389898
+-3.31599999999974 0.000163376757895381
+-3.31499999999974 0.000163919332492198
+-3.31399999999974 0.000164463544516899
+-3.31299999999974 0.000165009398315513
+-3.31199999999974 0.000165556898243562
+-3.31099999999974 0.000166106048666074
+-3.30999999999974 0.0001666568539576
+-3.30899999999974 0.000167209318502226
+-3.30799999999974 0.000167763446693586
+-3.30699999999974 0.000168319242934878
+-3.30599999999974 0.00016887671163888
+-3.30499999999974 0.000169435857227957
+-3.30399999999974 0.000169996684134083
+-3.30299999999974 0.00017055919679885
+-3.30199999999974 0.000171123399673485
+-3.30099999999974 0.000171689297218861
+-3.29999999999974 0.000172256893905514
+-3.29899999999974 0.000172826194213655
+-3.29799999999974 0.000173397202633185
+-3.29699999999974 0.00017396992366371
+-3.29599999999974 0.000174544361814552
+-3.29499999999974 0.000175120521604766
+-3.29399999999974 0.000175698407563154
+-3.29299999999974 0.000176278024228274
+-3.29199999999974 0.000176859376148463
+-3.29099999999974 0.000177442467881842
+-3.28999999999974 0.000178027303996337
+-3.28899999999974 0.000178613889069689
+-3.28799999999974 0.000179202227689468
+-3.28699999999975 0.000179792324453088
+-3.28599999999975 0.000180384183967824
+-3.28499999999975 0.00018097781085082
+-3.28399999999975 0.000181573209729107
+-3.28299999999975 0.000182170385239615
+-3.28199999999975 0.000182769342029192
+-3.28099999999975 0.000183370084754609
+-3.27999999999975 0.000183972618082581
+-3.27899999999975 0.000184576946689781
+-3.27799999999975 0.000185183075262849
+-3.27699999999975 0.000185791008498411
+-3.27599999999975 0.00018640075110309
+-3.27499999999975 0.00018701230779352
+-3.27399999999975 0.000187625683296363
+-3.27299999999975 0.00018824088234832
+-3.27199999999975 0.000188857909696144
+-3.27099999999975 0.000189476770096658
+-3.26999999999975 0.000190097468316765
+-3.26899999999975 0.000190720009133466
+-3.26799999999975 0.000191344397333869
+-3.26699999999975 0.000191970637715206
+-3.26599999999975 0.000192598735084847
+-3.26499999999975 0.000193228694260314
+-3.26399999999975 0.000193860520069291
+-3.26299999999975 0.000194494217349646
+-3.26199999999975 0.000195129790949435
+-3.26099999999975 0.000195767245726924
+-3.25999999999975 0.000196406586550599
+-3.25899999999975 0.000197047818299181
+-3.25799999999975 0.000197690945861639
+-3.25699999999975 0.000198335974137204
+-3.25599999999975 0.000198982908035385
+-3.25499999999975 0.000199631752475979
+-3.25399999999975 0.000200282512389089
+-3.25299999999975 0.000200935192715135
+-3.25199999999975 0.000201589798404868
+-3.25099999999975 0.000202246334419385
+-3.24999999999975 0.000202904805730142
+-3.24899999999975 0.00020356521731897
+-3.24799999999975 0.000204227574178085
+-3.24699999999975 0.000204891881310105
+-3.24599999999975 0.000205558143728061
+-3.24499999999975 0.000206226366455413
+-3.24399999999975 0.000206896554526065
+-3.24299999999975 0.000207568712984375
+-3.24199999999975 0.000208242846885171
+-3.24099999999975 0.000208918961293764
+-3.23999999999975 0.000209597061285964
+-3.23899999999975 0.00021027715194809
+-3.23799999999975 0.000210959238376987
+-3.23699999999975 0.000211643325680038
+-3.23599999999975 0.000212329418975178
+-3.23499999999975 0.000213017523390908
+-3.23399999999975 0.000213707644066308
+-3.23299999999975 0.000214399786151053
+-3.23199999999975 0.000215093954805424
+-3.23099999999975 0.000215790155200321
+-3.22999999999975 0.00021648839251728
+-3.22899999999975 0.000217188671948486
+-3.22799999999975 0.000217890998696783
+-3.22699999999975 0.000218595377975693
+-3.22599999999975 0.000219301815009424
+-3.22499999999975 0.000220010315032889
+-3.22399999999975 0.000220720883291716
+-3.22299999999975 0.000221433525042263
+-3.22199999999975 0.000222148245551631
+-3.22099999999975 0.000222865050097677
+-3.21999999999975 0.000223583943969032
+-3.21899999999975 0.000224304932465107
+-3.21799999999975 0.000225028020896113
+-3.21699999999975 0.000225753214583072
+-3.21599999999975 0.000226480518857828
+-3.21499999999975 0.000227209939063067
+-3.21399999999975 0.000227941480552325
+-3.21299999999975 0.000228675148690003
+-3.21199999999975 0.000229410948851382
+-3.21099999999975 0.000230148886422632
+-3.20999999999975 0.000230888966800832
+-3.20899999999975 0.00023163119539398
+-3.20799999999975 0.000232375577621004
+-3.20699999999975 0.00023312211891178
+-3.20599999999975 0.000233870824707143
+-3.20499999999975 0.000234621700458901
+-3.20399999999975 0.000235374751629848
+-3.20299999999975 0.000236129983693778
+-3.20199999999975 0.000236887402135496
+-3.20099999999975 0.000237647012450836
+-3.19999999999975 0.000238408820146671
+-3.19899999999975 0.000239172830740927
+-3.19799999999975 0.000239939049762595
+-3.19699999999975 0.000240707482751747
+-3.19599999999976 0.000241478135259547
+-3.19499999999976 0.000242251012848268
+-3.19399999999976 0.000243026121091299
+-3.19299999999976 0.000243803465573164
+-3.19199999999976 0.000244583051889531
+-3.19099999999976 0.00024536488564723
+-3.18999999999976 0.000246148972464262
+-3.18899999999976 0.000246935317969813
+-3.18799999999976 0.000247723927804269
+-3.18699999999976 0.000248514807619229
+-3.18599999999976 0.000249307963077514
+-3.18499999999976 0.000250103399853186
+-3.18399999999976 0.000250901123631559
+-3.18299999999976 0.00025170114010921
+-3.18199999999976 0.000252503454993994
+-3.18099999999976 0.000253308074005057
+-3.17999999999976 0.000254115002872849
+-3.17899999999976 0.000254924247339137
+-3.17799999999976 0.000255735813157019
+-3.17699999999976 0.000256549706090935
+-3.17599999999976 0.00025736593191668
+-3.17499999999976 0.000258184496421421
+-3.17399999999976 0.000259005405403703
+-3.17299999999976 0.000259828664673471
+-3.17199999999976 0.000260654280052074
+-3.17099999999976 0.000261482257372283
+-3.16999999999976 0.000262312602478304
+-3.16899999999976 0.000263145321225788
+-3.16799999999976 0.000263980419481848
+-3.16699999999976 0.000264817903125066
+-3.16599999999976 0.000265657778045513
+-3.16499999999976 0.000266500050144757
+-3.16399999999976 0.000267344725335875
+-3.16299999999976 0.000268191809543471
+-3.16199999999976 0.000269041308703684
+-3.16099999999976 0.000269893228764202
+-3.15999999999976 0.000270747575684276
+-3.15899999999976 0.000271604355434732
+-3.15799999999976 0.000272463573997983
+-3.15699999999976 0.000273325237368042
+-3.15599999999976 0.000274189351550537
+-3.15499999999976 0.000275055922562719
+-3.15399999999976 0.000275924956433478
+-3.15299999999976 0.000276796459203358
+-3.15199999999976 0.000277670436924561
+-3.15099999999976 0.000278546895660971
+-3.14999999999976 0.000279425841488156
+-3.14899999999976 0.000280307280493388
+-3.14799999999976 0.000281191218775651
+-3.14699999999976 0.000282077662445658
+-3.14599999999976 0.000282966617625858
+-3.14499999999976 0.000283858090450453
+-3.14399999999976 0.000284752087065408
+-3.14299999999976 0.000285648613628465
+-3.14199999999976 0.000286547676309153
+-3.14099999999976 0.000287449281288803
+-3.13999999999976 0.00028835343476056
+-3.13899999999976 0.000289260142929394
+-3.13799999999976 0.000290169412012114
+-3.13699999999976 0.000291081248237378
+-3.13599999999976 0.000291995657845707
+-3.13499999999976 0.000292912647089499
+-3.13399999999976 0.000293832222233035
+-3.13299999999976 0.0002947543895525
+-3.13199999999976 0.000295679155335989
+-3.13099999999976 0.000296606525883519
+-3.12999999999976 0.000297536507507047
+-3.12899999999976 0.000298469106530473
+-3.12799999999976 0.000299404329289663
+-3.12699999999976 0.000300342182132451
+-3.12599999999976 0.000301282671418658
+-3.12499999999976 0.0003022258035201
+-3.12399999999976 0.000303171584820602
+-3.12299999999976 0.000304120021716012
+-3.12199999999976 0.000305071120614206
+-3.12099999999976 0.00030602488793511
+-3.11999999999976 0.000306981330110701
+-3.11899999999976 0.000307940453585028
+-3.11799999999976 0.000308902264814221
+-3.11699999999976 0.0003098667702665
+-3.11599999999976 0.000310833976422189
+-3.11499999999976 0.00031180388977373
+-3.11399999999976 0.000312776516825691
+-3.11299999999976 0.00031375186409478
+-3.11199999999976 0.000314729938109858
+-3.11099999999976 0.000315710745411945
+-3.10999999999976 0.00031669429255424
+-3.10899999999976 0.000317680586102125
+-3.10799999999976 0.000318669632633184
+-3.10699999999976 0.000319661438737206
+-3.10599999999976 0.000320656011016206
+-3.10499999999977 0.000321653356084427
+-3.10399999999977 0.000322653480568361
+-3.10299999999977 0.000323656391106754
+-3.10199999999977 0.00032466209435062
+-3.10099999999977 0.00032567059696325
+-3.09999999999977 0.00032668190562023
+-3.09899999999977 0.000327696027009442
+-3.09799999999977 0.000328712967831086
+-3.09699999999977 0.000329732734797686
+-3.09599999999977 0.0003307553346341
+-3.09499999999977 0.000331780774077535
+-3.09399999999977 0.000332809059877555
+-3.09299999999977 0.000333840198796098
+-3.09199999999977 0.000334874197607478
+-3.09099999999977 0.000335911063098405
+-3.08999999999977 0.000336950802067991
+-3.08899999999977 0.000337993421327764
+-3.08799999999977 0.000339038927701677
+-3.08699999999977 0.00034008732802612
+-3.08599999999977 0.000341138629149932
+-3.08499999999977 0.00034219283793441
+-3.08399999999977 0.000343249961253322
+-3.08299999999977 0.000344310005992917
+-3.08199999999977 0.000345372979051937
+-3.08099999999977 0.000346438887341626
+-3.07999999999977 0.000347507737785742
+-3.07899999999977 0.000348579537320569
+-3.07799999999977 0.000349654292894925
+-3.07699999999977 0.000350732011470177
+-3.07599999999977 0.000351812700020247
+-3.07499999999977 0.000352896365531628
+-3.07399999999977 0.000353983015003388
+-3.07299999999977 0.000355072655447187
+-3.07199999999977 0.000356165293887287
+-3.07099999999977 0.000357260937360557
+-3.06999999999977 0.00035835959291649
+-3.06899999999977 0.000359461267617212
+-3.06799999999977 0.000360565968537488
+-3.06699999999977 0.000361673702764741
+-3.06599999999977 0.000362784477399053
+-3.06499999999977 0.000363898299553184
+-3.06399999999977 0.000365015176352576
+-3.06299999999977 0.000366135114935368
+-3.06199999999977 0.000367258122452403
+-3.06099999999977 0.00036838420606724
+-3.05999999999977 0.000369513372956163
+-3.05899999999977 0.000370645630308196
+-3.05799999999977 0.000371780985325103
+-3.05699999999977 0.000372919445221412
+-3.05599999999977 0.000374061017224413
+-3.05499999999977 0.000375205708574174
+-3.05399999999977 0.000376353526523551
+-3.05299999999977 0.000377504478338197
+-3.05199999999977 0.000378658571296573
+-3.05099999999977 0.000379815812689954
+-3.04999999999977 0.000380976209822447
+-3.04899999999977 0.000382139770010992
+-3.04799999999977 0.000383306500585378
+-3.04699999999977 0.000384476408888252
+-3.04599999999977 0.000385649502275126
+-3.04499999999977 0.000386825788114389
+-3.04399999999977 0.000388005273787316
+-3.04299999999977 0.00038918796668808
+-3.04199999999977 0.000390373874223757
+-3.04099999999977 0.000391563003814341
+-3.03999999999977 0.00039275536289275
+-3.03899999999977 0.000393950958904836
+-3.03799999999977 0.000395149799309397
+-3.03699999999977 0.000396351891578183
+-3.03599999999977 0.000397557243195909
+-3.03499999999977 0.00039876586166026
+-3.03399999999977 0.000399977754481907
+-3.03299999999977 0.000401192929184509
+-3.03199999999977 0.000402411393304728
+-3.03099999999977 0.000403633154392235
+-3.02999999999977 0.000404858220009721
+-3.02899999999977 0.000406086597732905
+-3.02799999999977 0.000407318295150546
+-3.02699999999977 0.000408553319864447
+-3.02599999999977 0.000409791679489469
+-3.02499999999977 0.000411033381653537
+-3.02399999999977 0.000412278433997652
+-3.02299999999977 0.000413526844175897
+-3.02199999999977 0.000414778619855447
+-3.02099999999977 0.00041603376871658
+-3.01999999999977 0.000417292298452681
+-3.01899999999977 0.000418554216770256
+-3.01799999999977 0.000419819531388939
+-3.01699999999977 0.000421088250041499
+-3.01599999999977 0.000422360380473852
+-3.01499999999977 0.000423635930445067
+-3.01399999999978 0.000424914907727374
+-3.01299999999978 0.000426197320106177
+-3.01199999999978 0.000427483175380058
+-3.01099999999978 0.000428772481360789
+-3.00999999999978 0.000430065245873335
+-3.00899999999978 0.000431361476755871
+-3.00799999999978 0.000432661181859784
+-3.00699999999978 0.00043396436904968
+-3.00599999999978 0.0004352710462034
+-3.00499999999978 0.000436581221212021
+-3.00399999999978 0.000437894901979867
+-3.00299999999978 0.000439212096424519
+-3.00199999999978 0.000440532812476818
+-3.00099999999978 0.00044185705808088
+-2.99999999999978 0.000443184841194098
+-2.99899999999978 0.000444516169787153
+-2.99799999999978 0.000445851051844023
+-2.99699999999978 0.000447189495361987
+-2.99599999999978 0.000448531508351639
+-2.99499999999978 0.000449877098836888
+-2.99399999999978 0.000451226274854973
+-2.99299999999978 0.000452579044456467
+-2.99199999999978 0.000453935415705285
+-2.99099999999978 0.000455295396678694
+-2.98999999999978 0.000456658995467318
+-2.98899999999978 0.000458026220175146
+-2.98799999999978 0.000459397078919542
+-2.98699999999978 0.000460771579831248
+-2.98599999999978 0.000462149731054396
+-2.98499999999978 0.000463531540746513
+-2.98399999999978 0.00046491701707853
+-2.98299999999978 0.000466306168234787
+-2.98199999999978 0.000467699002413042
+-2.98099999999978 0.000469095527824477
+-2.97999999999978 0.000470495752693708
+-2.97899999999978 0.000471899685258789
+-2.97799999999978 0.000473307333771221
+-2.97699999999978 0.000474718706495958
+-2.97599999999978 0.000476133811711413
+-2.97499999999978 0.000477552657709469
+-2.97399999999978 0.000478975252795483
+-2.97299999999978 0.00048040160528829
+-2.97199999999978 0.000481831723520217
+-2.97099999999978 0.000483265615837083
+-2.96999999999978 0.000484703290598212
+-2.96899999999978 0.000486144756176431
+-2.96799999999978 0.000487590020958088
+-2.96699999999978 0.000489039093343048
+-2.96599999999978 0.000490491981744706
+-2.96499999999978 0.00049194869458999
+-2.96399999999978 0.000493409240319371
+-2.96299999999978 0.000494873627386867
+-2.96199999999978 0.000496341864260049
+-2.96099999999978 0.000497813959420048
+-2.95999999999978 0.000499289921361561
+-2.95899999999978 0.00050076975859286
+-2.95799999999978 0.000502253479635793
+-2.95699999999978 0.000503741093025794
+-2.95599999999978 0.000505232607311888
+-2.95499999999978 0.000506728031056696
+-2.95399999999978 0.000508227372836442
+-2.95299999999978 0.000509730641240959
+-2.95199999999978 0.000511237844873696
+-2.95099999999978 0.000512748992351719
+-2.94999999999978 0.000514264092305725
+-2.94899999999978 0.000515783153380037
+-2.94799999999978 0.000517306184232621
+-2.94699999999978 0.000518833193535082
+-2.94599999999978 0.000520364189972677
+-2.94499999999978 0.000521899182244313
+-2.94399999999978 0.000523438179062562
+-2.94299999999978 0.000524981189153656
+-2.94199999999978 0.0005265282212575
+-2.94099999999978 0.000528079284127674
+-2.93999999999978 0.000529634386531439
+-2.93899999999978 0.000531193537249742
+-2.93799999999978 0.000532756745077221
+-2.93699999999978 0.00053432401882221
+-2.93599999999978 0.000535895367306745
+-2.93499999999978 0.000537470799366567
+-2.93399999999978 0.000539050323851129
+-2.93299999999978 0.000540633949623601
+-2.93199999999978 0.000542221685560871
+-2.93099999999978 0.000543813540553555
+-2.92999999999978 0.000545409523505999
+-2.92899999999978 0.000547009643336283
+-2.92799999999978 0.000548613908976227
+-2.92699999999978 0.000550222329371393
+-2.92599999999978 0.000551834913481095
+-2.92499999999978 0.000553451670278398
+-2.92399999999978 0.000555072608750124
+-2.92299999999979 0.000556697737896857
+-2.92199999999979 0.000558327066732946
+-2.92099999999979 0.000559960604286512
+-2.91999999999979 0.000561598359599448
+-2.91899999999979 0.000563240341727427
+-2.91799999999979 0.000564886559739902
+-2.91699999999979 0.000566537022720113
+-2.91599999999979 0.000568191739765092
+-2.91499999999979 0.000569850719985664
+-2.91399999999979 0.000571513972506449
+-2.91299999999979 0.000573181506465872
+-2.91199999999979 0.000574853331016163
+-2.91099999999979 0.000576529455323357
+-2.90999999999979 0.000578209888567307
+-2.90899999999979 0.000579894639941677
+-2.90799999999979 0.000581583718653952
+-2.90699999999979 0.000583277133925441
+-2.90599999999979 0.000584974894991277
+-2.90499999999979 0.000586677011100423
+-2.90399999999979 0.000588383491515674
+-2.90299999999979 0.000590094345513662
+-2.90199999999979 0.000591809582384855
+-2.90099999999979 0.000593529211433567
+-2.89999999999979 0.000595253241977952
+-2.89899999999979 0.000596981683350014
+-2.89799999999979 0.000598714544895608
+-2.89699999999979 0.00060045183597444
+-2.89599999999979 0.000602193565960074
+-2.89499999999979 0.000603939744239931
+-2.89399999999979 0.000605690380215294
+-2.89299999999979 0.00060744548330131
+-2.89199999999979 0.00060920506292699
+-2.89099999999979 0.000610969128535217
+-2.88999999999979 0.000612737689582743
+-2.88899999999979 0.000614510755540193
+-2.88799999999979 0.000616288335892067
+-2.88699999999979 0.000618070440136743
+-2.88599999999979 0.000619857077786482
+-2.88499999999979 0.00062164825836742
+-2.88399999999979 0.000623443991419583
+-2.88299999999979 0.000625244286496879
+-2.88199999999979 0.000627049153167103
+-2.88099999999979 0.000628858601011943
+-2.87999999999979 0.000630672639626974
+-2.87899999999979 0.000632491278621666
+-2.87799999999979 0.000634314527619381
+-2.87699999999979 0.000636142396257378
+-2.87599999999979 0.000637974894186813
+-2.87499999999979 0.000639812031072741
+-2.87399999999979 0.000641653816594116
+-2.87299999999979 0.000643500260443792
+-2.87199999999979 0.000645351372328528
+-2.87099999999979 0.000647207161968985
+-2.86999999999979 0.000649067639099726
+-2.86899999999979 0.000650932813469224
+-2.86799999999979 0.000652802694839855
+-2.86699999999979 0.000654677292987904
+-2.86599999999979 0.000656556617703563
+-2.86499999999979 0.000658440678790932
+-2.86399999999979 0.000660329486068022
+-2.86299999999979 0.000662223049366754
+-2.86199999999979 0.000664121378532958
+-2.86099999999979 0.000666024483426375
+-2.85999999999979 0.000667932373920659
+-2.85899999999979 0.000669845059903374
+-2.85799999999979 0.000671762551275997
+-2.85699999999979 0.000673684857953915
+-2.85599999999979 0.00067561198986643
+-2.85499999999979 0.000677543956956754
+-2.85399999999979 0.000679480769182013
+-2.85299999999979 0.000681422436513243
+-2.85199999999979 0.000683368968935392
+-2.85099999999979 0.000685320376447321
+-2.84999999999979 0.000687276669061802
+-2.84899999999979 0.000689237856805519
+-2.84799999999979 0.000691203949719062
+-2.84699999999979 0.000693174957856937
+-2.84599999999979 0.000695150891287555
+-2.84499999999979 0.000697131760093237
+-2.84399999999979 0.000699117574370212
+-2.84299999999979 0.000701108344228617
+-2.84199999999979 0.000703104079792494
+-2.84099999999979 0.00070510479119979
+-2.83999999999979 0.000707110488602358
+-2.83899999999979 0.000709121182165953
+-2.83799999999979 0.000711136882070231
+-2.83699999999979 0.000713157598508752
+-2.83599999999979 0.000715183341688972
+-2.83499999999979 0.000717214121832246
+-2.83399999999979 0.000719249949173826
+-2.8329999999998 0.00072129083396286
+-2.8319999999998 0.000723336786462388
+-2.8309999999998 0.000725387816949342
+-2.8299999999998 0.000727443935714543
+-2.8289999999998 0.000729505153062703
+-2.8279999999998 0.000731571479312418
+-2.8269999999998 0.000733642924796168
+-2.8259999999998 0.000735719499860316
+-2.8249999999998 0.000737801214865105
+-2.8239999999998 0.000739888080184656
+-2.8229999999998 0.000741980106206965
+-2.8219999999998 0.000744077303333901
+-2.8209999999998 0.000746179681981205
+-2.8199999999998 0.000748287252578485
+-2.8189999999998 0.000750400025569216
+-2.8179999999998 0.000752518011410733
+-2.8169999999998 0.000754641220574235
+-2.8159999999998 0.000756769663544775
+-2.8149999999998 0.000758903350821264
+-2.8139999999998 0.00076104229291646
+-2.8129999999998 0.000763186500356974
+-2.8119999999998 0.000765335983683259
+-2.8109999999998 0.000767490753449613
+-2.8099999999998 0.00076965082022417
+-2.8089999999998 0.000771816194588901
+-2.8079999999998 0.000773986887139609
+-2.8069999999998 0.000776162908485925
+-2.8059999999998 0.000778344269251304
+-2.8049999999998 0.000780530980073025
+-2.8039999999998 0.000782723051602181
+-2.8029999999998 0.00078492049450368
+-2.8019999999998 0.000787123319456241
+-2.8009999999998 0.000789331537152387
+-2.7999999999998 0.000791545158298443
+-2.7989999999998 0.000793764193614531
+-2.7979999999998 0.000795988653834566
+-2.7969999999998 0.000798218549706254
+-2.7959999999998 0.000800453891991082
+-2.7949999999998 0.000802694691464319
+-2.7939999999998 0.00080494095891501
+-2.7929999999998 0.000807192705145969
+-2.7919999999998 0.000809449940973776
+-2.7909999999998 0.000811712677228772
+-2.7899999999998 0.000813980924755057
+-2.7889999999998 0.000816254694410479
+-2.7879999999998 0.000818533997066634
+-2.7869999999998 0.000820818843608857
+-2.7859999999998 0.000823109244936221
+-2.7849999999998 0.00082540521196153
+-2.7839999999998 0.000827706755611309
+-2.7829999999998 0.000830013886825807
+-2.7819999999998 0.000832326616558986
+-2.7809999999998 0.000834644955778515
+-2.7799999999998 0.000836968915465766
+-2.7789999999998 0.000839298506615809
+-2.7779999999998 0.000841633740237404
+-2.7769999999998 0.000843974627352996
+-2.7759999999998 0.000846321178998709
+-2.7749999999998 0.00084867340622434
+-2.7739999999998 0.000851031320093351
+-2.7729999999998 0.000853394931682867
+-2.7719999999998 0.000855764252083664
+-2.7709999999998 0.000858139292400167
+-2.7699999999998 0.00086052006375044
+-2.7689999999998 0.000862906577266181
+-2.7679999999998 0.000865298844092718
+-2.7669999999998 0.000867696875388996
+-2.7659999999998 0.000870100682327575
+-2.7649999999998 0.00087251027609462
+-2.7639999999998 0.000874925667889898
+-2.7629999999998 0.000877346868926765
+-2.7619999999998 0.000879773890432164
+-2.7609999999998 0.000882206743646613
+-2.7599999999998 0.000884645439824203
+-2.7589999999998 0.000887089990232586
+-2.7579999999998 0.000889540406152966
+-2.7569999999998 0.000891996698880099
+-2.7559999999998 0.000894458879722277
+-2.7549999999998 0.000896926960001323
+-2.7539999999998 0.000899400951052585
+-2.7529999999998 0.000901880864224926
+-2.7519999999998 0.000904366710880714
+-2.7509999999998 0.000906858502395818
+-2.7499999999998 0.000909356250159595
+-2.7489999999998 0.000911859965574887
+-2.7479999999998 0.000914369660058008
+-2.7469999999998 0.000916885345038735
+-2.7459999999998 0.000919407031960303
+-2.7449999999998 0.000921934732279394
+-2.7439999999998 0.000924468457466128
+-2.7429999999998 0.000927008219004054
+-2.74199999999981 0.000929554028390142
+-2.74099999999981 0.000932105897134772
+-2.73999999999981 0.000934663836761728
+-2.73899999999981 0.000937227858808182
+-2.73799999999981 0.000939797974824693
+-2.73699999999981 0.000942374196375192
+-2.73599999999981 0.000944956535036975
+-2.73499999999981 0.000947545002400688
+-2.73399999999981 0.000950139610070326
+-2.73299999999981 0.000952740369663216
+-2.73199999999981 0.000955347292810008
+-2.73099999999981 0.000957960391154668
+-2.72999999999981 0.000960579676354466
+-2.72899999999981 0.000963205160079965
+-2.72799999999981 0.00096583685401501
+-2.72699999999981 0.00096847476985672
+-2.72599999999981 0.000971118919315477
+-2.72499999999981 0.000973769314114912
+-2.72399999999981 0.000976425965991899
+-2.72299999999981 0.00097908888669654
+-2.72199999999981 0.000981758087992157
+-2.72099999999981 0.000984433581655278
+-2.71999999999981 0.000987115379475631
+-2.71899999999981 0.000989803493256125
+-2.71799999999981 0.000992497934812846
+-2.71699999999981 0.000995198715975042
+-2.71599999999981 0.00099790584858511
+-2.71499999999981 0.00100061934449859
+-2.71399999999981 0.00100333921558415
+-2.71299999999981 0.00100606547372356
+-2.71199999999981 0.00100879813081171
+-2.71099999999981 0.00101153719875659
+-2.70999999999981 0.00101428268947923
+-2.70899999999981 0.00101703461491378
+-2.70799999999981 0.0010197929870074
+-2.70699999999981 0.00102255781772032
+-2.70599999999981 0.00102532911902579
+-2.70499999999981 0.00102810690291008
+-2.70399999999981 0.00103089118137246
+-2.70299999999981 0.0010336819664252
+-2.70199999999981 0.00103647927009353
+-2.70099999999981 0.00103928310441568
+-2.69999999999981 0.0010420934814428
+-2.69899999999981 0.00104491041323899
+-2.69799999999981 0.00104773391188129
+-2.69699999999981 0.00105056398945963
+-2.69599999999981 0.00105340065807686
+-2.69499999999981 0.0010562439298487
+-2.69399999999981 0.00105909381690375
+-2.69299999999981 0.00106195033138347
+-2.69199999999981 0.00106481348544216
+-2.69099999999981 0.00106768329124694
+-2.68999999999981 0.00107055976097776
+-2.68899999999981 0.00107344290682738
+-2.68799999999981 0.00107633274100132
+-2.68699999999981 0.0010792292757179
+-2.68599999999981 0.00108213252320818
+-2.68499999999981 0.00108504249571596
+-2.68399999999981 0.0010879592054978
+-2.68299999999981 0.00109088266482294
+-2.68199999999981 0.00109381288597334
+-2.68099999999981 0.00109674988124363
+-2.67999999999981 0.00109969366294111
+-2.67899999999981 0.00110264424338575
+-2.67799999999981 0.00110560163491014
+-2.67699999999981 0.0011085658498595
+-2.67599999999981 0.00111153690059166
+-2.67499999999981 0.00111451479947704
+-2.67399999999981 0.00111749955889862
+-2.67299999999981 0.00112049119125197
+-2.67199999999981 0.00112348970894518
+-2.67099999999981 0.00112649512439887
+-2.66999999999981 0.00112950745004618
+-2.66899999999981 0.00113252669833274
+-2.66799999999981 0.00113555288171666
+-2.66699999999981 0.00113858601266851
+-2.66599999999981 0.00114162610367131
+-2.66499999999981 0.0011446731672205
+-2.66399999999981 0.00114772721582395
+-2.66299999999981 0.00115078826200189
+-2.66199999999981 0.00115385631828697
+-2.66099999999981 0.00115693139722417
+-2.65999999999981 0.00116001351137083
+-2.65899999999981 0.0011631026732966
+-2.65799999999981 0.00116619889558346
+-2.65699999999981 0.00116930219082566
+-2.65599999999981 0.00117241257162973
+-2.65499999999981 0.00117553005061446
+-2.65399999999981 0.00117865464041087
+-2.65299999999981 0.0011817863536622
+-2.65199999999981 0.00118492520302391
+-2.65099999999982 0.00118807120116361
+-2.64999999999982 0.0011912243607611
+-2.64899999999982 0.00119438469450831
+-2.64799999999982 0.00119755221510931
+-2.64699999999982 0.00120072693528027
+-2.64599999999982 0.00120390886774945
+-2.64499999999982 0.00120709802525719
+-2.64399999999982 0.00121029442055586
+-2.64299999999982 0.0012134980664099
+-2.64199999999982 0.00121670897559572
+-2.64099999999982 0.00121992716090175
+-2.63999999999982 0.00122315263512839
+-2.63899999999982 0.001226385411088
+-2.63799999999982 0.00122962550160486
+-2.63699999999982 0.00123287291951518
+-2.63599999999982 0.00123612767766706
+-2.63499999999982 0.00123938978892048
+-2.63399999999982 0.00124265926614726
+-2.63299999999982 0.00124593612223107
+-2.63199999999982 0.00124922037006739
+-2.63099999999982 0.00125251202256349
+-2.62999999999982 0.00125581109263842
+-2.62899999999982 0.00125911759322299
+-2.62799999999982 0.00126243153725972
+-2.62699999999982 0.00126575293770286
+-2.62599999999982 0.00126908180751833
+-2.62499999999982 0.00127241815968375
+-2.62399999999982 0.00127576200718836
+-2.62299999999982 0.00127911336303304
+-2.62199999999982 0.00128247224023026
+-2.62099999999982 0.00128583865180408
+-2.61999999999982 0.00128921261079014
+-2.61899999999982 0.0012925941302356
+-2.61799999999982 0.00129598322319913
+-2.61699999999982 0.00129937990275091
+-2.61599999999982 0.00130278418197258
+-2.61499999999982 0.00130619607395726
+-2.61399999999982 0.00130961559180946
+-2.61299999999982 0.00131304274864511
+-2.61199999999982 0.00131647755759154
+-2.61099999999982 0.00131992003178742
+-2.60999999999982 0.00132337018438276
+-2.60899999999982 0.00132682802853889
+-2.60799999999982 0.00133029357742843
+-2.60699999999982 0.00133376684423526
+-2.60599999999982 0.00133724784215452
+-2.60499999999982 0.00134073658439255
+-2.60399999999982 0.00134423308416691
+-2.60299999999982 0.00134773735470633
+-2.60199999999982 0.00135124940925066
+-2.60099999999982 0.00135476926105092
+-2.59999999999982 0.0013582969233692
+-2.59899999999982 0.00136183240947867
+-2.59799999999982 0.00136537573266358
+-2.59699999999982 0.00136892690621918
+-2.59599999999982 0.00137248594345174
+-2.59499999999982 0.00137605285767849
+-2.59399999999982 0.00137962766222764
+-2.59299999999982 0.00138321037043832
+-2.59199999999982 0.00138680099566056
+-2.59099999999982 0.00139039955125527
+-2.58999999999982 0.00139400605059423
+-2.58899999999982 0.00139762050706002
+-2.58799999999982 0.00140124293404605
+-2.58699999999982 0.00140487334495649
+-2.58599999999982 0.00140851175320628
+-2.58499999999982 0.00141215817222108
+-2.58399999999982 0.00141581261543723
+-2.58299999999982 0.00141947509630177
+-2.58199999999982 0.00142314562827239
+-2.58099999999982 0.00142682422481737
+-2.57999999999982 0.00143051089941562
+-2.57899999999982 0.0014342056655566
+-2.57799999999982 0.00143790853674032
+-2.57699999999982 0.00144161952647729
+-2.57599999999982 0.00144533864828853
+-2.57499999999982 0.0014490659157055
+-2.57399999999982 0.00145280134227012
+-2.57299999999982 0.00145654494153468
+-2.57199999999982 0.00146029672706188
+-2.57099999999982 0.00146405671242475
+-2.56999999999982 0.00146782491120667
+-2.56899999999982 0.00147160133700129
+-2.56799999999982 0.00147538600341253
+-2.56699999999982 0.00147917892405457
+-2.56599999999982 0.00148298011255178
+-2.56499999999982 0.00148678958253873
+-2.56399999999982 0.00149060734766013
+-2.56299999999982 0.00149443342157083
+-2.56199999999982 0.00149826781793577
+-2.56099999999982 0.00150211055042994
+-2.55999999999983 0.00150596163273842
+-2.55899999999983 0.00150982107855625
+-2.55799999999983 0.00151368890158848
+-2.55699999999983 0.0015175651155501
+-2.55599999999983 0.00152144973416602
+-2.55499999999983 0.00152534277117107
+-2.55399999999983 0.0015292442403099
+-2.55299999999983 0.00153315415533704
+-2.55199999999983 0.00153707253001679
+-2.55099999999983 0.00154099937812323
+-2.54999999999983 0.0015449347134402
+-2.54899999999983 0.00154887854976124
+-2.54799999999983 0.00155283090088957
+-2.54699999999983 0.00155679178063807
+-2.54599999999983 0.00156076120282924
+-2.54499999999983 0.00156473918129517
+-2.54399999999983 0.0015687257298775
+-2.54299999999983 0.00157272086242743
+-2.54199999999983 0.00157672459280561
+-2.54099999999983 0.0015807369348822
+-2.53999999999983 0.00158475790253678
+-2.53899999999983 0.00158878750965831
+-2.53799999999983 0.00159282577014516
+-2.53699999999983 0.00159687269790502
+-2.53599999999983 0.00160092830685488
+-2.53499999999983 0.00160499261092102
+-2.53399999999983 0.00160906562403896
+-2.53299999999983 0.00161314736015342
+-2.53199999999983 0.00161723783321832
+-2.53099999999983 0.00162133705719671
+-2.52999999999983 0.00162544504606076
+-2.52899999999983 0.0016295618137917
+-2.52799999999983 0.00163368737437985
+-2.52699999999983 0.0016378217418245
+-2.52599999999983 0.00164196493013395
+-2.52499999999983 0.00164611695332544
+-2.52399999999983 0.00165027782542511
+-2.52299999999983 0.001654447560468
+-2.52199999999983 0.00165862617249799
+-2.52099999999983 0.00166281367556778
+-2.51999999999983 0.00166701008373882
+-2.51899999999983 0.00167121541108135
+-2.51799999999983 0.00167542967167427
+-2.51699999999983 0.00167965287960521
+-2.51599999999983 0.00168388504897039
+-2.51499999999983 0.00168812619387467
+-2.51399999999983 0.00169237632843148
+-2.51299999999983 0.00169663546676276
+-2.51199999999983 0.00170090362299899
+-2.51099999999983 0.00170518081127909
+-2.50999999999983 0.00170946704575042
+-2.50899999999983 0.00171376234056874
+-2.50799999999983 0.00171806670989816
+-2.50699999999983 0.00172238016791112
+-2.50599999999983 0.00172670272878835
+-2.50499999999983 0.00173103440671883
+-2.50399999999983 0.00173537521589977
+-2.50299999999983 0.00173972517053654
+-2.50199999999983 0.00174408428484267
+-2.50099999999983 0.00174845257303979
+-2.49999999999983 0.00175283004935759
+-2.49899999999983 0.00175721672803382
+-2.49799999999983 0.00176161262331421
+-2.49699999999983 0.00176601774945245
+-2.49599999999983 0.00177043212071016
+-2.49499999999983 0.00177485575135685
+-2.49399999999983 0.00177928865566985
+-2.49299999999983 0.00178373084793434
+-2.49199999999983 0.00178818234244326
+-2.49099999999983 0.00179264315349726
+-2.48999999999983 0.00179711329540471
+-2.48899999999983 0.00180159278248165
+-2.48799999999983 0.00180608162905172
+-2.48699999999983 0.00181057984944615
+-2.48599999999983 0.00181508745800371
+-2.48499999999983 0.00181960446907068
+-2.48399999999983 0.00182413089700081
+-2.48299999999983 0.00182866675615527
+-2.48199999999983 0.00183321206090262
+-2.48099999999983 0.00183776682561878
+-2.47999999999983 0.00184233106468696
+-2.47899999999983 0.00184690479249767
+-2.47799999999983 0.00185148802344861
+-2.47699999999983 0.00185608077194471
+-2.47599999999983 0.00186068305239803
+-2.47499999999983 0.00186529487922776
+-2.47399999999983 0.00186991626686013
+-2.47299999999983 0.00187454722972844
+-2.47199999999983 0.00187918778227295
+-2.47099999999983 0.00188383793894089
+-2.46999999999983 0.00188849771418639
+-2.46899999999984 0.00189316712247044
+-2.46799999999984 0.00189784617826089
+-2.46699999999984 0.00190253489603234
+-2.46599999999984 0.00190723329026615
+-2.46499999999984 0.0019119413754504
+-2.46399999999984 0.0019166591660798
+-2.46299999999984 0.00192138667665572
+-2.46199999999984 0.00192612392168608
+-2.46099999999984 0.00193087091568534
+-2.45999999999984 0.00193562767317448
+-2.45899999999984 0.0019403942086809
+-2.45799999999984 0.00194517053673844
+-2.45699999999984 0.00194995667188729
+-2.45599999999984 0.00195475262867398
+-2.45499999999984 0.00195955842165132
+-2.45399999999984 0.00196437406537834
+-2.45299999999984 0.0019691995744203
+-2.45199999999984 0.0019740349633486
+-2.45099999999984 0.00197888024674075
+-2.44999999999984 0.00198373543918032
+-2.44899999999984 0.00198860055525693
+-2.44799999999984 0.00199347560956616
+-2.44699999999984 0.00199836061670953
+-2.44599999999984 0.00200325559129445
+-2.44499999999984 0.00200816054793419
+-2.44399999999984 0.00201307550124783
+-2.44299999999984 0.00201800046586019
+-2.44199999999984 0.00202293545640182
+-2.44099999999984 0.00202788048750894
+-2.43999999999984 0.00203283557382339
+-2.43899999999984 0.00203780072999259
+-2.43799999999984 0.00204277597066953
+-2.43699999999984 0.00204776131051264
+-2.43599999999984 0.00205275676418584
+-2.43499999999984 0.00205776234635841
+-2.43399999999984 0.00206277807170504
+-2.43299999999984 0.00206780395490568
+-2.43199999999984 0.00207284001064556
+-2.43099999999984 0.00207788625361514
+-2.42999999999984 0.00208294269851003
+-2.42899999999984 0.00208800936003099
+-2.42799999999984 0.00209308625288384
+-2.42699999999984 0.00209817339177945
+-2.42599999999984 0.00210327079143365
+-2.42499999999984 0.00210837846656723
+-2.42399999999984 0.00211349643190587
+-2.42299999999984 0.00211862470218008
+-2.42199999999984 0.0021237632921252
+-2.42099999999984 0.00212891221648128
+-2.41999999999984 0.0021340714899931
+-2.41899999999984 0.00213924112741009
+-2.41799999999984 0.00214442114348629
+-2.41699999999984 0.00214961155298028
+-2.41599999999984 0.00215481237065517
+-2.41499999999984 0.00216002361127854
+-2.41399999999984 0.00216524528962237
+-2.41299999999984 0.00217047742046301
+-2.41199999999984 0.00217572001858113
+-2.41099999999984 0.00218097309876166
+-2.40999999999984 0.00218623667579377
+-2.40899999999984 0.00219151076447079
+-2.40799999999984 0.00219679537959016
+-2.40699999999984 0.00220209053595341
+-2.40599999999984 0.00220739624836608
+-2.40499999999984 0.00221271253163771
+-2.40399999999984 0.00221803940058172
+-2.40299999999984 0.00222337687001545
+-2.40199999999984 0.00222872495476003
+-2.40099999999984 0.00223408366964038
+-2.39999999999984 0.00223945302948514
+-2.39899999999984 0.00224483304912662
+-2.39799999999984 0.00225022374340075
+-2.39699999999984 0.00225562512714706
+-2.39599999999984 0.00226103721520855
+-2.39499999999984 0.00226646002243174
+-2.39399999999984 0.00227189356366653
+-2.39299999999984 0.00227733785376622
+-2.39199999999984 0.00228279290758741
+-2.39099999999984 0.00228825873998995
+-2.38999999999984 0.00229373536583693
+-2.38899999999984 0.00229922279999458
+-2.38799999999984 0.00230472105733226
+-2.38699999999984 0.00231023015272237
+-2.38599999999984 0.00231575010104032
+-2.38499999999984 0.00232128091716447
+-2.38399999999984 0.00232682261597609
+-2.38299999999984 0.00233237521235929
+-2.38199999999984 0.00233793872120096
+-2.38099999999984 0.00234351315739075
+-2.37999999999984 0.002349098535821
+-2.37899999999985 0.00235469487138668
+-2.37799999999985 0.00236030217898533
+-2.37699999999985 0.00236592047351704
+-2.37599999999985 0.00237154976988436
+-2.37499999999985 0.00237719008299225
+-2.37399999999985 0.00238284142774807
+-2.37299999999985 0.00238850381906146
+-2.37199999999985 0.00239417727184434
+-2.37099999999985 0.00239986180101082
+-2.36999999999985 0.00240555742147718
+-2.36899999999985 0.00241126414816175
+-2.36799999999985 0.00241698199598497
+-2.36699999999985 0.00242271097986919
+-2.36599999999985 0.00242845111473875
+-2.36499999999985 0.00243420241551984
+-2.36399999999985 0.00243996489714046
+-2.36299999999985 0.0024457385745304
+-2.36199999999985 0.00245152346262113
+-2.36099999999985 0.0024573195763458
+-2.35999999999985 0.00246312693063914
+-2.35899999999985 0.00246894554043742
+-2.35799999999985 0.00247477542067842
+-2.35699999999985 0.0024806165863013
+-2.35599999999985 0.00248646905224665
+-2.35499999999985 0.00249233283345633
+-2.35399999999985 0.00249820794487348
+-2.35299999999985 0.00250409440144243
+-2.35199999999985 0.00250999221810867
+-2.35099999999985 0.00251590140981878
+-2.34999999999985 0.00252182199152034
+-2.34899999999985 0.00252775397816193
+-2.34799999999985 0.00253369738469305
+-2.34699999999985 0.00253965222606404
+-2.34599999999985 0.00254561851722604
+-2.34499999999985 0.00255159627313094
+-2.34399999999985 0.00255758550873132
+-2.34299999999985 0.00256358623898037
+-2.34199999999985 0.00256959847883186
+-2.34099999999985 0.00257562224324005
+-2.33999999999985 0.00258165754715968
+-2.33899999999985 0.00258770440554585
+-2.33799999999985 0.00259376283335402
+-2.33699999999985 0.00259983284553989
+-2.33599999999985 0.00260591445705941
+-2.33499999999985 0.00261200768286865
+-2.33399999999985 0.00261811253792381
+-2.33299999999985 0.00262422903718109
+-2.33199999999985 0.00263035719559668
+-2.33099999999985 0.0026364970281267
+-2.32999999999985 0.00264264854972709
+-2.32899999999985 0.00264881177535363
+-2.32799999999985 0.0026549867199618
+-2.32699999999985 0.00266117339850677
+-2.32599999999985 0.00266737182594331
+-2.32499999999985 0.00267358201722575
+-2.32399999999985 0.00267980398730792
+-2.32299999999985 0.00268603775114307
+-2.32199999999985 0.00269228332368383
+-2.32099999999985 0.00269854071988211
+-2.31999999999985 0.00270480995468911
+-2.31899999999985 0.00271109104305518
+-2.31799999999985 0.00271738399992981
+-2.31699999999985 0.00272368884026154
+-2.31599999999985 0.00273000557899792
+-2.31499999999985 0.00273633423108543
+-2.31399999999985 0.00274267481146943
+-2.31299999999985 0.0027490273350941
+-2.31199999999985 0.00275539181690234
+-2.31099999999985 0.00276176827183576
+-2.30999999999985 0.0027681567148346
+-2.30899999999985 0.00277455716083765
+-2.30799999999985 0.00278096962478219
+-2.30699999999985 0.00278739412160394
+-2.30599999999985 0.00279383066623702
+-2.30499999999985 0.00280027927361381
+-2.30399999999985 0.00280673995866496
+-2.30299999999985 0.0028132127363193
+-2.30199999999985 0.00281969762150377
+-2.30099999999985 0.00282619462914337
+-2.29999999999985 0.00283270377416107
+-2.29899999999985 0.00283922507147779
+-2.29799999999985 0.00284575853601228
+-2.29699999999985 0.00285230418268111
+-2.29599999999985 0.00285886202639856
+-2.29499999999985 0.00286543208207658
+-2.29399999999985 0.00287201436462473
+-2.29299999999985 0.00287860888895009
+-2.29199999999985 0.00288521566995721
+-2.29099999999985 0.00289183472254805
+-2.28999999999985 0.00289846606162191
+-2.28899999999985 0.00290510970207534
+-2.28799999999986 0.00291176565880212
+-2.28699999999986 0.00291843394669317
+-2.28599999999986 0.00292511458063646
+-2.28499999999986 0.002931807575517
+-2.28399999999986 0.0029385129462167
+-2.28299999999986 0.00294523070761438
+-2.28199999999986 0.00295196087458566
+-2.28099999999986 0.00295870346200289
+-2.27999999999986 0.0029654584847351
+-2.27899999999986 0.00297222595764792
+-2.27799999999986 0.00297900589560353
+-2.27699999999986 0.00298579831346058
+-2.27599999999986 0.00299260322607411
+-2.27499999999986 0.00299942064829551
+-2.27399999999986 0.00300625059497244
+-2.27299999999986 0.00301309308094875
+-2.27199999999986 0.00301994812106444
+-2.27099999999986 0.00302681573015556
+-2.26999999999986 0.00303369592305415
+-2.26899999999986 0.00304058871458819
+-2.26799999999986 0.00304749411958153
+-2.26699999999986 0.00305441215285378
+-2.26599999999986 0.0030613428292203
+-2.26499999999986 0.00306828616349207
+-2.26399999999986 0.0030752421704757
+-2.26299999999986 0.00308221086497326
+-2.26199999999986 0.00308919226178231
+-2.26099999999986 0.00309618637569576
+-2.25999999999986 0.00310319322150182
+-2.25899999999986 0.00311021281398396
+-2.25799999999986 0.00311724516792079
+-2.25699999999986 0.00312429029808603
+-2.25599999999986 0.00313134821924843
+-2.25499999999986 0.00313841894617167
+-2.25399999999986 0.00314550249361432
+-2.25299999999986 0.0031525988763298
+-2.25199999999986 0.00315970810906623
+-2.25099999999986 0.00316683020656641
+-2.24999999999986 0.00317396518356775
+-2.24899999999986 0.00318111305480218
+-2.24799999999986 0.00318827383499611
+-2.24699999999986 0.00319544753887031
+-2.24599999999986 0.00320263418113987
+-2.24499999999986 0.00320983377651413
+-2.24399999999986 0.00321704633969661
+-2.24299999999986 0.0032242718853849
+-2.24199999999986 0.00323151042827065
+-2.24099999999986 0.00323876198303945
+-2.23999999999986 0.00324602656437076
+-2.23899999999986 0.00325330418693788
+-2.23799999999986 0.00326059486540782
+-2.23699999999986 0.00326789861444127
+-2.23599999999986 0.00327521544869251
+-2.23499999999986 0.00328254538280934
+-2.23399999999986 0.00328988843143298
+-2.23299999999986 0.00329724460919807
+-2.23199999999986 0.00330461393073251
+-2.23099999999986 0.00331199641065743
+-2.22999999999986 0.00331939206358714
+-2.22899999999986 0.00332680090412899
+-2.22799999999986 0.00333422294688336
+-2.22699999999986 0.00334165820644355
+-2.22599999999986 0.00334910669739571
+-2.22499999999986 0.00335656843431879
+-2.22399999999986 0.00336404343178442
+-2.22299999999986 0.00337153170435688
+-2.22199999999986 0.00337903326659302
+-2.22099999999986 0.00338654813304213
+-2.21999999999986 0.00339407631824595
+-2.21899999999986 0.00340161783673854
+-2.21799999999986 0.00340917270304621
+-2.21699999999986 0.00341674093168744
+-2.21599999999986 0.00342432253717285
+-2.21499999999986 0.00343191753400506
+-2.21399999999986 0.00343952593667867
+-2.21299999999986 0.00344714775968014
+-2.21199999999986 0.00345478301748773
+-2.21099999999986 0.00346243172457144
+-2.20999999999986 0.00347009389539293
+-2.20899999999986 0.0034777695444054
+-2.20799999999986 0.00348545868605359
+-2.20699999999986 0.00349316133477362
+-2.20599999999986 0.00350087750499299
+-2.20499999999986 0.00350860721113044
+-2.20399999999986 0.00351635046759591
+-2.20299999999986 0.00352410728879046
+-2.20199999999986 0.00353187768910618
+-2.20099999999986 0.00353966168292611
+-2.19999999999986 0.0035474592846242
+-2.19899999999986 0.00355527050856516
+-2.19799999999986 0.00356309536910447
+-2.19699999999987 0.00357093388058821
+-2.19599999999987 0.00357878605735308
+-2.19499999999987 0.00358665191372623
+-2.19399999999987 0.00359453146402526
+-2.19299999999987 0.00360242472255806
+-2.19199999999987 0.00361033170362282
+-2.19099999999987 0.00361825242150788
+-2.18999999999987 0.00362618689049169
+-2.18899999999987 0.00363413512484271
+-2.18799999999987 0.00364209713881936
+-2.18699999999987 0.00365007294666991
+-2.18599999999987 0.0036580625626324
+-2.18499999999987 0.0036660660009346
+-2.18399999999987 0.00367408327579387
+-2.18299999999987 0.00368211440141715
+-2.18199999999987 0.00369015939200082
+-2.18099999999987 0.00369821826173065
+-2.17999999999987 0.00370629102478172
+-2.17899999999987 0.00371437769531833
+-2.17799999999987 0.00372247828749392
+-2.17699999999987 0.00373059281545099
+-2.17599999999987 0.00373872129332104
+-2.17499999999987 0.00374686373522446
+-2.17399999999987 0.00375502015527046
+-2.17299999999987 0.00376319056755701
+-2.17199999999987 0.0037713749861707
+-2.17099999999987 0.00377957342518675
+-2.16999999999987 0.00378778589866883
+-2.16899999999987 0.00379601242066906
+-2.16799999999987 0.00380425300522789
+-2.16699999999987 0.003812507666374
+-2.16599999999987 0.00382077641812426
+-2.16499999999987 0.00382905927448363
+-2.16399999999987 0.00383735624944508
+-2.16299999999987 0.00384566735698951
+-2.16199999999987 0.00385399261108563
+-2.16099999999987 0.00386233202568996
+-2.15999999999987 0.00387068561474666
+-2.15899999999987 0.00387905339218751
+-2.15799999999987 0.00388743537193179
+-2.15699999999987 0.00389583156788623
+-2.15599999999987 0.00390424199394489
+-2.15499999999987 0.0039126666639891
+-2.15399999999987 0.00392110559188737
+-2.15299999999987 0.00392955879149533
+-2.15199999999987 0.00393802627665559
+-2.15099999999987 0.00394650806119771
+-2.14999999999987 0.00395500415893813
+-2.14899999999987 0.00396351458367999
+-2.14799999999987 0.00397203934921317
+-2.14699999999987 0.00398057846931412
+-2.14599999999987 0.0039891319577458
+-2.14499999999987 0.00399769982825762
+-2.14399999999987 0.00400628209458532
+-2.14299999999987 0.0040148787704509
+-2.14199999999987 0.00402348986956255
+-2.14099999999987 0.00403211540561454
+-2.13999999999987 0.00404075539228714
+-2.13899999999987 0.00404940984324657
+-2.13799999999987 0.00405807877214486
+-2.13699999999987 0.00406676219261981
+-2.13599999999987 0.00407546011829487
+-2.13499999999987 0.0040841725627791
+-2.13399999999987 0.00409289953966702
+-2.13299999999987 0.0041016410625386
+-2.13199999999987 0.00411039714495912
+-2.13099999999987 0.00411916780047908
+-2.12999999999987 0.00412795304263416
+-2.12899999999987 0.00413675288494511
+-2.12799999999987 0.00414556734091765
+-2.12699999999987 0.0041543964240424
+-2.12599999999987 0.0041632401477948
+-2.12499999999987 0.00417209852563499
+-2.12399999999987 0.00418097157100777
+-2.12299999999987 0.00418985929734249
+-2.12199999999987 0.00419876171805296
+-2.12099999999987 0.00420767884653735
+-2.11999999999987 0.00421661069617816
+-2.11899999999987 0.00422555728034206
+-2.11799999999987 0.00423451861237986
+-2.11699999999987 0.00424349470562638
+-2.11599999999987 0.00425248557340039
+-2.11499999999987 0.00426149122900451
+-2.11399999999987 0.00427051168572515
+-2.11299999999987 0.00427954695683239
+-2.11199999999987 0.00428859705557987
+-2.11099999999987 0.00429766199520478
+-2.10999999999987 0.00430674178892771
+-2.10899999999987 0.00431583644995258
+-2.10799999999987 0.00432494599146653
+-2.10699999999987 0.00433407042663988
+-2.10599999999988 0.00434320976862601
+-2.10499999999988 0.00435236403056127
+-2.10399999999988 0.00436153322556489
+-2.10299999999988 0.00437071736673891
+-2.10199999999988 0.00437991646716808
+-2.10099999999988 0.00438913053991977
+-2.09999999999988 0.00439835959804387
+-2.09899999999988 0.00440760365457273
+-2.09799999999988 0.00441686272252104
+-2.09699999999988 0.00442613681488578
+-2.09599999999988 0.00443542594464607
+-2.09499999999988 0.00444473012476315
+-2.09399999999988 0.00445404936818022
+-2.09299999999988 0.00446338368782243
+-2.09199999999988 0.00447273309659672
+-2.09099999999988 0.00448209760739176
+-2.08999999999988 0.00449147723307786
+-2.08899999999988 0.00450087198650689
+-2.08799999999988 0.00451028188051216
+-2.08699999999988 0.00451970692790835
+-2.08599999999988 0.00452914714149144
+-2.08499999999988 0.00453860253403856
+-2.08399999999988 0.00454807311830796
+-2.08299999999988 0.00455755890703891
+-2.08199999999988 0.00456705991295155
+-2.08099999999988 0.00457657614874689
+-2.07999999999988 0.00458610762710665
+-2.07899999999988 0.00459565436069321
+-2.07799999999988 0.00460521636214947
+-2.07699999999988 0.00461479364409882
+-2.07599999999988 0.00462438621914502
+-2.07499999999988 0.00463399409987209
+-2.07399999999988 0.00464361729884425
+-2.07299999999988 0.00465325582860581
+-2.07199999999988 0.00466290970168107
+-2.07099999999988 0.00467257893057429
+-2.06999999999988 0.00468226352776949
+-2.06899999999988 0.00469196350573045
+-2.06799999999988 0.0047016788769006
+-2.06699999999988 0.00471140965370288
+-2.06599999999988 0.0047211558485397
+-2.06499999999988 0.00473091747379285
+-2.06399999999988 0.00474069454182335
+-2.06299999999988 0.00475048706497142
+-2.06199999999988 0.00476029505555635
+-2.06099999999988 0.00477011852587645
+-2.05999999999988 0.00477995748820888
+-2.05899999999988 0.00478981195480965
+-2.05799999999988 0.00479968193791346
+-2.05699999999988 0.00480956744973364
+-2.05599999999988 0.00481946850246203
+-2.05499999999988 0.00482938510826892
+-2.05399999999988 0.00483931727930293
+-2.05299999999988 0.00484926502769095
+-2.05199999999988 0.00485922836553798
+-2.05099999999988 0.00486920730492714
+-2.04999999999988 0.00487920185791946
+-2.04899999999988 0.00488921203655389
+-2.04799999999988 0.00489923785284711
+-2.04699999999988 0.00490927931879355
+-2.04599999999988 0.00491933644636517
+-2.04499999999988 0.00492940924751147
+-2.04399999999988 0.00493949773415934
+-2.04299999999988 0.00494960191821299
+-2.04199999999988 0.00495972181155383
+-2.04099999999988 0.0049698574260404
+-2.03999999999988 0.00498000877350827
+-2.03899999999988 0.00499017586576996
+-2.03799999999988 0.00500035871461479
+-2.03699999999988 0.00501055733180887
+-2.03599999999988 0.00502077172909492
+-2.03499999999988 0.00503100191819225
+-2.03399999999988 0.00504124791079661
+-2.03299999999988 0.00505150971858013
+-2.03199999999988 0.00506178735319119
+-2.03099999999988 0.00507208082625437
+-2.02999999999988 0.00508239014937032
+-2.02899999999988 0.00509271533411568
+-2.02799999999988 0.00510305639204297
+-2.02699999999988 0.00511341333468053
+-2.02599999999988 0.00512378617353238
+-2.02499999999988 0.00513417492007815
+-2.02399999999988 0.00514457958577298
+-2.02299999999988 0.00515500018204743
+-2.02199999999988 0.00516543672030738
+-2.02099999999988 0.00517588921193392
+-2.01999999999988 0.00518635766828327
+-2.01899999999988 0.00519684210068669
+-2.01799999999988 0.00520734252045038
+-2.01699999999988 0.00521785893885537
+-2.01599999999988 0.00522839136715742
+-2.01499999999989 0.00523893981658698
+-2.01399999999989 0.00524950429834901
+-2.01299999999989 0.00526008482362294
+-2.01199999999989 0.00527068140356256
+-2.01099999999989 0.00528129404929592
+-2.00999999999989 0.00529192277192524
+-2.00899999999989 0.00530256758252682
+-2.00799999999989 0.00531322849215091
+-2.00699999999989 0.00532390551182164
+-2.00599999999989 0.00533459865253695
+-2.00499999999989 0.00534530792526842
+-2.00399999999989 0.00535603334096126
+-2.00299999999989 0.00536677491053412
+-2.00199999999989 0.0053775326448791
+-2.00099999999989 0.00538830655486154
+-1.99999999999989 0.00539909665132003
+-1.99899999999989 0.00540990294506622
+-1.99799999999989 0.00542072544688478
+-1.99699999999989 0.0054315641675333
+-1.99599999999989 0.00544241911774216
+-1.99499999999989 0.00545329030821446
+-1.99399999999989 0.00546417774962593
+-1.99299999999989 0.00547508145262479
+-1.99199999999989 0.0054860014278317
+-1.99099999999989 0.00549693768583964
+-1.98999999999989 0.00550789023721381
+-1.98899999999989 0.00551885909249153
+-1.98799999999989 0.00552984426218218
+-1.98699999999989 0.00554084575676704
+-1.98599999999989 0.00555186358669924
+-1.98499999999989 0.00556289776240364
+-1.98399999999989 0.00557394829427674
+-1.98299999999989 0.00558501519268659
+-1.98199999999989 0.00559609846797266
+-1.98099999999989 0.00560719813044579
+-1.97999999999989 0.00561831419038804
+-1.97899999999989 0.00562944665805264
+-1.97799999999989 0.00564059554366386
+-1.97699999999989 0.00565176085741693
+-1.97599999999989 0.00566294260947791
+-1.97499999999989 0.00567414080998364
+-1.97399999999989 0.0056853554690416
+-1.97299999999989 0.00569658659672984
+-1.97199999999989 0.00570783420309686
+-1.97099999999989 0.00571909829816152
+-1.96999999999989 0.00573037889191295
+-1.96899999999989 0.00574167599431044
+-1.96799999999989 0.00575298961528333
+-1.96699999999989 0.00576431976473095
+-1.96599999999989 0.00577566645252247
+-1.96499999999989 0.00578702968849686
+-1.96399999999989 0.00579840948246274
+-1.96299999999989 0.00580980584419829
+-1.96199999999989 0.00582121878345118
+-1.96099999999989 0.00583264830993845
+-1.95999999999989 0.00584409443334639
+-1.95899999999989 0.00585555716333051
+-1.95799999999989 0.00586703650951534
+-1.95699999999989 0.00587853248149443
+-1.95599999999989 0.00589004508883018
+-1.95499999999989 0.00590157434105378
+-1.95399999999989 0.00591312024766509
+-1.95299999999989 0.00592468281813255
+-1.95199999999989 0.00593626206189308
+-1.95099999999989 0.00594785798835199
+-1.94999999999989 0.00595947060688286
+-1.94899999999989 0.00597109992682744
+-1.94799999999989 0.00598274595749558
+-1.94699999999989 0.0059944087081651
+-1.94599999999989 0.00600608818808171
+-1.94499999999989 0.0060177844064589
+-1.94399999999989 0.00602949737247782
+-1.94299999999989 0.00604122709528726
+-1.94199999999989 0.00605297358400342
+-1.94099999999989 0.00606473684770995
+-1.93999999999989 0.00607651689545774
+-1.93899999999989 0.00608831373626487
+-1.93799999999989 0.00610012737911653
+-1.93699999999989 0.00611195783296486
+-1.93599999999989 0.00612380510672891
+-1.93499999999989 0.00613566920929451
+-1.93399999999989 0.00614755014951415
+-1.93299999999989 0.00615944793620694
+-1.93199999999989 0.00617136257815846
+-1.93099999999989 0.00618329408412065
+-1.92999999999989 0.00619524246281178
+-1.92899999999989 0.00620720772291627
+-1.92799999999989 0.00621918987308463
+-1.92699999999989 0.00623118892193336
+-1.92599999999989 0.00624320487804485
+-1.9249999999999 0.00625523774996726
+-1.9239999999999 0.00626728754621444
+-1.9229999999999 0.00627935427526582
+-1.9219999999999 0.00629143794556632
+-1.9209999999999 0.00630353856552623
+-1.9199999999999 0.00631565614352113
+-1.9189999999999 0.00632779068789179
+-1.9179999999999 0.00633994220694404
+-1.9169999999999 0.00635211070894871
+-1.9159999999999 0.00636429620214152
+-1.9149999999999 0.00637649869472293
+-1.9139999999999 0.00638871819485813
+-1.9129999999999 0.00640095471067685
+-1.9119999999999 0.00641320825027332
+-1.9109999999999 0.00642547882170614
+-1.9099999999999 0.00643776643299821
+-1.9089999999999 0.00645007109213656
+-1.9079999999999 0.00646239280707236
+-1.9069999999999 0.00647473158572071
+-1.9059999999999 0.0064870874359606
+-1.9049999999999 0.00649946036563479
+-1.9039999999999 0.00651185038254974
+-1.9029999999999 0.00652425749447546
+-1.9019999999999 0.00653668170914545
+-1.9009999999999 0.00654912303425656
+-1.8999999999999 0.00656158147746893
+-1.8989999999999 0.00657405704640589
+-1.8979999999999 0.00658654974865381
+-1.8969999999999 0.00659905959176205
+-1.8959999999999 0.00661158658324283
+-1.8949999999999 0.00662413073057115
+-1.8939999999999 0.00663669204118468
+-1.8929999999999 0.00664927052248365
+-1.8919999999999 0.00666186618183077
+-1.8909999999999 0.0066744790265511
+-1.8899999999999 0.00668710906393199
+-1.8889999999999 0.00669975630122295
+-1.8879999999999 0.00671242074563553
+-1.8869999999999 0.00672510240434329
+-1.8859999999999 0.00673780128448162
+-1.8849999999999 0.00675051739314769
+-1.8839999999999 0.00676325073740033
+-1.8829999999999 0.00677600132425993
+-1.8819999999999 0.00678876916070834
+-1.8809999999999 0.00680155425368879
+-1.8799999999999 0.00681435661010574
+-1.8789999999999 0.00682717623682484
+-1.8779999999999 0.00684001314067279
+-1.8769999999999 0.00685286732843724
+-1.8759999999999 0.00686573880686671
+-1.8749999999999 0.00687862758267047
+-1.8739999999999 0.00689153366251846
+-1.8729999999999 0.00690445705304117
+-1.8719999999999 0.00691739776082953
+-1.8709999999999 0.00693035579243486
+-1.8699999999999 0.0069433311543687
+-1.8689999999999 0.00695632385310278
+-1.8679999999999 0.00696933389506885
+-1.8669999999999 0.00698236128665864
+-1.8659999999999 0.00699540603422372
+-1.8649999999999 0.00700846814407542
+-1.8639999999999 0.00702154762248471
+-1.8629999999999 0.00703464447568213
+-1.8619999999999 0.00704775870985766
+-1.8609999999999 0.00706089033116063
+-1.8599999999999 0.00707403934569963
+-1.8589999999999 0.00708720575954239
+-1.8579999999999 0.00710038957871569
+-1.8569999999999 0.00711359080920528
+-1.8559999999999 0.00712680945695574
+-1.8549999999999 0.00714004552787039
+-1.8539999999999 0.00715329902781122
+-1.8529999999999 0.00716656996259877
+-1.8519999999999 0.007179858338012
+-1.8509999999999 0.00719316415978825
+-1.8499999999999 0.00720648743362309
+-1.8489999999999 0.00721982816517024
+-1.8479999999999 0.00723318636004147
+-1.8469999999999 0.0072465620238065
+-1.8459999999999 0.00725995516199289
+-1.8449999999999 0.00727336578008596
+-1.8439999999999 0.00728679388352866
+-1.8429999999999 0.00730023947772149
+-1.8419999999999 0.00731370256802242
+-1.8409999999999 0.00732718315974673
+-1.8399999999999 0.00734068125816698
+-1.8389999999999 0.00735419686851286
+-1.8379999999999 0.00736772999597111
+-1.8369999999999 0.00738128064568542
+-1.8359999999999 0.00739484882275633
+-1.8349999999999 0.00740843453224112
+-1.83399999999991 0.00742203777915373
+-1.83299999999991 0.00743565856846463
+-1.83199999999991 0.00744929690510076
+-1.83099999999991 0.00746295279394539
+-1.82999999999991 0.00747662623983805
+-1.82899999999991 0.00749031724757443
+-1.82799999999991 0.00750402582190625
+-1.82699999999991 0.00751775196754119
+-1.82599999999991 0.00753149568914279
+-1.82499999999991 0.00754525699133031
+-1.82399999999991 0.00755903587867871
+-1.82299999999991 0.00757283235571848
+-1.82199999999991 0.00758664642693554
+-1.82099999999991 0.00760047809677121
+-1.81999999999991 0.00761432736962203
+-1.81899999999991 0.00762819424983971
+-1.81799999999991 0.00764207874173103
+-1.81699999999991 0.0076559808495577
+-1.81599999999991 0.00766990057753631
+-1.81499999999991 0.0076838379298382
+-1.81399999999991 0.00769779291058939
+-1.81299999999991 0.00771176552387043
+-1.81199999999991 0.00772575577371635
+-1.81099999999991 0.00773976366411655
+-1.80999999999991 0.00775378919901469
+-1.80899999999991 0.00776783238230861
+-1.80799999999991 0.00778189321785018
+-1.80699999999991 0.00779597170944529
+-1.80599999999991 0.00781006786085366
+-1.80499999999991 0.00782418167578881
+-1.80399999999991 0.00783831315791792
+-1.80299999999991 0.00785246231086175
+-1.80199999999991 0.00786662913819453
+-1.80099999999991 0.00788081364344389
+-1.79999999999991 0.00789501583009071
+-1.79899999999991 0.00790923570156909
+-1.79799999999991 0.00792347326126618
+-1.79699999999991 0.00793772851252214
+-1.79599999999991 0.00795200145863
+-1.79499999999991 0.0079662921028356
+-1.79399999999991 0.00798060044833745
+-1.79299999999991 0.00799492649828669
+-1.79199999999991 0.00800927025578692
+-1.79099999999991 0.00802363172389415
+-1.78999999999991 0.00803801090561671
+-1.78899999999991 0.00805240780391512
+-1.78799999999991 0.008066822421702
+-1.78699999999991 0.00808125476184199
+-1.78599999999991 0.00809570482715164
+-1.78499999999991 0.00811017262039932
+-1.78399999999991 0.0081246581443051
+-1.78299999999991 0.00813916140154069
+-1.78199999999991 0.00815368239472931
+-1.78099999999991 0.00816822112644561
+-1.77999999999991 0.00818277759921558
+-1.77899999999991 0.00819735181551642
+-1.77799999999991 0.00821194377777647
+-1.77699999999991 0.00822655348837514
+-1.77599999999991 0.00824118094964275
+-1.77499999999991 0.00825582616386046
+-1.77399999999991 0.0082704891332602
+-1.77299999999991 0.00828516986002455
+-1.77199999999991 0.00829986834628664
+-1.77099999999991 0.00831458459413005
+-1.76999999999991 0.00832931860558874
+-1.76899999999991 0.00834407038264694
+-1.76799999999991 0.00835883992723903
+-1.76699999999991 0.00837362724124948
+-1.76599999999991 0.00838843232651273
+-1.76499999999991 0.00840325518481313
+-1.76399999999991 0.00841809581788478
+-1.76299999999991 0.0084329542274115
+-1.76199999999991 0.00844783041502669
+-1.76099999999991 0.00846272438231326
+-1.75999999999991 0.00847763613080352
+-1.75899999999991 0.0084925656619791
+-1.75799999999991 0.00850751297727083
+-1.75699999999991 0.00852247807805867
+-1.75599999999991 0.00853746096567161
+-1.75499999999991 0.00855246164138756
+-1.75399999999991 0.00856748010643326
+-1.75299999999991 0.0085825163619842
+-1.75199999999991 0.00859757040916451
+-1.75099999999991 0.00861264224904688
+-1.74999999999991 0.00862773188265245
+-1.74899999999991 0.00864283931095071
+-1.74799999999991 0.00865796453485944
+-1.74699999999991 0.00867310755524457
+-1.74599999999991 0.00868826837292014
+-1.74499999999991 0.00870344698864813
+-1.74399999999991 0.00871864340313845
+-1.74299999999992 0.00873385761704879
+-1.74199999999992 0.00874908963098455
+-1.74099999999992 0.00876433944549873
+-1.73999999999992 0.00877960706109186
+-1.73899999999992 0.00879489247821187
+-1.73799999999992 0.00881019569725404
+-1.73699999999992 0.00882551671856088
+-1.73599999999992 0.00884085554242205
+-1.73499999999992 0.00885621216907423
+-1.73399999999992 0.0088715865987011
+-1.73299999999992 0.00888697883143317
+-1.73199999999992 0.00890238886734773
+-1.73099999999992 0.00891781670646875
+-1.72999999999992 0.00893326234876679
+-1.72899999999992 0.0089487257941589
+-1.72799999999992 0.00896420704250853
+-1.72699999999992 0.00897970609362543
+-1.72599999999992 0.00899522294726559
+-1.72499999999992 0.0090107576031311
+-1.72399999999992 0.0090263100608701
+-1.72299999999992 0.00904188032007665
+-1.72199999999992 0.00905746838029068
+-1.72099999999992 0.00907307424099787
+-1.71999999999992 0.00908869790162958
+-1.71899999999992 0.0091043393615627
+-1.71799999999992 0.00911999862011966
+-1.71699999999992 0.00913567567656825
+-1.71599999999992 0.00915137053012157
+-1.71499999999992 0.00916708317993792
+-1.71399999999992 0.00918281362512074
+-1.71299999999992 0.00919856186471847
+-1.71199999999992 0.00921432789772453
+-1.71099999999992 0.00923011172307716
+-1.70999999999992 0.00924591333965935
+-1.70899999999992 0.00926173274629878
+-1.70799999999992 0.0092775699417677
+-1.70699999999992 0.00929342492478284
+-1.70599999999992 0.00930929769400534
+-1.70499999999992 0.00932518824804064
+-1.70399999999992 0.0093410965854384
+-1.70299999999992 0.00935702270469242
+-1.70199999999992 0.00937296660424052
+-1.70099999999992 0.00938892828246449
+-1.69999999999992 0.00940490773768998
+-1.69899999999992 0.00942090496818639
+-1.69799999999992 0.00943691997216684
+-1.69699999999992 0.00945295274778802
+-1.69599999999992 0.00946900329315014
+-1.69499999999992 0.00948507160629682
+-1.69399999999992 0.00950115768521501
+-1.69299999999992 0.00951726152783492
+-1.69199999999992 0.00953338313202989
+-1.69099999999992 0.00954952249561635
+-1.68999999999992 0.00956567961635368
+-1.68899999999992 0.00958185449194418
+-1.68799999999992 0.00959804712003295
+-1.68699999999992 0.00961425749820779
+-1.68599999999992 0.00963048562399914
+-1.68499999999992 0.00964673149487999
+-1.68399999999992 0.00966299510826576
+-1.68299999999992 0.00967927646151428
+-1.68199999999992 0.00969557555192562
+-1.68099999999992 0.00971189237674207
+-1.67999999999992 0.00972822693314802
+-1.67899999999992 0.00974457921826991
+-1.67799999999992 0.00976094922917607
+-1.67699999999992 0.00977733696287672
+-1.67599999999992 0.00979374241632383
+-1.67499999999992 0.00981016558641105
+-1.67399999999992 0.00982660646997364
+-1.67299999999992 0.00984306506378835
+-1.67199999999992 0.00985954136457336
+-1.67099999999992 0.0098760353689882
+-1.66999999999992 0.00989254707363364
+-1.66899999999992 0.00990907647505163
+-1.66799999999992 0.00992562356972521
+-1.66699999999992 0.0099421883540784
+-1.66599999999992 0.00995877082447616
+-1.66499999999992 0.00997537097722428
+-1.66399999999992 0.00999198880856927
+-1.66299999999992 0.0100086243146984
+-1.66199999999992 0.0100252774917393
+-1.66099999999992 0.0100419483357604
+-1.65999999999992 0.0100586368427703
+-1.65899999999992 0.0100753430087181
+-1.65799999999992 0.010092066829493
+-1.65699999999992 0.0101088083009245
+-1.65599999999992 0.0101255674187821
+-1.65499999999992 0.0101423441787754
+-1.65399999999992 0.0101591385765537
+-1.65299999999992 0.0101759506077063
+-1.65199999999993 0.0101927802677624
+-1.65099999999993 0.0102096275521905
+-1.64999999999993 0.0102264924563991
+-1.64899999999993 0.0102433749757358
+-1.64799999999993 0.010260275105488
+-1.64699999999993 0.0102771928408822
+-1.64599999999993 0.0102941281770844
+-1.64499999999993 0.0103110811091994
+-1.64399999999993 0.0103280516322715
+-1.64299999999993 0.0103450397412839
+-1.64199999999993 0.0103620454311586
+-1.64099999999993 0.0103790686967566
+-1.63999999999993 0.0103961095328777
+-1.63899999999993 0.0104131679342603
+-1.63799999999993 0.0104302438955816
+-1.63699999999993 0.0104473374114572
+-1.63599999999993 0.0104644484764412
+-1.63499999999993 0.010481577085026
+-1.63399999999993 0.0104987232316425
+-1.63299999999993 0.0105158869106597
+-1.63199999999993 0.0105330681163848
+-1.63099999999993 0.010550266843063
+-1.62999999999993 0.0105674830848776
+-1.62899999999993 0.0105847168359497
+-1.62799999999993 0.0106019680903384
+-1.62699999999993 0.0106192368420404
+-1.62599999999993 0.0106365230849902
+-1.62499999999993 0.0106538268130598
+-1.62399999999993 0.0106711480200587
+-1.62299999999993 0.0106884866997341
+-1.62199999999993 0.0107058428457704
+-1.62099999999993 0.0107232164517893
+-1.61999999999993 0.0107406075113496
+-1.61899999999993 0.0107580160179476
+-1.61799999999993 0.0107754419650163
+-1.61699999999993 0.0107928853459259
+-1.61599999999993 0.0108103461539835
+-1.61499999999993 0.010827824382433
+-1.61399999999993 0.0108453200244551
+-1.61299999999993 0.0108628330731672
+-1.61199999999993 0.0108803635216232
+-1.61099999999993 0.0108979113628138
+-1.60999999999993 0.010915476589666
+-1.60899999999993 0.0109330591950431
+-1.60799999999993 0.0109506591717449
+-1.60699999999993 0.0109682765125074
+-1.60599999999993 0.0109859112100028
+-1.60499999999993 0.0110035632568394
+-1.60399999999993 0.0110212326455614
+-1.60299999999993 0.0110389193686491
+-1.60199999999993 0.0110566234185186
+-1.60099999999993 0.011074344787522
+-1.59999999999993 0.0110920834679468
+-1.59899999999993 0.0111098394520164
+-1.59799999999993 0.0111276127318899
+-1.59699999999993 0.0111454032996616
+-1.59599999999993 0.0111632111473616
+-1.59499999999993 0.011181036266955
+-1.59399999999993 0.0111988786503426
+-1.59299999999993 0.0112167382893601
+-1.59199999999993 0.0112346151757787
+-1.59099999999993 0.0112525093013043
+-1.58999999999993 0.0112704206575783
+-1.58899999999993 0.0112883492361766
+-1.58799999999993 0.0113062950286103
+-1.58699999999993 0.0113242580263252
+-1.58599999999993 0.0113422382207018
+-1.58499999999993 0.0113602356030554
+-1.58399999999993 0.0113782501646359
+-1.58299999999993 0.0113962818966276
+-1.58199999999993 0.0114143307901493
+-1.58099999999993 0.0114323968362544
+-1.57999999999993 0.0114504800259305
+-1.57899999999993 0.0114685803500993
+-1.57799999999993 0.0114866977996171
+-1.57699999999993 0.011504832365274
+-1.57599999999993 0.0115229840377943
+-1.57499999999993 0.0115411528078362
+-1.57399999999993 0.011559338665992
+-1.57299999999993 0.0115775416027877
+-1.57199999999993 0.0115957616086833
+-1.57099999999993 0.0116139986740723
+-1.56999999999993 0.0116322527892819
+-1.56899999999993 0.0116505239445731
+-1.56799999999993 0.0116688121301404
+-1.56699999999993 0.0116871173361115
+-1.56599999999993 0.0117054395525477
+-1.56499999999993 0.0117237787694438
+-1.56399999999993 0.0117421349767276
+-1.56299999999993 0.0117605081642602
+-1.56199999999993 0.011778898321836
+-1.56099999999994 0.0117973054391823
+-1.55999999999994 0.0118157295059594
+-1.55899999999994 0.0118341705117608
+-1.55799999999994 0.0118526284461126
+-1.55699999999994 0.011871103298474
+-1.55599999999994 0.0118895950582368
+-1.55499999999994 0.0119081037147256
+-1.55399999999994 0.0119266292571975
+-1.55299999999994 0.0119451716748423
+-1.55199999999994 0.0119637309567824
+-1.55099999999994 0.0119823070920725
+-1.54999999999994 0.0120009000696997
+-1.54899999999994 0.0120195098785837
+-1.54799999999994 0.0120381365075762
+-1.54699999999994 0.0120567799454612
+-1.54599999999994 0.0120754401809549
+-1.54499999999994 0.0120941172027055
+-1.54399999999994 0.0121128109992933
+-1.54299999999994 0.0121315215592307
+-1.54199999999994 0.0121502488709618
+-1.54099999999994 0.0121689929228628
+-1.53999999999994 0.0121877537032414
+-1.53899999999994 0.0122065312003372
+-1.53799999999994 0.0122253254023217
+-1.53699999999994 0.0122441362972977
+-1.53599999999994 0.0122629638732997
+-1.53499999999994 0.0122818081182937
+-1.53399999999994 0.0123006690201772
+-1.53299999999994 0.0123195465667791
+-1.53199999999994 0.0123384407458596
+-1.53099999999994 0.0123573515451101
+-1.52999999999994 0.0123762789521535
+-1.52899999999994 0.0123952229545435
+-1.52799999999994 0.0124141835397653
+-1.52699999999994 0.0124331606952349
+-1.52599999999994 0.0124521544082994
+-1.52499999999994 0.0124711646662369
+-1.52399999999994 0.0124901914562562
+-1.52299999999994 0.0125092347654973
+-1.52199999999994 0.0125282945810306
+-1.52099999999994 0.0125473708898575
+-1.51999999999994 0.01256646367891
+-1.51899999999994 0.0125855729350507
+-1.51799999999994 0.0126046986450728
+-1.51699999999994 0.0126238407957001
+-1.51599999999994 0.0126429993735868
+-1.51499999999994 0.0126621743653174
+-1.51399999999994 0.0126813657574071
+-1.51299999999994 0.012700573536301
+-1.51199999999994 0.0127197976883748
+-1.51099999999994 0.0127390381999343
+-1.50999999999994 0.0127582950572153
+-1.50899999999994 0.0127775682463841
+-1.50799999999994 0.0127968577535366
+-1.50699999999994 0.0128161635646991
+-1.50599999999994 0.0128354856658276
+-1.50499999999994 0.0128548240428082
+-1.50399999999994 0.0128741786814568
+-1.50299999999994 0.0128935495675189
+-1.50199999999994 0.0129129366866702
+-1.50099999999994 0.0129323400245157
+-1.49999999999994 0.0129517595665903
+-1.49899999999994 0.0129711952983585
+-1.49799999999994 0.0129906472052144
+-1.49699999999994 0.0130101152724814
+-1.49599999999994 0.0130295994854128
+-1.49499999999994 0.0130490998291909
+-1.49399999999994 0.0130686162889276
+-1.49299999999994 0.0130881488496641
+-1.49199999999994 0.013107697496371
+-1.49099999999994 0.0131272622139481
+-1.48999999999994 0.0131468429872242
+-1.48899999999994 0.0131664398009576
+-1.48799999999994 0.0131860526398354
+-1.48699999999994 0.013205681488474
+-1.48599999999994 0.0132253263314187
+-1.48499999999994 0.0132449871531439
+-1.48399999999994 0.0132646639380528
+-1.48299999999994 0.0132843566704776
+-1.48199999999994 0.0133040653346792
+-1.48099999999994 0.0133237899148476
+-1.47999999999994 0.0133435303951013
+-1.47899999999994 0.0133632867594877
+-1.47799999999994 0.0133830589919827
+-1.47699999999994 0.013402847076491
+-1.47599999999994 0.0134226509968458
+-1.47499999999994 0.013442470736809
+-1.47399999999994 0.0134623062800709
+-1.47299999999994 0.0134821576102503
+-1.47199999999994 0.0135020247108945
+-1.47099999999995 0.0135219075654791
+-1.46999999999995 0.0135418061574082
+-1.46899999999995 0.0135617204700141
+-1.46799999999995 0.0135816504865574
+-1.46699999999995 0.0136015961902269
+-1.46599999999995 0.0136215575641399
+-1.46499999999995 0.0136415345913414
+-1.46399999999995 0.013661527254805
+-1.46299999999995 0.013681535537432
+-1.46199999999995 0.013701559422052
+-1.46099999999995 0.0137215988914226
+-1.45999999999995 0.0137416539282293
+-1.45899999999995 0.0137617245150855
+-1.45799999999995 0.0137818106345327
+-1.45699999999995 0.0138019122690402
+-1.45599999999995 0.013822029401005
+-1.45499999999995 0.0138421620127522
+-1.45399999999995 0.0138623100865343
+-1.45299999999995 0.0138824736045319
+-1.45199999999995 0.0139026525488531
+-1.45099999999995 0.0139228469015337
+-1.44999999999995 0.0139430566445371
+-1.44899999999995 0.0139632817597544
+-1.44799999999995 0.0139835222290043
+-1.44699999999995 0.0140037780340329
+-1.44599999999995 0.014024049156514
+-1.44499999999995 0.0140443355780485
+-1.44399999999995 0.0140646372801653
+-1.44299999999995 0.0140849542443202
+-1.44199999999995 0.0141052864518967
+-1.44099999999995 0.0141256338842056
+-1.43999999999995 0.0141459965224849
+-1.43899999999995 0.0141663743479
+-1.43799999999995 0.0141867673415436
+-1.43699999999995 0.0142071754844355
+-1.43599999999995 0.0142275987575228
+-1.43499999999995 0.0142480371416797
+-1.43399999999995 0.0142684906177077
+-1.43299999999995 0.0142889591663353
+-1.43199999999995 0.0143094427682181
+-1.43099999999995 0.0143299414039389
+-1.42999999999995 0.0143504550540073
+-1.42899999999995 0.0143709836988601
+-1.42799999999995 0.014391527318861
+-1.42699999999995 0.0144120858943008
+-1.42599999999995 0.014432659405397
+-1.42499999999995 0.0144532478322943
+-1.42399999999995 0.014473851155064
+-1.42299999999995 0.0144944693537045
+-1.42199999999995 0.0145151024081409
+-1.42099999999995 0.014535750298225
+-1.41999999999995 0.0145564130037358
+-1.41899999999995 0.0145770905043786
+-1.41799999999995 0.0145977827797857
+-1.41699999999995 0.0146184898095162
+-1.41599999999995 0.0146392115730556
+-1.41499999999995 0.0146599480498163
+-1.41399999999995 0.0146806992191373
+-1.41299999999995 0.0147014650602843
+-1.41199999999995 0.0147222455524495
+-1.41099999999995 0.0147430406747518
+-1.40999999999995 0.0147638504062366
+-1.40899999999995 0.0147846747258758
+-1.40799999999995 0.014805513612568
+-1.40699999999995 0.0148263670451382
+-1.40599999999995 0.0148472350023379
+-1.40499999999995 0.0148681174628452
+-1.40399999999995 0.0148890144052644
+-1.40299999999995 0.0149099258081265
+-1.40199999999995 0.0149308516498889
+-1.40099999999995 0.0149517919089351
+-1.39999999999995 0.0149727465635755
+-1.39899999999995 0.0149937155920464
+-1.39799999999995 0.0150146989725107
+-1.39699999999995 0.0150356966830576
+-1.39599999999995 0.0150567087017027
+-1.39499999999995 0.0150777350063878
+-1.39399999999995 0.015098775574981
+-1.39299999999995 0.0151198303852767
+-1.39199999999995 0.0151408994149956
+-1.39099999999995 0.0151619826417847
+-1.38999999999995 0.0151830800432171
+-1.38899999999995 0.0152041915967923
+-1.38799999999995 0.0152253172799359
+-1.38699999999995 0.0152464570699997
+-1.38599999999995 0.0152676109442618
+-1.38499999999995 0.0152887788799263
+-1.38399999999995 0.0153099608541237
+-1.38299999999995 0.0153311568439104
+-1.38199999999995 0.0153523668262692
+-1.38099999999995 0.0153735907781088
+-1.37999999999996 0.0153948286762643
+-1.37899999999996 0.0154160804974967
+-1.37799999999996 0.0154373462184932
+-1.37699999999996 0.015458625815867
+-1.37599999999996 0.0154799192661575
+-1.37499999999996 0.0155012265458303
+-1.37399999999996 0.0155225476312767
+-1.37299999999996 0.0155438824988146
+-1.37199999999996 0.0155652311246874
+-1.37099999999996 0.0155865934850649
+-1.36999999999996 0.015607969556043
+-1.36899999999996 0.0156293593136434
+-1.36799999999996 0.0156507627338141
+-1.36699999999996 0.0156721797924288
+-1.36599999999996 0.0156936104652875
+-1.36499999999996 0.0157150547281163
+-1.36399999999996 0.015736512556567
+-1.36299999999996 0.0157579839262176
+-1.36199999999996 0.0157794688125722
+-1.36099999999996 0.0158009671910607
+-1.35999999999996 0.0158224790370392
+-1.35899999999996 0.0158440043257898
+-1.35799999999996 0.0158655430325204
+-1.35699999999996 0.0158870951323651
+-1.35599999999996 0.015908660600384
+-1.35499999999996 0.015930239411563
+-1.35399999999996 0.0159518315408143
+-1.35299999999996 0.0159734369629759
+-1.35199999999996 0.0159950556528118
+-1.35099999999996 0.0160166875850121
+-1.34999999999996 0.0160383327341929
+-1.34899999999996 0.0160599910748961
+-1.34799999999996 0.01608166258159
+-1.34699999999996 0.0161033472286684
+-1.34599999999996 0.0161250449904517
+-1.34499999999996 0.0161467558411858
+-1.34399999999996 0.0161684797550428
+-1.34299999999996 0.016190216706121
+-1.34199999999996 0.0162119666684445
+-1.34099999999996 0.0162337296159635
+-1.33999999999996 0.0162555055225543
+-1.33899999999996 0.0162772943620191
+-1.33799999999996 0.0162990961080862
+-1.33699999999996 0.0163209107344101
+-1.33599999999996 0.0163427382145712
+-1.33499999999996 0.016364578522076
+-1.33399999999996 0.016386431630357
+-1.33299999999996 0.016408297512773
+-1.33199999999996 0.0164301761426087
+-1.33099999999996 0.0164520674930749
+-1.32999999999996 0.0164739715373085
+-1.32899999999996 0.0164958882483728
+-1.32799999999996 0.0165178175992568
+-1.32699999999996 0.0165397595628759
+-1.32599999999996 0.0165617141120715
+-1.32499999999996 0.0165836812196113
+-1.32399999999996 0.0166056608581891
+-1.32299999999996 0.0166276530004248
+-1.32199999999996 0.0166496576188646
+-1.32099999999996 0.0166716746859809
+-1.31999999999996 0.0166937041741722
+-1.31899999999996 0.0167157460557634
+-1.31799999999996 0.0167378003030054
+-1.31699999999996 0.0167598668880756
+-1.31599999999996 0.0167819457830775
+-1.31499999999996 0.0168040369600409
+-1.31399999999996 0.0168261403909221
+-1.31299999999996 0.0168482560476035
+-1.31199999999996 0.0168703839018938
+-1.31099999999996 0.0168925239255281
+-1.30999999999996 0.0169146760901681
+-1.30899999999996 0.0169368403674014
+-1.30799999999996 0.0169590167287424
+-1.30699999999996 0.0169812051456317
+-1.30599999999996 0.0170034055894365
+-1.30499999999996 0.0170256180314503
+-1.30399999999996 0.017047842442893
+-1.30299999999996 0.0170700787949112
+-1.30199999999996 0.017092327058578
+-1.30099999999996 0.0171145872048927
+-1.29999999999996 0.0171368592047815
+-1.29899999999996 0.0171591430290971
+-1.29799999999996 0.0171814386486186
+-1.29699999999996 0.017203746034052
+-1.29599999999996 0.0172260651560296
+-1.29499999999996 0.0172483959851105
+-1.29399999999996 0.0172707384917807
+-1.29299999999996 0.0172930926464526
+-1.29199999999996 0.0173154584194653
+-1.29099999999996 0.0173378357810849
+-1.28999999999996 0.0173602247015041
+-1.28899999999997 0.0173826251508424
+-1.28799999999997 0.0174050370991462
+-1.28699999999997 0.0174274605163887
+-1.28599999999997 0.0174498953724699
+-1.28499999999997 0.0174723416372168
+-1.28399999999997 0.0174947992803833
+-1.28299999999997 0.0175172682716503
+-1.28199999999997 0.0175397485806255
+-1.28099999999997 0.0175622401768438
+-1.27999999999997 0.017584743029767
+-1.27899999999997 0.0176072571087841
+-1.27799999999997 0.0176297823832111
+-1.27699999999997 0.0176523188222912
+-1.27599999999997 0.0176748663951945
+-1.27499999999997 0.0176974250710187
+-1.27399999999997 0.0177199948187884
+-1.27299999999997 0.0177425756074555
+-1.27199999999997 0.0177651674058993
+-1.27099999999997 0.0177877701829262
+-1.26999999999997 0.0178103839072701
+-1.26899999999997 0.0178330085475923
+-1.26799999999997 0.0178556440724813
+-1.26699999999997 0.0178782904504534
+-1.26599999999997 0.0179009476499519
+-1.26499999999997 0.017923615639348
+-1.26399999999997 0.0179462943869402
+-1.26299999999997 0.0179689838609548
+-1.26199999999997 0.0179916840295455
+-1.26099999999997 0.0180143948607938
+-1.25999999999997 0.0180371163227088
+-1.25899999999997 0.0180598483832273
+-1.25799999999997 0.0180825910102139
+-1.25699999999997 0.018105344171461
+-1.25599999999997 0.018128107834689
+-1.25499999999997 0.0181508819675458
+-1.25399999999997 0.0181736665376075
+-1.25299999999997 0.0181964615123781
+-1.25199999999997 0.0182192668592895
+-1.25099999999997 0.0182420825457018
+-1.24999999999997 0.0182649085389029
+-1.24899999999997 0.0182877448061091
+-1.24799999999997 0.0183105913144647
+-1.24699999999997 0.0183334480310422
+-1.24599999999997 0.0183563149228424
+-1.24499999999997 0.0183791919567943
+-1.24399999999997 0.0184020790997553
+-1.24299999999997 0.0184249763185111
+-1.24199999999997 0.0184478835797759
+-1.24099999999997 0.0184708008501922
+-1.23999999999997 0.0184937280963312
+-1.23899999999997 0.0185166652846924
+-1.23799999999997 0.0185396123817042
+-1.23699999999997 0.0185625693537233
+-1.23599999999997 0.0185855361670352
+-1.23499999999997 0.0186085127878544
+-1.23399999999997 0.0186314991823237
+-1.23299999999997 0.0186544953165151
+-1.23199999999997 0.0186775011564293
+-1.23099999999997 0.0187005166679959
+-1.22999999999997 0.0187235418170736
+-1.22899999999997 0.01874657656945
+-1.22799999999997 0.0187696208908417
+-1.22699999999997 0.0187926747468947
+-1.22599999999997 0.0188157381031838
+-1.22499999999997 0.0188388109252133
+-1.22399999999997 0.0188618931784166
+-1.22299999999997 0.0188849848281565
+-1.22199999999997 0.0189080858397252
+-1.22099999999997 0.0189311961783442
+-1.21999999999997 0.0189543158091647
+-1.21899999999997 0.018977444697267
+-1.21799999999997 0.0190005828076616
+-1.21699999999997 0.0190237301052881
+-1.21599999999997 0.019046886555016
+-1.21499999999997 0.0190700521216446
+-1.21399999999997 0.0190932267699029
+-1.21299999999997 0.0191164104644498
+-1.21199999999997 0.0191396031698742
+-1.21099999999997 0.0191628048506949
+-1.20999999999997 0.0191860154713605
+-1.20899999999997 0.0192092349962502
+-1.20799999999997 0.0192324633896729
+-1.20699999999997 0.0192557006158678
+-1.20599999999997 0.0192789466390044
+-1.20499999999997 0.0193022014231827
+-1.20399999999997 0.0193254649324328
+-1.20299999999997 0.0193487371307153
+-1.20199999999997 0.0193720179819214
+-1.20099999999997 0.0193953074498728
+-1.19999999999997 0.0194186054983219
+-1.19899999999997 0.0194419120909516
+-1.19799999999998 0.0194652271913757
+-1.19699999999998 0.0194885507631388
+-1.19599999999998 0.0195118827697163
+-1.19499999999998 0.0195352231745146
+-1.19399999999998 0.019558571940871
+-1.19299999999998 0.019581929032054
+-1.19199999999998 0.0196052944112632
+-1.19099999999998 0.0196286680416292
+-1.18999999999998 0.0196520498862142
+-1.18899999999998 0.0196754399080114
+-1.18799999999998 0.0196988380699456
+-1.18699999999998 0.0197222443348729
+-1.18599999999998 0.0197456586655811
+-1.18499999999998 0.0197690810247894
+-1.18399999999998 0.0197925113751488
+-1.18299999999998 0.0198159496792419
+-1.18199999999998 0.0198393958995833
+-1.18099999999998 0.0198628499986193
+-1.17999999999998 0.0198863119387281
+-1.17899999999998 0.0199097816822201
+-1.17799999999998 0.0199332591913376
+-1.17699999999998 0.0199567444282551
+-1.17599999999998 0.0199802373550793
+-1.17499999999998 0.0200037379338493
+-1.17399999999998 0.0200272461265364
+-1.17299999999998 0.0200507618950444
+-1.17199999999998 0.0200742852012097
+-1.17099999999998 0.0200978160068011
+-1.16999999999998 0.0201213542735202
+-1.16899999999998 0.0201448999630014
+-1.16799999999998 0.0201684530368116
+-1.16699999999998 0.0201920134564508
+-1.16599999999998 0.0202155811833521
+-1.16499999999998 0.0202391561788812
+-1.16399999999998 0.0202627384043374
+-1.16299999999998 0.0202863278209528
+-1.16199999999998 0.020309924389893
+-1.16099999999998 0.0203335280722568
+-1.15999999999998 0.0203571388290764
+-1.15899999999998 0.0203807566213177
+-1.15799999999998 0.02040438140988
+-1.15699999999998 0.0204280131555963
+-1.15599999999998 0.0204516518192333
+-1.15499999999998 0.0204752973614915
+-1.15399999999998 0.0204989497430055
+-1.15299999999998 0.0205226089243435
+-1.15199999999998 0.0205462748660082
+-1.15099999999998 0.020569947528436
+-1.14999999999998 0.0205936268719979
+-1.14899999999998 0.0206173128569991
+-1.14799999999998 0.0206410054436789
+-1.14699999999998 0.0206647045922115
+-1.14599999999998 0.0206884102627054
+-1.14499999999998 0.0207121224152038
+-1.14399999999998 0.0207358410096846
+-1.14299999999998 0.0207595660060607
+-1.14199999999998 0.0207832973641795
+-1.14099999999998 0.0208070350438238
+-1.13999999999998 0.0208307790047113
+-1.13899999999998 0.0208545292064947
+-1.13799999999998 0.0208782856087622
+-1.13699999999998 0.0209020481710373
+-1.13599999999998 0.0209258168527787
+-1.13499999999998 0.0209495916133808
+-1.13399999999998 0.0209733724121737
+-1.13299999999998 0.0209971592084228
+-1.13199999999998 0.0210209519613297
+-1.13099999999998 0.0210447506300317
+-1.12999999999998 0.0210685551736019
+-1.12899999999998 0.0210923655510498
+-1.12799999999998 0.0211161817213207
+-1.12699999999998 0.0211400036432964
+-1.12599999999998 0.0211638312757948
+-1.12499999999998 0.0211876645775704
+-1.12399999999998 0.021211503507314
+-1.12299999999998 0.0212353480236534
+-1.12199999999998 0.0212591980851527
+-1.12099999999998 0.021283053650313
+-1.11999999999998 0.0213069146775722
+-1.11899999999998 0.0213307811253052
+-1.11799999999998 0.0213546529518241
+-1.11699999999998 0.0213785301153781
+-1.11599999999998 0.0214024125741536
+-1.11499999999998 0.0214263002862745
+-1.11399999999998 0.021450193209802
+-1.11299999999998 0.0214740913027351
+-1.11199999999998 0.0214979945230104
+-1.11099999999998 0.021521902828502
+-1.10999999999998 0.0215458161770223
+-1.10899999999998 0.0215697345263214
+-1.10799999999998 0.0215936578340875
+-1.10699999999999 0.0216175860579469
+-1.10599999999999 0.0216415191554644
+-1.10499999999999 0.0216654570841429
+-1.10399999999999 0.0216893998014239
+-1.10299999999999 0.0217133472646875
+-1.10199999999999 0.0217372994312525
+-1.10099999999999 0.0217612562583763
+-1.09999999999999 0.0217852177032554
+-1.09899999999999 0.0218091837230251
+-1.09799999999999 0.0218331542747599
+-1.09699999999999 0.0218571293154736
+-1.09599999999999 0.021881108802119
+-1.09499999999999 0.0219050926915885
+-1.09399999999999 0.0219290809407141
+-1.09299999999999 0.0219530735062673
+-1.09199999999999 0.0219770703449592
+-1.09099999999999 0.022001071413441
+-1.08999999999999 0.0220250766683036
+-1.08899999999999 0.0220490860660782
+-1.08799999999999 0.022073099563236
+-1.08699999999999 0.0220971171161884
+-1.08599999999999 0.0221211386812873
+-1.08499999999999 0.022145164214825
+-1.08399999999999 0.0221691936730345
+-1.08299999999999 0.0221932270120895
+-1.08199999999999 0.0222172641881044
+-1.08099999999999 0.0222413051571345
+-1.07999999999999 0.0222653498751764
+-1.07899999999999 0.0222893982981676
+-1.07799999999999 0.022313450381987
+-1.07699999999999 0.0223375060824548
+-1.07599999999999 0.0223615653553328
+-1.07499999999999 0.0223856281563242
+-1.07399999999999 0.0224096944410742
+-1.07299999999999 0.0224337641651696
+-1.07199999999999 0.0224578372841393
+-1.07099999999999 0.0224819137534541
+-1.06999999999999 0.0225059935285272
+-1.06899999999999 0.022530076564714
+-1.06799999999999 0.0225541628173123
+-1.06699999999999 0.0225782522415623
+-1.06599999999999 0.0226023447926472
+-1.06499999999999 0.0226264404256926
+-1.06399999999999 0.0226505390957673
+-1.06299999999999 0.0226746407578828
+-1.06199999999999 0.022698745366994
+-1.06099999999999 0.0227228528779989
+-1.05999999999999 0.0227469632457388
+-1.05899999999999 0.0227710764249987
+-1.05799999999999 0.0227951923705071
+-1.05699999999999 0.0228193110369361
+-1.05599999999999 0.0228434323789018
+-1.05499999999999 0.0228675563509643
+-1.05399999999999 0.0228916829076278
+-1.05299999999999 0.0229158120033405
+-1.05199999999999 0.0229399435924951
+-1.05099999999999 0.0229640776294289
+-1.04999999999999 0.0229882140684235
+-1.04899999999999 0.0230123528637055
+-1.04799999999999 0.0230364939694461
+-1.04699999999999 0.0230606373397617
+-1.04599999999999 0.0230847829287136
+-1.04499999999999 0.0231089306903083
+-1.04399999999999 0.0231330805784979
+-1.04299999999999 0.0231572325471796
+-1.04199999999999 0.0231813865501966
+-1.04099999999999 0.0232055425413374
+-1.03999999999999 0.0232297004743368
+-1.03899999999999 0.0232538603028752
+-1.03799999999999 0.0232780219805794
+-1.03699999999999 0.0233021854610223
+-1.03599999999999 0.0233263506977231
+-1.03499999999999 0.0233505176441477
+-1.03399999999999 0.0233746862537084
+-1.03299999999999 0.0233988564797645
+-1.03199999999999 0.0234230282756221
+-1.03099999999999 0.0234472015945343
+-1.02999999999999 0.0234713763897013
+-1.02899999999999 0.0234955526142708
+-1.02799999999999 0.0235197302213378
+-1.02699999999999 0.0235439091639447
+-1.02599999999999 0.0235680893950819
+-1.02499999999999 0.0235922708676874
+-1.02399999999999 0.0236164535346473
+-1.02299999999999 0.0236406373487958
+-1.02199999999999 0.0236648222629151
+-1.02099999999999 0.0236890082297361
+-1.01999999999999 0.0237131952019381
+-1.01899999999999 0.0237373831321488
+-1.01799999999999 0.0237615719729451
+-1.017 0.0237857616768525
+-1.016 0.0238099521963456
+-1.015 0.0238341434838483
+-1.014 0.0238583354917337
+-1.013 0.0238825281723246
+-1.012 0.0239067214778932
+-1.011 0.0239309153606615
+-1.01 0.0239551097728014
+-1.009 0.0239793046664349
+-1.008 0.0240034999936341
+-1.007 0.0240276957064213
+-1.006 0.0240518917567695
+-1.005 0.0240760880966022
+-1.004 0.0241002846777935
+-1.003 0.0241244814521687
+-1.002 0.0241486783715038
+-1.001 0.0241728753875262
+-0.999999999999997 0.0241970724519144
+-0.998999999999997 0.0242212695162986
+-0.997999999999997 0.0242454665322605
+-0.996999999999997 0.0242696634513335
+-0.995999999999997 0.0242938602250029
+-0.994999999999997 0.0243180568047062
+-0.993999999999997 0.0243422531418328
+-0.992999999999997 0.0243664491877248
+-0.991999999999997 0.0243906448936765
+-0.990999999999997 0.024414840210935
+-0.989999999999997 0.0244390350907
+-0.988999999999997 0.0244632294841243
+-0.987999999999997 0.0244874233423138
+-0.986999999999997 0.0245116166163273
+-0.985999999999997 0.0245358092571774
+-0.984999999999997 0.0245600012158301
+-0.983999999999997 0.0245841924432048
+-0.982999999999997 0.0246083828901751
+-0.981999999999997 0.0246325725075684
+-0.980999999999997 0.0246567612461662
+-0.979999999999997 0.0246809490567044
+-0.978999999999997 0.0247051358898732
+-0.977999999999997 0.0247293216963175
+-0.976999999999997 0.0247535064266368
+-0.975999999999997 0.0247776900313858
+-0.974999999999997 0.0248018724610738
+-0.973999999999997 0.0248260536661656
+-0.972999999999997 0.0248502335970814
+-0.971999999999997 0.0248744122041967
+-0.970999999999997 0.0248985894378428
+-0.969999999999997 0.0249227652483067
+-0.968999999999997 0.0249469395858315
+-0.967999999999997 0.0249711124006164
+-0.966999999999997 0.024995283642817
+-0.965999999999997 0.0250194532625451
+-0.964999999999997 0.0250436212098692
+-0.963999999999997 0.0250677874348147
+-0.962999999999997 0.0250919518873638
+-0.961999999999997 0.0251161145174557
+-0.960999999999997 0.0251402752749871
+-0.959999999999997 0.0251644341098118
+-0.958999999999997 0.0251885909717413
+-0.957999999999997 0.025212745810545
+-0.956999999999997 0.0252368985759497
+-0.955999999999997 0.0252610492176407
+-0.954999999999997 0.0252851976852613
+-0.953999999999997 0.0253093439284132
+-0.952999999999997 0.0253334878966566
+-0.951999999999997 0.0253576295395103
+-0.950999999999997 0.0253817688064522
+-0.949999999999997 0.025405905646919
+-0.948999999999997 0.0254300400103066
+-0.947999999999997 0.0254541718459702
+-0.946999999999997 0.0254783011032247
+-0.945999999999997 0.0255024277313445
+-0.944999999999997 0.0255265516795638
+-0.943999999999997 0.025550672897077
+-0.942999999999997 0.0255747913330383
+-0.941999999999997 0.0255989069365627
+-0.940999999999997 0.0256230196567253
+-0.939999999999997 0.0256471294425621
+-0.938999999999997 0.0256712362430698
+-0.937999999999997 0.025695340007206
+-0.936999999999997 0.0257194406838898
+-0.935999999999997 0.0257435382220013
+-0.934999999999997 0.0257676325703822
+-0.933999999999997 0.025791723677836
+-0.932999999999997 0.0258158114931278
+-0.931999999999997 0.0258398959649849
+-0.930999999999997 0.0258639770420967
+-0.929999999999997 0.025888054673115
+-0.928999999999997 0.0259121288066539
+-0.927999999999997 0.0259361993912905
+-0.926999999999997 0.0259602663755646
+-0.925999999999997 0.0259843297079789
+-0.924999999999997 0.0260083893369996
+-0.923999999999997 0.0260324452110561
+-0.922999999999997 0.0260564972785413
+-0.921999999999997 0.0260805454878118
+-0.920999999999997 0.0261045897871883
+-0.919999999999997 0.0261286301249554
+-0.918999999999997 0.0261526664493619
+-0.917999999999997 0.0261766987086212
+-0.916999999999997 0.026200726850911
+-0.915999999999997 0.0262247508243741
+-0.914999999999997 0.026248770577118
+-0.913999999999997 0.0262727860572153
+-0.912999999999997 0.0262967972127041
+-0.911999999999997 0.0263208039915878
+-0.910999999999997 0.0263448063418354
+-0.909999999999997 0.0263688042113819
+-0.908999999999997 0.0263927975481281
+-0.907999999999997 0.0264167862999411
+-0.906999999999997 0.0264407704146544
+-0.905999999999997 0.0264647498400677
+-0.904999999999997 0.0264887245239479
+-0.903999999999997 0.0265126944140284
+-0.902999999999997 0.0265366594580099
+-0.901999999999997 0.0265606196035601
+-0.900999999999997 0.0265845747983144
+-0.899999999999997 0.0266085249898756
+-0.898999999999997 0.0266324701258143
+-0.897999999999997 0.0266564101536693
+-0.896999999999997 0.0266803450209473
+-0.895999999999997 0.0267042746751233
+-0.894999999999997 0.0267281990636411
+-0.893999999999997 0.0267521181339128
+-0.892999999999997 0.0267760318333198
+-0.891999999999997 0.0267999401092121
+-0.890999999999997 0.0268238429089093
+-0.889999999999997 0.0268477401797003
+-0.888999999999997 0.0268716318688436
+-0.887999999999997 0.0268955179235675
+-0.886999999999997 0.0269193982910703
+-0.885999999999997 0.0269432729185204
+-0.884999999999997 0.0269671417530566
+-0.883999999999997 0.0269910047417882
+-0.882999999999997 0.0270148618317952
+-0.881999999999997 0.0270387129701286
+-0.880999999999997 0.0270625581038104
+-0.879999999999997 0.0270863971798339
+-0.878999999999997 0.0271102301451638
+-0.877999999999997 0.0271340569467365
+-0.876999999999997 0.0271578775314603
+-0.875999999999997 0.0271816918462155
+-0.874999999999997 0.0272054998378544
+-0.873999999999997 0.0272293014532021
+-0.872999999999997 0.0272530966390559
+-0.871999999999997 0.0272768853421861
+-0.870999999999997 0.0273006675093359
+-0.869999999999997 0.0273244430872217
+-0.868999999999997 0.0273482120225332
+-0.867999999999997 0.0273719742619336
+-0.866999999999997 0.0273957297520598
+-0.865999999999997 0.0274194784395229
+-0.864999999999997 0.0274432202709078
+-0.863999999999997 0.0274669551927738
+-0.862999999999997 0.0274906831516546
+-0.861999999999997 0.0275144040940588
+-0.860999999999997 0.0275381179664697
+-0.859999999999997 0.0275618247153458
+-0.858999999999997 0.0275855242871206
+-0.857999999999997 0.0276092166282033
+-0.856999999999997 0.0276329016849788
+-0.855999999999997 0.0276565794038076
+-0.854999999999997 0.0276802497310264
+-0.853999999999997 0.027703912612948
+-0.852999999999997 0.0277275679958618
+-0.851999999999997 0.0277512158260337
+-0.850999999999997 0.0277748560497064
+-0.849999999999997 0.0277984886130997
+-0.848999999999997 0.0278221134624106
+-0.847999999999997 0.0278457305438133
+-0.846999999999997 0.0278693398034598
+-0.845999999999997 0.0278929411874799
+-0.844999999999997 0.0279165346419813
+-0.843999999999997 0.0279401201130499
+-0.842999999999997 0.02796369754675
+-0.841999999999997 0.0279872668891244
+-0.840999999999997 0.0280108280861949
+-0.839999999999997 0.0280343810839621
+-0.838999999999997 0.0280579258284058
+-0.837999999999997 0.0280814622654852
+-0.836999999999997 0.028104990341139
+-0.835999999999997 0.0281285100012857
+-0.834999999999997 0.028152021191824
+-0.833999999999997 0.0281755238586324
+-0.832999999999997 0.0281990179475699
+-0.831999999999997 0.0282225034044763
+-0.830999999999997 0.0282459801751719
+-0.829999999999997 0.0282694482054581
+-0.828999999999997 0.0282929074411174
+-0.827999999999997 0.0283163578279137
+-0.826999999999997 0.0283397993115925
+-0.825999999999997 0.0283632318378811
+-0.824999999999997 0.0283866553524888
+-0.823999999999997 0.028410069801107
+-0.822999999999997 0.0284334751294094
+-0.821999999999997 0.0284568712830525
+-0.820999999999997 0.0284802582076756
+-0.819999999999997 0.0285036358489008
+-0.818999999999997 0.0285270041523335
+-0.817999999999997 0.0285503630635625
+-0.816999999999997 0.0285737125281602
+-0.815999999999997 0.0285970524916829
+-0.814999999999997 0.0286203828996708
+-0.813999999999997 0.0286437036976483
+-0.812999999999997 0.0286670148311243
+-0.811999999999997 0.0286903162455923
+-0.810999999999997 0.0287136078865307
+-0.809999999999997 0.0287368896994029
+-0.808999999999997 0.0287601616296575
+-0.807999999999997 0.0287834236227287
+-0.806999999999997 0.0288066756240361
+-0.805999999999997 0.0288299175789854
+-0.804999999999997 0.0288531494329683
+-0.803999999999997 0.0288763711313629
+-0.802999999999997 0.0288995826195335
+-0.801999999999997 0.0289227838428314
+-0.800999999999997 0.0289459747465946
+-0.799999999999997 0.0289691552761484
+-0.798999999999997 0.0289923253768052
+-0.797999999999997 0.0290154849938651
+-0.796999999999997 0.029038634072616
+-0.795999999999997 0.0290617725583335
+-0.794999999999997 0.0290849003962815
+-0.793999999999997 0.0291080175317124
+-0.792999999999997 0.0291311239098669
+-0.791999999999997 0.0291542194759748
+-0.790999999999997 0.0291773041752546
+-0.789999999999997 0.0292003779529142
+-0.788999999999997 0.0292234407541509
+-0.787999999999997 0.0292464925241515
+-0.786999999999997 0.0292695332080929
+-0.785999999999997 0.0292925627511417
+-0.784999999999997 0.0293155810984551
+-0.783999999999997 0.0293385881951806
+-0.782999999999997 0.0293615839864563
+-0.781999999999997 0.0293845684174116
+-0.780999999999997 0.0294075414331665
+-0.779999999999997 0.0294305029788326
+-0.778999999999997 0.0294534529995131
+-0.777999999999997 0.0294763914403028
+-0.776999999999997 0.0294993182462885
+-0.775999999999997 0.0295222333625492
+-0.774999999999997 0.0295451367341564
+-0.773999999999997 0.029568028306174
+-0.772999999999997 0.0295909080236588
+-0.771999999999997 0.0296137758316607
+-0.770999999999997 0.0296366316752228
+-0.769999999999997 0.0296594754993817
+-0.768999999999997 0.0296823072491675
+-0.767999999999997 0.0297051268696046
+-0.766999999999997 0.029727934305711
+-0.765999999999997 0.0297507295024995
+-0.764999999999997 0.029773512404977
+-0.763999999999997 0.0297962829581455
+-0.762999999999997 0.0298190411070019
+-0.761999999999997 0.0298417867965381
+-0.760999999999997 0.0298645199717415
+-0.759999999999997 0.0298872405775954
+-0.758999999999997 0.0299099485590784
+-0.757999999999997 0.0299326438611657
+-0.756999999999997 0.0299553264288284
+-0.755999999999997 0.0299779962070343
+-0.754999999999997 0.0300006531407478
+-0.753999999999997 0.0300232971749301
+-0.752999999999997 0.0300459282545399
+-0.751999999999997 0.030068546324533
+-0.750999999999997 0.0300911513298628
+-0.749999999999997 0.0301137432154805
+-0.748999999999997 0.0301363219263354
+-0.747999999999997 0.0301588874073751
+-0.746999999999997 0.0301814396035453
+-0.745999999999997 0.0302039784597908
+-0.744999999999997 0.030226503921055
+-0.743999999999997 0.0302490159322806
+-0.742999999999997 0.0302715144384094
+-0.741999999999997 0.0302939993843831
+-0.740999999999997 0.0303164707151429
+-0.739999999999997 0.0303389283756301
+-0.738999999999997 0.0303613723107861
+-0.737999999999997 0.0303838024655528
+-0.736999999999997 0.0304062187848729
+-0.735999999999997 0.0304286212136897
+-0.734999999999997 0.0304510096969478
+-0.733999999999997 0.0304733841795931
+-0.732999999999997 0.0304957446065729
+-0.731999999999997 0.0305180909228364
+-0.730999999999997 0.0305404230733346
+-0.729999999999997 0.0305627410030211
+-0.728999999999997 0.0305850446568514
+-0.727999999999997 0.030607333979784
+-0.726999999999997 0.0306296089167802
+-0.725999999999997 0.0306518694128043
+-0.724999999999997 0.0306741154128241
+-0.723999999999997 0.0306963468618106
+-0.722999999999997 0.030718563704739
+-0.721999999999997 0.030740765886588
+-0.720999999999997 0.030762953352341
+-0.719999999999997 0.0307851260469854
+-0.718999999999997 0.0308072839155135
+-0.717999999999997 0.0308294269029224
+-0.716999999999997 0.0308515549542144
+-0.715999999999997 0.0308736680143968
+-0.714999999999997 0.030895766028483
+-0.713999999999997 0.0309178489414915
+-0.712999999999997 0.0309399166984474
+-0.711999999999997 0.0309619692443816
+-0.710999999999997 0.0309840065243316
+-0.709999999999997 0.0310060284833417
+-0.708999999999997 0.0310280350664628
+-0.707999999999997 0.0310500262187532
+-0.706999999999997 0.0310720018852783
+-0.705999999999997 0.0310939620111113
+-0.704999999999997 0.031115906541333
+-0.703999999999997 0.0311378354210322
+-0.702999999999997 0.0311597485953062
+-0.701999999999997 0.0311816460092605
+-0.700999999999997 0.0312035276080095
+-0.699999999999997 0.0312253933366762
+-0.698999999999997 0.0312472431403931
+-0.697999999999997 0.031269076964302
+-0.696999999999997 0.031290894753554
+-0.695999999999997 0.0313126964533105
+-0.694999999999997 0.0313344820087425
+-0.693999999999997 0.0313562513650315
+-0.692999999999997 0.0313780044673696
+-0.691999999999997 0.0313997412609593
+-0.690999999999997 0.0314214616910145
+-0.689999999999997 0.0314431657027598
+-0.688999999999997 0.0314648532414316
+-0.687999999999997 0.0314865242522778
+-0.686999999999997 0.031508178680558
+-0.685999999999997 0.0315298164715442
+-0.684999999999997 0.0315514375705204
+-0.683999999999996 0.0315730419227834
+-0.682999999999996 0.0315946294736428
+-0.681999999999996 0.0316162001684208
+-0.680999999999996 0.0316377539524533
+-0.679999999999996 0.0316592907710894
+-0.678999999999996 0.0316808105696919
+-0.677999999999996 0.0317023132936376
+-0.676999999999996 0.0317237988883174
+-0.675999999999996 0.0317452672991365
+-0.674999999999996 0.0317667184715149
+-0.673999999999996 0.0317881523508871
+-0.672999999999996 0.031809568882703
+-0.671999999999996 0.0318309680124275
+-0.670999999999996 0.0318523496855412
+-0.669999999999996 0.0318737138475402
+-0.668999999999996 0.031895060443937
+-0.667999999999996 0.0319163894202597
+-0.666999999999996 0.0319377007220535
+-0.665999999999996 0.0319589942948796
+-0.664999999999996 0.0319802700843165
+-0.663999999999996 0.0320015280359598
+-0.662999999999996 0.0320227680954222
+-0.661999999999996 0.0320439902083341
+-0.660999999999996 0.0320651943203437
+-0.659999999999996 0.0320863803771173
+-0.658999999999996 0.0321075483243394
+-0.657999999999996 0.0321286981077129
+-0.656999999999996 0.0321498296729595
+-0.655999999999996 0.0321709429658199
+-0.654999999999996 0.0321920379320538
+-0.653999999999996 0.0322131145174405
+-0.652999999999996 0.0322341726677789
+-0.651999999999996 0.0322552123288876
+-0.650999999999996 0.0322762334466054
+-0.649999999999996 0.0322972359667915
+-0.648999999999996 0.0323182198353256
+-0.647999999999996 0.0323391849981081
+-0.646999999999996 0.0323601314010605
+-0.645999999999996 0.0323810589901255
+-0.644999999999996 0.0324019677112674
+-0.643999999999996 0.032422857510472
+-0.642999999999996 0.0324437283337472
+-0.641999999999996 0.0324645801271229
+-0.640999999999996 0.0324854128366516
+-0.639999999999996 0.0325062264084083
+-0.638999999999996 0.0325270207884908
+-0.637999999999996 0.0325477959230202
+-0.636999999999996 0.0325685517581406
+-0.635999999999996 0.0325892882400199
+-0.634999999999996 0.0326100053148498
+-0.633999999999996 0.0326307029288457
+-0.632999999999996 0.0326513810282475
+-0.631999999999996 0.0326720395593196
+-0.630999999999996 0.032692678468351
+-0.629999999999996 0.0327132977016555
+-0.628999999999996 0.0327338972055723
+-0.627999999999996 0.0327544769264659
+-0.626999999999996 0.0327750368107263
+-0.625999999999996 0.0327955768047695
+-0.624999999999996 0.0328160968550376
+-0.623999999999996 0.0328365969079988
+-0.622999999999996 0.0328570769101482
+-0.621999999999996 0.0328775368080073
+-0.620999999999996 0.0328979765481247
+-0.619999999999996 0.0329183960770766
+-0.618999999999996 0.032938795341466
+-0.617999999999996 0.0329591742879243
+-0.616999999999996 0.0329795328631103
+-0.615999999999996 0.0329998710137111
+-0.614999999999996 0.0330201886864424
+-0.613999999999996 0.0330404858280483
+-0.612999999999996 0.0330607623853018
+-0.611999999999996 0.0330810183050049
+-0.610999999999996 0.0331012535339891
+-0.609999999999996 0.0331214680191154
+-0.608999999999996 0.0331416617072743
+-0.607999999999996 0.0331618345453868
+-0.606999999999996 0.0331819864804036
+-0.605999999999996 0.0332021174593062
+-0.604999999999996 0.0332222274291068
+-0.603999999999996 0.0332423163368483
+-0.602999999999996 0.033262384129605
+-0.601999999999996 0.0332824307544824
+-0.600999999999996 0.0333024561586177
+-0.599999999999996 0.03332246028918
+-0.598999999999996 0.0333424430933705
+-0.597999999999996 0.0333624045184224
+-0.596999999999996 0.0333823445116019
+-0.595999999999996 0.0334022630202077
+-0.594999999999996 0.0334221599915715
+-0.593999999999996 0.0334420353730582
+-0.592999999999996 0.0334618891120664
+-0.591999999999996 0.0334817211560282
+-0.590999999999996 0.0335015314524095
+-0.589999999999996 0.0335213199487107
+-0.588999999999996 0.0335410865924663
+-0.587999999999996 0.0335608313312455
+-0.586999999999996 0.0335805541126523
+-0.585999999999996 0.033600254884326
+-0.584999999999996 0.0336199335939408
+-0.583999999999996 0.0336395901892068
+-0.582999999999996 0.0336592246178697
+-0.581999999999996 0.0336788368277112
+-0.580999999999996 0.0336984267665492
+-0.579999999999996 0.0337179943822381
+-0.578999999999996 0.0337375396226691
+-0.577999999999996 0.03375706243577
+-0.576999999999996 0.0337765627695061
+-0.575999999999996 0.0337960405718798
+-0.574999999999996 0.0338154957909312
+-0.573999999999996 0.0338349283747383
+-0.572999999999996 0.0338543382714171
+-0.571999999999996 0.0338737254291219
+-0.570999999999996 0.0338930897960454
+-0.569999999999996 0.0339124313204193
+-0.568999999999996 0.033931749950514
+-0.567999999999996 0.0339510456346395
+-0.566999999999996 0.0339703183211447
+-0.565999999999996 0.0339895679584185
+-0.564999999999996 0.0340087944948898
+-0.563999999999996 0.0340279978790274
+-0.562999999999996 0.0340471780593405
+-0.561999999999996 0.034066334984379
+-0.560999999999996 0.0340854686027334
+-0.559999999999996 0.0341045788630353
+-0.558999999999996 0.0341236657139578
+-0.557999999999996 0.0341427291042153
+-0.556999999999996 0.0341617689825638
+-0.555999999999996 0.0341807852978016
+-0.554999999999996 0.0341997779987688
+-0.553999999999996 0.0342187470343482
+-0.552999999999996 0.0342376923534651
+-0.551999999999996 0.0342566139050877
+-0.550999999999996 0.0342755116382273
+-0.549999999999996 0.0342943855019385
+-0.548999999999996 0.0343132354453194
+-0.547999999999996 0.0343320614175121
+-0.546999999999996 0.0343508633677023
+-0.545999999999996 0.0343696412451204
+-0.544999999999996 0.034388394999041
+-0.543999999999996 0.0344071245787833
+-0.542999999999996 0.0344258299337116
+-0.541999999999996 0.0344445110132353
+-0.540999999999996 0.0344631677668091
+-0.539999999999996 0.0344818001439334
+-0.538999999999996 0.0345004080941543
+-0.537999999999996 0.034518991567064
+-0.536999999999996 0.034537550512301
+-0.535999999999996 0.0345560848795503
+-0.534999999999996 0.0345745946185436
+-0.533999999999996 0.0345930796790596
+-0.532999999999996 0.034611540010924
+-0.531999999999996 0.0346299755640102
+-0.530999999999996 0.034648386288239
+-0.529999999999996 0.0346667721335792
+-0.528999999999996 0.0346851330500476
+-0.527999999999996 0.0347034689877093
+-0.526999999999996 0.034721779896678
+-0.525999999999996 0.034740065727116
+-0.524999999999996 0.0347583264292349
+-0.523999999999996 0.0347765619532951
+-0.522999999999996 0.0347947722496069
+-0.521999999999996 0.0348129572685298
+-0.520999999999996 0.0348311169604734
+-0.519999999999996 0.0348492512758975
+-0.518999999999996 0.0348673601653121
+-0.517999999999996 0.0348854435792778
+-0.516999999999996 0.0349035014684058
+-0.515999999999996 0.0349215337833587
+-0.514999999999996 0.03493954047485
+-0.513999999999996 0.0349575214936448
+-0.512999999999996 0.0349754767905597
+-0.511999999999996 0.0349934063164634
+-0.510999999999996 0.0350113100222767
+-0.509999999999996 0.0350291878589727
+-0.508999999999996 0.0350470397775769
+-0.507999999999996 0.0350648657291679
+-0.506999999999996 0.0350826656648771
+-0.505999999999996 0.0351004395358892
+-0.504999999999996 0.0351181872934424
+-0.503999999999996 0.0351359088888285
+-0.502999999999996 0.0351536042733932
+-0.501999999999996 0.0351712733985365
+-0.500999999999996 0.0351889162157125
+-0.499999999999996 0.03520653267643
+-0.498999999999996 0.0352241227322526
+-0.497999999999996 0.0352416863347988
+-0.496999999999996 0.0352592234357426
+-0.495999999999996 0.035276733986813
+-0.494999999999996 0.0352942179397951
+-0.493999999999996 0.0353116752465297
+-0.492999999999996 0.0353291058589137
+-0.491999999999996 0.0353465097289004
+-0.490999999999996 0.0353638868084997
+-0.489999999999996 0.035381237049778
+-0.488999999999996 0.0353985604048591
+-0.487999999999996 0.0354158568259238
+-0.486999999999996 0.0354331262652103
+-0.485999999999996 0.0354503686750144
+-0.484999999999996 0.03546758400769
+-0.483999999999996 0.0354847722156488
+-0.482999999999996 0.0355019332513612
+-0.481999999999996 0.0355190670673557
+-0.480999999999996 0.0355361736162197
+-0.479999999999996 0.0355532528505998
+-0.478999999999996 0.0355703047232014
+-0.477999999999996 0.0355873291867895
+-0.476999999999996 0.0356043261941888
+-0.475999999999996 0.0356212956982836
+-0.474999999999996 0.0356382376520184
+-0.473999999999996 0.035655152008398
+-0.472999999999996 0.0356720387204875
+-0.471999999999996 0.035688897741413
+-0.470999999999996 0.0357057290243612
+-0.469999999999996 0.0357225325225801
+-0.468999999999996 0.0357393081893791
+-0.467999999999996 0.035756055978129
+-0.466999999999996 0.0357727758422625
+-0.465999999999996 0.0357894677352743
+-0.464999999999996 0.0358061316107212
+-0.463999999999996 0.0358227674222224
+-0.462999999999996 0.0358393751234601
+-0.461999999999996 0.0358559546681789
+-0.460999999999996 0.0358725060101866
+-0.459999999999996 0.0358890291033545
+-0.458999999999996 0.0359055239016172
+-0.457999999999996 0.035921990358973
+-0.456999999999996 0.0359384284294841
+-0.455999999999996 0.035954838067277
+-0.454999999999996 0.0359712192265425
+-0.453999999999996 0.0359875718615357
+-0.452999999999996 0.0360038959265769
+-0.451999999999996 0.0360201913760511
+-0.450999999999996 0.0360364581644085
+-0.449999999999996 0.0360526962461649
+-0.448999999999996 0.0360689055759014
+-0.447999999999996 0.0360850861082654
+-0.446999999999996 0.0361012377979699
+-0.445999999999996 0.0361173605997943
+-0.444999999999996 0.0361334544685846
+-0.443999999999996 0.0361495193592533
+-0.442999999999996 0.0361655552267799
+-0.441999999999996 0.036181562026211
+-0.440999999999996 0.0361975397126603
+-0.439999999999996 0.0362134882413093
+-0.438999999999996 0.036229407567407
+-0.437999999999996 0.0362452976462705
+-0.436999999999996 0.0362611584332849
+-0.435999999999996 0.0362769898839038
+-0.434999999999996 0.0362927919536491
+-0.433999999999996 0.0363085645981119
+-0.432999999999996 0.0363243077729518
+-0.431999999999996 0.0363400214338978
+-0.430999999999996 0.0363557055367483
+-0.429999999999996 0.0363713600373714
+-0.428999999999996 0.0363869848917047
+-0.427999999999996 0.0364025800557561
+-0.426999999999996 0.0364181454856035
+-0.425999999999996 0.0364336811373954
+-0.424999999999996 0.0364491869673507
+-0.423999999999996 0.0364646629317594
+-0.422999999999996 0.0364801089869823
+-0.421999999999996 0.0364955250894517
+-0.420999999999996 0.0365109111956709
+-0.419999999999996 0.0365262672622155
+-0.418999999999996 0.0365415932457322
+-0.417999999999996 0.0365568891029404
+-0.416999999999996 0.0365721547906315
+-0.415999999999996 0.0365873902656692
+-0.414999999999996 0.0366025954849902
+-0.413999999999996 0.0366177704056037
+-0.412999999999996 0.0366329149845924
+-0.411999999999996 0.0366480291791118
+-0.410999999999996 0.0366631129463913
+-0.409999999999996 0.0366781662437337
+-0.408999999999996 0.0366931890285157
+-0.407999999999996 0.0367081812581883
+-0.406999999999996 0.0367231428902765
+-0.405999999999996 0.03673807388238
+-0.404999999999996 0.0367529741921729
+-0.403999999999996 0.0367678437774045
+-0.402999999999996 0.036782682595899
+-0.401999999999996 0.0367974906055559
+-0.400999999999996 0.0368122677643501
+-0.399999999999996 0.0368270140303324
+-0.398999999999996 0.0368417293616292
+-0.397999999999996 0.0368564137164432
+-0.396999999999996 0.0368710670530532
+-0.395999999999996 0.0368856893298145
+-0.394999999999996 0.0369002805051592
+-0.393999999999996 0.0369148405375961
+-0.392999999999996 0.036929369385711
+-0.391999999999996 0.0369438670081672
+-0.390999999999996 0.0369583333637052
+-0.389999999999996 0.0369727684111433
+-0.388999999999996 0.0369871721093776
+-0.387999999999996 0.0370015444173821
+-0.386999999999996 0.0370158852942093
+-0.385999999999996 0.0370301946989898
+-0.384999999999996 0.0370444725909332
+-0.383999999999996 0.0370587189293274
+-0.382999999999996 0.0370729336735398
+-0.381999999999996 0.0370871167830167
+-0.380999999999996 0.0371012682172839
+-0.379999999999996 0.0371153879359467
+-0.378999999999996 0.0371294758986902
+-0.377999999999996 0.0371435320652796
+-0.376999999999996 0.03715755639556
+-0.375999999999996 0.0371715488494571
+-0.374999999999996 0.0371855093869769
+-0.373999999999996 0.0371994379682064
+-0.372999999999996 0.0372133345533133
+-0.371999999999996 0.0372271991025463
+-0.370999999999996 0.0372410315762358
+-0.369999999999996 0.0372548319347934
+-0.368999999999996 0.0372686001387123
+-0.367999999999996 0.0372823361485678
+-0.366999999999996 0.0372960399250171
+-0.365999999999996 0.0373097114287997
+-0.364999999999996 0.0373233506207374
+-0.363999999999996 0.0373369574617348
+-0.362999999999996 0.0373505319127791
+-0.361999999999996 0.0373640739349407
+-0.360999999999996 0.037377583489373
+-0.359999999999996 0.0373910605373129
+-0.358999999999996 0.0374045050400806
+-0.357999999999996 0.0374179169590803
+-0.356999999999996 0.0374312962558
+-0.355999999999996 0.0374446428918117
+-0.354999999999996 0.0374579568287718
+-0.353999999999996 0.0374712380284212
+-0.352999999999996 0.0374844864525852
+-0.351999999999996 0.0374977020631743
+-0.350999999999996 0.0375108848221837
+-0.349999999999996 0.0375240346916938
+-0.348999999999996 0.0375371516338707
+-0.347999999999996 0.0375502356109657
+-0.346999999999996 0.037563286585316
+-0.345999999999996 0.0375763045193446
+-0.344999999999996 0.0375892893755608
+-0.343999999999996 0.03760224111656
+-0.342999999999996 0.037615159705024
+-0.341999999999996 0.0376280451037216
+-0.340999999999996 0.0376408972755079
+-0.339999999999996 0.0376537161833254
+-0.338999999999996 0.0376665017902036
+-0.337999999999996 0.0376792540592594
+-0.336999999999996 0.0376919729536971
+-0.335999999999996 0.0377046584368089
+-0.334999999999996 0.0377173104719746
+-0.333999999999996 0.0377299290226625
+-0.332999999999996 0.0377425140524286
+-0.331999999999996 0.0377550655249177
+-0.330999999999996 0.037767583403863
+-0.329999999999996 0.0377800676530865
+-0.328999999999996 0.0377925182364992
+-0.327999999999996 0.037804935118101
+-0.326999999999996 0.0378173182619813
+-0.325999999999996 0.0378296676323188
+-0.324999999999996 0.037841983193382
+-0.323999999999996 0.0378542649095289
+-0.322999999999996 0.0378665127452078
+-0.321999999999996 0.0378787266649568
+-0.320999999999996 0.0378909066334046
+-0.319999999999996 0.0379030526152702
+-0.318999999999996 0.0379151645753634
+-0.317999999999996 0.0379272424785846
+-0.316999999999996 0.0379392862899255
+-0.315999999999996 0.0379512959744685
+-0.314999999999996 0.0379632714973879
+-0.313999999999996 0.037975212823949
+-0.312999999999996 0.037987119919509
+-0.311999999999996 0.0379989927495169
+-0.310999999999996 0.0380108312795137
+-0.309999999999996 0.0380226354751325
+-0.308999999999996 0.0380344053020989
+-0.307999999999996 0.0380461407262307
+-0.306999999999996 0.0380578417134386
+-0.305999999999996 0.038069508229726
+-0.304999999999996 0.0380811402411895
+-0.303999999999996 0.0380927377140186
+-0.302999999999996 0.0381043006144961
+-0.301999999999996 0.0381158289089987
+-0.300999999999996 0.0381273225639962
+-0.299999999999996 0.0381387815460525
+-0.298999999999996 0.0381502058218254
+-0.297999999999996 0.0381615953580669
+-0.296999999999996 0.0381729501216233
+-0.295999999999996 0.0381842700794352
+-0.294999999999996 0.0381955551985379
+-0.293999999999996 0.0382068054460615
+-0.292999999999996 0.038218020789231
+-0.291999999999996 0.0382292011953665
+-0.290999999999996 0.0382403466318834
+-0.289999999999996 0.0382514570662925
+-0.288999999999996 0.0382625324661999
+-0.287999999999996 0.0382735727993079
+-0.286999999999996 0.0382845780334143
+-0.285999999999996 0.0382955481364131
+-0.284999999999996 0.0383064830762944
+-0.283999999999996 0.0383173828211448
+-0.282999999999996 0.0383282473391473
+-0.281999999999996 0.0383390765985815
+-0.280999999999996 0.0383498705678239
+-0.279999999999996 0.0383606292153479
+-0.278999999999996 0.0383713525097242
+-0.277999999999996 0.0383820404196205
+-0.276999999999996 0.0383926929138021
+-0.275999999999996 0.038403309961132
+-0.274999999999996 0.0384138915305705
+-0.273999999999996 0.0384244375911763
+-0.272999999999996 0.0384349481121057
+-0.271999999999996 0.0384454230626134
+-0.270999999999996 0.0384558624120525
+-0.269999999999996 0.0384662661298743
+-0.268999999999996 0.0384766341856291
+-0.267999999999996 0.0384869665489656
+-0.266999999999996 0.0384972631896318
+-0.265999999999996 0.0385075240774744
+-0.264999999999996 0.0385177491824396
+-0.263999999999996 0.0385279384745728
+-0.262999999999996 0.0385380919240191
+-0.261999999999996 0.038548209501023
+-0.260999999999996 0.0385582911759291
+-0.259999999999996 0.0385683369191816
+-0.258999999999996 0.0385783467013252
+-0.257999999999996 0.0385883204930046
+-0.256999999999996 0.0385982582649647
+-0.255999999999996 0.0386081599880514
+-0.254999999999996 0.0386180256332109
+-0.253999999999996 0.0386278551714902
+-0.252999999999996 0.0386376485740375
+-0.251999999999996 0.0386474058121019
+-0.250999999999996 0.0386571268570338
+-0.249999999999996 0.038666811680285
+-0.248999999999996 0.0386764602534086
+-0.247999999999996 0.0386860725480598
+-0.246999999999996 0.038695648535995
+-0.245999999999996 0.0387051881890731
+-0.244999999999996 0.0387146914792546
+-0.243999999999996 0.0387241583786026
+-0.242999999999996 0.0387335888592822
+-0.241999999999996 0.0387429828935612
+-0.240999999999996 0.0387523404538099
+-0.239999999999996 0.0387616615125015
+-0.238999999999996 0.0387709460422117
+-0.237999999999996 0.0387801940156198
+-0.236999999999996 0.0387894054055078
+-0.235999999999996 0.0387985801847611
+-0.234999999999996 0.0388077183263685
+-0.233999999999996 0.0388168198034225
+-0.232999999999996 0.0388258845891192
+-0.231999999999996 0.0388349126567583
+-0.230999999999996 0.0388439039797438
+-0.229999999999996 0.0388528585315836
+-0.228999999999996 0.0388617762858898
+-0.227999999999996 0.0388706572163788
+-0.226999999999996 0.0388795012968715
+-0.225999999999996 0.0388883085012935
+-0.224999999999996 0.038897078803675
+-0.223999999999996 0.038905812178151
+-0.222999999999996 0.0389145085989617
+-0.221999999999996 0.0389231680404521
+-0.220999999999996 0.0389317904770726
+-0.219999999999996 0.0389403758833791
+-0.218999999999996 0.0389489242340326
+-0.217999999999996 0.0389574355038001
+-0.216999999999996 0.0389659096675541
+-0.215999999999996 0.038974346700273
+-0.214999999999996 0.0389827465770411
+-0.213999999999996 0.038991109273049
+-0.212999999999996 0.0389994347635932
+-0.211999999999996 0.039007723024077
+-0.210999999999996 0.0390159740300097
+-0.209999999999996 0.0390241877570075
+-0.208999999999996 0.039032364180793
+-0.207999999999996 0.039040503277196
+-0.206999999999996 0.039048605022153
+-0.205999999999996 0.0390566693917076
+-0.204999999999996 0.0390646963620106
+-0.203999999999996 0.03907268590932
+-0.202999999999996 0.0390806380100013
+-0.201999999999996 0.0390885526405276
+-0.200999999999996 0.0390964297774796
+-0.199999999999996 0.0391042693975456
+-0.198999999999996 0.039112071477522
+-0.197999999999996 0.0391198359943131
+-0.196999999999996 0.0391275629249313
+-0.195999999999996 0.0391352522464971
+-0.194999999999996 0.0391429039362396
+-0.193999999999996 0.0391505179714961
+-0.192999999999996 0.0391580943297126
+-0.191999999999996 0.0391656329884437
+-0.190999999999996 0.0391731339253528
+-0.189999999999996 0.0391805971182121
+-0.188999999999996 0.039188022544903
+-0.187999999999996 0.0391954101834158
+-0.186999999999996 0.03920276001185
+-0.185999999999996 0.0392100720084147
+-0.184999999999996 0.0392173461514282
+-0.183999999999996 0.0392245824193183
+-0.182999999999996 0.0392317807906226
+-0.181999999999996 0.0392389412439884
+-0.180999999999996 0.0392460637581728
+-0.179999999999996 0.0392531483120429
+-0.178999999999996 0.0392601948845759
+-0.177999999999996 0.0392672034548591
+-0.176999999999996 0.0392741740020901
+-0.175999999999996 0.0392811065055769
+-0.174999999999996 0.039288000944738
+-0.173999999999996 0.0392948572991023
+-0.172999999999996 0.0393016755483097
+-0.171999999999996 0.0393084556721107
+-0.170999999999996 0.0393151976503666
+-0.169999999999996 0.0393219014630498
+-0.168999999999996 0.0393285670902437
+-0.167999999999996 0.039335194512143
+-0.166999999999996 0.0393417837090536
+-0.165999999999996 0.0393483346613928
+-0.164999999999996 0.0393548473496894
+-0.163999999999996 0.0393613217545836
+-0.162999999999996 0.0393677578568275
+-0.161999999999996 0.0393741556372848
+-0.160999999999996 0.0393805150769312
+-0.159999999999996 0.0393868361568541
+-0.158999999999996 0.0393931188582532
+-0.157999999999996 0.0393993631624403
+-0.156999999999996 0.0394055690508393
+-0.155999999999996 0.0394117365049864
+-0.154999999999996 0.0394178655065305
+-0.153999999999996 0.0394239560372326
+-0.152999999999996 0.0394300080789667
+-0.151999999999996 0.0394360216137191
+-0.150999999999996 0.0394419966235891
+-0.149999999999996 0.0394479330907889
+-0.148999999999996 0.0394538309976435
+-0.147999999999996 0.0394596903265911
+-0.146999999999996 0.0394655110601828
+-0.145999999999996 0.0394712931810831
+-0.144999999999996 0.0394770366720698
+-0.143999999999996 0.039482741516034
+-0.142999999999996 0.0394884076959802
+-0.141999999999996 0.0394940351950267
+-0.140999999999996 0.0394996239964052
+-0.139999999999996 0.0395051740834611
+-0.138999999999996 0.0395106854396539
+-0.137999999999996 0.0395161580485568
+-0.136999999999996 0.0395215918938567
+-0.135999999999996 0.0395269869593551
+-0.134999999999996 0.0395323432289672
+-0.133999999999996 0.0395376606867225
+-0.132999999999996 0.0395429393167649
+-0.131999999999996 0.0395481791033525
+-0.130999999999996 0.0395533800308581
+-0.129999999999996 0.0395585420837688
+-0.128999999999996 0.0395636652466863
+-0.127999999999996 0.039568749504327
+-0.126999999999996 0.0395737948415222
+-0.125999999999996 0.0395788012432179
+-0.124999999999996 0.039583768694475
+-0.123999999999996 0.0395886971804693
+-0.122999999999996 0.0395935866864919
+-0.121999999999996 0.0395984371979487
+-0.120999999999996 0.0396032487003612
+-0.119999999999996 0.0396080211793656
+-0.118999999999996 0.0396127546207141
+-0.117999999999996 0.0396174490102737
+-0.116999999999996 0.0396221043340273
+-0.115999999999996 0.0396267205780732
+-0.114999999999996 0.0396312977286253
+-0.113999999999996 0.0396358357720133
+-0.112999999999996 0.0396403346946825
+-0.111999999999996 0.039644794483194
+-0.110999999999996 0.039649215124225
+-0.109999999999996 0.0396535966045686
+-0.108999999999996 0.0396579389111337
+-0.107999999999996 0.0396622420309456
+-0.106999999999996 0.0396665059511456
+-0.105999999999996 0.0396707306589911
+-0.104999999999996 0.0396749161418559
+-0.103999999999996 0.0396790623872303
+-0.102999999999996 0.0396831693827207
+-0.101999999999996 0.0396872371160502
+-0.100999999999996 0.0396912655750583
+-0.099999999999996 0.0396952547477012
+-0.098999999999996 0.0396992046220516
+-0.097999999999996 0.039703115186299
+-0.096999999999996 0.0397069864287496
+-0.095999999999996 0.0397108183378267
+-0.094999999999996 0.03971461090207
+-0.093999999999996 0.0397183641101365
+-0.092999999999996 0.0397220779508002
+-0.091999999999996 0.0397257524129519
+-0.090999999999996 0.0397293874855997
+-0.089999999999996 0.0397329831578689
+-0.088999999999996 0.0397365394190018
+-0.087999999999996 0.0397400562583582
+-0.086999999999996 0.0397435336654152
+-0.085999999999996 0.039746971629767
+-0.084999999999996 0.0397503701411257
+-0.083999999999996 0.0397537291893204
+-0.082999999999996 0.039757048764298
+-0.081999999999996 0.039760328856123
+-0.080999999999996 0.0397635694549774
+-0.079999999999996 0.0397667705511609
+-0.078999999999996 0.039769932135091
+-0.077999999999996 0.039773054197303
+-0.076999999999996 0.0397761367284498
+-0.075999999999996 0.0397791797193024
+-0.074999999999996 0.0397821831607497
+-0.073999999999996 0.0397851470437985
+-0.072999999999996 0.0397880713595735
+-0.071999999999996 0.0397909560993176
+-0.070999999999996 0.0397938012543918
+-0.069999999999996 0.0397966068162751
+-0.068999999999996 0.0397993727765649
+-0.067999999999996 0.0398020991269765
+-0.066999999999996 0.0398047858593438
+-0.065999999999996 0.0398074329656187
+-0.0649999999999959 0.0398100404378717
+-0.0639999999999959 0.0398126082682916
+-0.0629999999999959 0.0398151364491856
+-0.0619999999999959 0.0398176249729792
+-0.0609999999999959 0.0398200738322167
+-0.0599999999999959 0.0398224830195607
+-0.0589999999999959 0.0398248525277925
+-0.0579999999999959 0.039827182349812
+-0.0569999999999959 0.0398294724786377
+-0.0559999999999959 0.0398317229074068
+-0.0549999999999959 0.0398339336293751
+-0.0539999999999959 0.0398361046379174
+-0.0529999999999959 0.039838235926527
+-0.0519999999999959 0.0398403274888161
+-0.0509999999999959 0.039842379318516
+-0.0499999999999959 0.0398443914094764
+-0.0489999999999959 0.0398463637556663
+-0.0479999999999959 0.0398482963511736
+-0.0469999999999959 0.0398501891902048
+-0.0459999999999959 0.0398520422670859
+-0.0449999999999959 0.0398538555762615
+-0.0439999999999959 0.0398556291122955
+-0.0429999999999959 0.0398573628698708
+-0.0419999999999959 0.0398590568437895
+-0.0409999999999959 0.0398607110289726
+-0.0399999999999959 0.0398623254204605
+-0.0389999999999959 0.0398639000134126
+-0.0379999999999959 0.0398654348031076
+-0.0369999999999959 0.0398669297849435
+-0.0359999999999959 0.0398683849544373
+-0.0349999999999959 0.0398698003072256
+-0.0339999999999959 0.039871175839064
+-0.0329999999999959 0.0398725115458275
+-0.0319999999999959 0.0398738074235107
+-0.0309999999999959 0.0398750634682271
+-0.0299999999999959 0.03987627967621
+-0.0289999999999959 0.0398774560438118
+-0.0279999999999959 0.0398785925675044
+-0.0269999999999959 0.0398796892438792
+-0.0259999999999959 0.0398807460696471
+-0.0249999999999959 0.0398817630416382
+-0.0239999999999959 0.0398827401568023
+-0.0229999999999959 0.0398836774122087
+-0.0219999999999959 0.0398845748050461
+-0.0209999999999959 0.0398854323326228
+-0.0199999999999959 0.0398862499923666
+-0.0189999999999959 0.0398870277818249
+-0.0179999999999959 0.0398877656986646
+-0.0169999999999959 0.0398884637406721
+-0.0159999999999959 0.0398891219057537
+-0.0149999999999959 0.039889740191935
+-0.0139999999999959 0.0398903185973612
+-0.0129999999999959 0.0398908571202972
+-0.0119999999999959 0.0398913557591277
+-0.0109999999999959 0.0398918145123568
+-0.0099999999999959 0.0398922333786082
+-0.0089999999999959 0.0398926123566255
+-0.0079999999999959 0.0398929514452716
+-0.0069999999999959 0.0398932506435295
+-0.0059999999999959 0.0398935099505014
+-0.0049999999999959 0.0398937293654095
+-0.0039999999999959 0.0398939088875956
+-0.0029999999999959 0.039894048516521
+-0.0019999999999959 0.039894148251767
+-0.000999999999995899 0.0398942080930342
+4.10088629720917e-15 0.0398942280401433
+0.0010000000000041 0.0398942080930342
+0.0020000000000041 0.039894148251767
+0.0030000000000041 0.039894048516521
+0.0040000000000041 0.0398939088875956
+0.0050000000000041 0.0398937293654095
+0.0060000000000041 0.0398935099505014
+0.0070000000000041 0.0398932506435294
+0.0080000000000041 0.0398929514452716
+0.0090000000000041 0.0398926123566255
+0.0100000000000041 0.0398922333786082
+0.0110000000000041 0.0398918145123568
+0.0120000000000041 0.0398913557591277
+0.0130000000000041 0.0398908571202972
+0.0140000000000041 0.0398903185973612
+0.0150000000000041 0.0398897401919349
+0.0160000000000041 0.0398891219057537
+0.0170000000000041 0.0398884637406721
+0.0180000000000041 0.0398877656986646
+0.0190000000000041 0.0398870277818249
+0.0200000000000041 0.0398862499923666
+0.0210000000000041 0.0398854323326228
+0.0220000000000041 0.0398845748050461
+0.0230000000000041 0.0398836774122087
+0.0240000000000041 0.0398827401568023
+0.0250000000000041 0.0398817630416382
+0.0260000000000041 0.0398807460696471
+0.0270000000000041 0.0398796892438792
+0.0280000000000041 0.0398785925675044
+0.0290000000000041 0.0398774560438118
+0.0300000000000041 0.03987627967621
+0.0310000000000041 0.0398750634682271
+0.0320000000000041 0.0398738074235107
+0.0330000000000041 0.0398725115458275
+0.0340000000000041 0.039871175839064
+0.0350000000000041 0.0398698003072256
+0.0360000000000041 0.0398683849544373
+0.0370000000000041 0.0398669297849435
+0.0380000000000041 0.0398654348031076
+0.0390000000000041 0.0398639000134126
+0.0400000000000041 0.0398623254204605
+0.0410000000000041 0.0398607110289726
+0.0420000000000041 0.0398590568437895
+0.0430000000000041 0.0398573628698708
+0.0440000000000041 0.0398556291122955
+0.0450000000000041 0.0398538555762615
+0.0460000000000041 0.0398520422670858
+0.0470000000000041 0.0398501891902048
+0.0480000000000041 0.0398482963511735
+0.0490000000000041 0.0398463637556663
+0.0500000000000041 0.0398443914094764
+0.0510000000000041 0.0398423793185159
+0.0520000000000041 0.0398403274888161
+0.0530000000000041 0.0398382359265269
+0.0540000000000041 0.0398361046379173
+0.0550000000000041 0.0398339336293751
+0.0560000000000041 0.0398317229074068
+0.0570000000000041 0.0398294724786377
+0.0580000000000041 0.039827182349812
+0.0590000000000041 0.0398248525277925
+0.0600000000000041 0.0398224830195607
+0.0610000000000041 0.0398200738322167
+0.0620000000000041 0.0398176249729792
+0.0630000000000041 0.0398151364491855
+0.0640000000000042 0.0398126082682916
+0.0650000000000042 0.0398100404378717
+0.0660000000000042 0.0398074329656187
+0.0670000000000042 0.0398047858593437
+0.0680000000000042 0.0398020991269765
+0.0690000000000042 0.0397993727765648
+0.0700000000000042 0.0397966068162751
+0.0710000000000042 0.0397938012543918
+0.0720000000000042 0.0397909560993176
+0.0730000000000042 0.0397880713595735
+0.0740000000000042 0.0397851470437985
+0.0750000000000042 0.0397821831607497
+0.0760000000000042 0.0397791797193024
+0.0770000000000042 0.0397761367284498
+0.0780000000000042 0.0397730541973029
+0.0790000000000042 0.039769932135091
+0.0800000000000042 0.0397667705511609
+0.0810000000000042 0.0397635694549774
+0.0820000000000042 0.039760328856123
+0.0830000000000042 0.039757048764298
+0.0840000000000042 0.0397537291893204
+0.0850000000000042 0.0397503701411256
+0.0860000000000042 0.039746971629767
+0.0870000000000042 0.0397435336654151
+0.0880000000000042 0.0397400562583582
+0.0890000000000042 0.0397365394190018
+0.0900000000000042 0.0397329831578688
+0.0910000000000042 0.0397293874855997
+0.0920000000000042 0.0397257524129518
+0.0930000000000042 0.0397220779508001
+0.0940000000000042 0.0397183641101365
+0.0950000000000042 0.03971461090207
+0.0960000000000042 0.0397108183378266
+0.0970000000000042 0.0397069864287496
+0.0980000000000042 0.039703115186299
+0.0990000000000042 0.0396992046220516
+0.100000000000004 0.0396952547477012
+0.101000000000004 0.0396912655750583
+0.102000000000004 0.0396872371160502
+0.103000000000004 0.0396831693827207
+0.104000000000004 0.0396790623872303
+0.105000000000004 0.0396749161418559
+0.106000000000004 0.039670730658991
+0.107000000000004 0.0396665059511455
+0.108000000000004 0.0396622420309456
+0.109000000000004 0.0396579389111337
+0.110000000000004 0.0396535966045686
+0.111000000000004 0.039649215124225
+0.112000000000004 0.039644794483194
+0.113000000000004 0.0396403346946824
+0.114000000000004 0.0396358357720133
+0.115000000000004 0.0396312977286253
+0.116000000000004 0.0396267205780732
+0.117000000000004 0.0396221043340273
+0.118000000000004 0.0396174490102737
+0.119000000000004 0.039612754620714
+0.120000000000004 0.0396080211793656
+0.121000000000004 0.0396032487003611
+0.122000000000004 0.0395984371979487
+0.123000000000004 0.0395935866864918
+0.124000000000004 0.0395886971804693
+0.125000000000004 0.0395837686944749
+0.126000000000004 0.0395788012432179
+0.127000000000004 0.0395737948415222
+0.128000000000004 0.039568749504327
+0.129000000000004 0.0395636652466862
+0.130000000000004 0.0395585420837687
+0.131000000000004 0.0395533800308581
+0.132000000000004 0.0395481791033525
+0.133000000000004 0.0395429393167648
+0.134000000000004 0.0395376606867224
+0.135000000000004 0.0395323432289671
+0.136000000000004 0.039526986959355
+0.137000000000004 0.0395215918938567
+0.138000000000004 0.0395161580485567
+0.139000000000004 0.0395106854396539
+0.140000000000004 0.0395051740834611
+0.141000000000004 0.0394996239964051
+0.142000000000004 0.0394940351950267
+0.143000000000004 0.0394884076959802
+0.144000000000004 0.039482741516034
+0.145000000000004 0.0394770366720698
+0.146000000000004 0.0394712931810831
+0.147000000000004 0.0394655110601828
+0.148000000000004 0.0394596903265911
+0.149000000000004 0.0394538309976435
+0.150000000000004 0.0394479330907889
+0.151000000000004 0.0394419966235891
+0.152000000000004 0.039436021613719
+0.153000000000004 0.0394300080789666
+0.154000000000004 0.0394239560372326
+0.155000000000004 0.0394178655065304
+0.156000000000004 0.0394117365049864
+0.157000000000004 0.0394055690508392
+0.158000000000004 0.0393993631624403
+0.159000000000004 0.0393931188582532
+0.160000000000004 0.0393868361568541
+0.161000000000004 0.0393805150769311
+0.162000000000004 0.0393741556372848
+0.163000000000004 0.0393677578568274
+0.164000000000004 0.0393613217545836
+0.165000000000004 0.0393548473496893
+0.166000000000004 0.0393483346613928
+0.167000000000004 0.0393417837090536
+0.168000000000004 0.0393351945121429
+0.169000000000004 0.0393285670902436
+0.170000000000004 0.0393219014630497
+0.171000000000004 0.0393151976503665
+0.172000000000004 0.0393084556721106
+0.173000000000004 0.0393016755483097
+0.174000000000004 0.0392948572991023
+0.175000000000004 0.0392880009447379
+0.176000000000004 0.0392811065055768
+0.177000000000004 0.03927417400209
+0.178000000000004 0.039267203454859
+0.179000000000004 0.0392601948845758
+0.180000000000004 0.0392531483120429
+0.181000000000004 0.0392460637581728
+0.182000000000004 0.0392389412439884
+0.183000000000004 0.0392317807906226
+0.184000000000004 0.0392245824193183
+0.185000000000004 0.0392173461514281
+0.186000000000004 0.0392100720084147
+0.187000000000004 0.03920276001185
+0.188000000000004 0.0391954101834157
+0.189000000000004 0.0391880225449029
+0.190000000000004 0.0391805971182121
+0.191000000000004 0.0391731339253527
+0.192000000000004 0.0391656329884437
+0.193000000000004 0.0391580943297126
+0.194000000000004 0.0391505179714961
+0.195000000000004 0.0391429039362396
+0.196000000000004 0.0391352522464971
+0.197000000000004 0.0391275629249312
+0.198000000000004 0.0391198359943131
+0.199000000000004 0.039112071477522
+0.200000000000004 0.0391042693975456
+0.201000000000004 0.0390964297774795
+0.202000000000004 0.0390885526405276
+0.203000000000004 0.0390806380100012
+0.204000000000004 0.0390726859093199
+0.205000000000004 0.0390646963620105
+0.206000000000004 0.0390566693917076
+0.207000000000004 0.039048605022153
+0.208000000000004 0.039040503277196
+0.209000000000004 0.039032364180793
+0.210000000000004 0.0390241877570074
+0.211000000000004 0.0390159740300096
+0.212000000000004 0.0390077230240769
+0.213000000000004 0.0389994347635932
+0.214000000000004 0.0389911092730489
+0.215000000000004 0.038982746577041
+0.216000000000004 0.0389743467002729
+0.217000000000004 0.038965909667554
+0.218000000000004 0.0389574355038001
+0.219000000000004 0.0389489242340326
+0.220000000000004 0.038940375883379
+0.221000000000004 0.0389317904770726
+0.222000000000004 0.038923168040452
+0.223000000000004 0.0389145085989616
+0.224000000000004 0.0389058121781509
+0.225000000000004 0.0388970788036749
+0.226000000000004 0.0388883085012934
+0.227000000000004 0.0388795012968714
+0.228000000000004 0.0388706572163787
+0.229000000000004 0.0388617762858897
+0.230000000000004 0.0388528585315836
+0.231000000000004 0.0388439039797438
+0.232000000000004 0.0388349126567583
+0.233000000000004 0.0388258845891191
+0.234000000000004 0.0388168198034224
+0.235000000000004 0.0388077183263684
+0.236000000000004 0.038798580184761
+0.237000000000004 0.0387894054055077
+0.238000000000004 0.0387801940156197
+0.239000000000004 0.0387709460422117
+0.240000000000004 0.0387616615125014
+0.241000000000004 0.0387523404538099
+0.242000000000004 0.0387429828935611
+0.243000000000004 0.0387335888592821
+0.244000000000004 0.0387241583786025
+0.245000000000004 0.0387146914792546
+0.246000000000004 0.038705188189073
+0.247000000000004 0.0386956485359949
+0.248000000000004 0.0386860725480597
+0.249000000000004 0.0386764602534086
+0.250000000000004 0.0386668116802849
+0.251000000000004 0.0386571268570337
+0.252000000000004 0.0386474058121018
+0.253000000000004 0.0386376485740374
+0.254000000000004 0.0386278551714901
+0.255000000000004 0.0386180256332108
+0.256000000000004 0.0386081599880513
+0.257000000000004 0.0385982582649647
+0.258000000000004 0.0385883204930045
+0.259000000000004 0.0385783467013252
+0.260000000000004 0.0385683369191816
+0.261000000000004 0.038558291175929
+0.262000000000004 0.0385482095010229
+0.263000000000004 0.038538091924019
+0.264000000000004 0.0385279384745727
+0.265000000000004 0.0385177491824395
+0.266000000000004 0.0385075240774743
+0.267000000000004 0.0384972631896317
+0.268000000000004 0.0384869665489655
+0.269000000000004 0.038476634185629
+0.270000000000004 0.0384662661298742
+0.271000000000004 0.0384558624120524
+0.272000000000004 0.0384454230626133
+0.273000000000004 0.0384349481121056
+0.274000000000004 0.0384244375911762
+0.275000000000004 0.0384138915305704
+0.276000000000004 0.0384033099611319
+0.277000000000004 0.0383926929138021
+0.278000000000004 0.0383820404196204
+0.279000000000004 0.0383713525097241
+0.280000000000004 0.0383606292153478
+0.281000000000004 0.0383498705678238
+0.282000000000004 0.0383390765985814
+0.283000000000004 0.0383282473391472
+0.284000000000004 0.0383173828211447
+0.285000000000004 0.0383064830762943
+0.286000000000004 0.038295548136413
+0.287000000000004 0.0382845780334142
+0.288000000000004 0.0382735727993078
+0.289000000000004 0.0382625324661998
+0.290000000000004 0.0382514570662924
+0.291000000000004 0.0382403466318833
+0.292000000000004 0.0382292011953664
+0.293000000000004 0.0382180207892309
+0.294000000000004 0.0382068054460614
+0.295000000000004 0.0381955551985378
+0.296000000000004 0.0381842700794351
+0.297000000000004 0.0381729501216232
+0.298000000000004 0.0381615953580668
+0.299000000000004 0.0381502058218253
+0.300000000000004 0.0381387815460524
+0.301000000000004 0.0381273225639961
+0.302000000000004 0.0381158289089986
+0.303000000000004 0.0381043006144961
+0.304000000000004 0.0380927377140185
+0.305000000000004 0.0380811402411894
+0.306000000000004 0.0380695082297259
+0.307000000000004 0.0380578417134385
+0.308000000000004 0.0380461407262306
+0.309000000000004 0.0380344053020988
+0.310000000000004 0.0380226354751324
+0.311000000000004 0.0380108312795136
+0.312000000000004 0.0379989927495168
+0.313000000000004 0.0379871199195089
+0.314000000000004 0.0379752128239489
+0.315000000000004 0.0379632714973878
+0.316000000000004 0.0379512959744684
+0.317000000000004 0.0379392862899254
+0.318000000000004 0.0379272424785845
+0.319000000000004 0.0379151645753633
+0.320000000000004 0.0379030526152701
+0.321000000000004 0.0378909066334045
+0.322000000000004 0.0378787266649567
+0.323000000000004 0.0378665127452077
+0.324000000000004 0.0378542649095288
+0.325000000000004 0.0378419831933819
+0.326000000000004 0.0378296676323188
+0.327000000000004 0.0378173182619812
+0.328000000000004 0.0378049351181009
+0.329000000000004 0.0377925182364991
+0.330000000000004 0.0377800676530864
+0.331000000000004 0.0377675834038629
+0.332000000000004 0.0377550655249176
+0.333000000000004 0.0377425140524285
+0.334000000000004 0.0377299290226623
+0.335000000000004 0.0377173104719745
+0.336000000000004 0.0377046584368088
+0.337000000000004 0.037691972953697
+0.338000000000004 0.0376792540592593
+0.339000000000004 0.0376665017902035
+0.340000000000004 0.0376537161833253
+0.341000000000004 0.0376408972755078
+0.342000000000004 0.0376280451037215
+0.343000000000004 0.0376151597050239
+0.344000000000004 0.0376022411165599
+0.345000000000004 0.0375892893755607
+0.346000000000004 0.0375763045193445
+0.347000000000004 0.0375632865853159
+0.348000000000004 0.0375502356109656
+0.349000000000004 0.0375371516338706
+0.350000000000004 0.0375240346916937
+0.351000000000004 0.0375108848221836
+0.352000000000004 0.0374977020631742
+0.353000000000004 0.0374844864525851
+0.354000000000004 0.0374712380284211
+0.355000000000004 0.0374579568287717
+0.356000000000004 0.0374446428918116
+0.357000000000004 0.0374312962557999
+0.358000000000004 0.0374179169590802
+0.359000000000004 0.0374045050400805
+0.360000000000004 0.0373910605373128
+0.361000000000004 0.0373775834893729
+0.362000000000004 0.0373640739349406
+0.363000000000004 0.037350531912779
+0.364000000000004 0.0373369574617346
+0.365000000000004 0.0373233506207373
+0.366000000000004 0.0373097114287996
+0.367000000000004 0.037296039925017
+0.368000000000004 0.0372823361485677
+0.369000000000004 0.0372686001387122
+0.370000000000004 0.0372548319347933
+0.371000000000004 0.0372410315762357
+0.372000000000004 0.0372271991025462
+0.373000000000004 0.0372133345533131
+0.374000000000004 0.0371994379682063
+0.375000000000004 0.0371855093869768
+0.376000000000004 0.037171548849457
+0.377000000000004 0.0371575563955599
+0.378000000000004 0.0371435320652795
+0.379000000000004 0.0371294758986901
+0.380000000000004 0.0371153879359465
+0.381000000000004 0.0371012682172837
+0.382000000000004 0.0370871167830166
+0.383000000000004 0.0370729336735397
+0.384000000000004 0.0370587189293273
+0.385000000000004 0.037044472590933
+0.386000000000004 0.0370301946989897
+0.387000000000004 0.0370158852942092
+0.388000000000004 0.037001544417382
+0.389000000000004 0.0369871721093774
+0.390000000000004 0.0369727684111432
+0.391000000000004 0.0369583333637051
+0.392000000000004 0.036943867008167
+0.393000000000004 0.0369293693857109
+0.394000000000004 0.0369148405375959
+0.395000000000004 0.0369002805051591
+0.396000000000004 0.0368856893298144
+0.397000000000004 0.0368710670530531
+0.398000000000004 0.0368564137164431
+0.399000000000004 0.0368417293616291
+0.400000000000004 0.0368270140303323
+0.401000000000004 0.03681226776435
+0.402000000000004 0.0367974906055557
+0.403000000000004 0.0367826825958989
+0.404000000000004 0.0367678437774044
+0.405000000000004 0.0367529741921728
+0.406000000000004 0.0367380738823798
+0.407000000000004 0.0367231428902764
+0.408000000000004 0.0367081812581882
+0.409000000000004 0.0366931890285156
+0.410000000000004 0.0366781662437335
+0.411000000000004 0.0366631129463912
+0.412000000000004 0.0366480291791117
+0.413000000000004 0.0366329149845922
+0.414000000000004 0.0366177704056036
+0.415000000000004 0.03660259548499
+0.416000000000004 0.0365873902656691
+0.417000000000004 0.0365721547906314
+0.418000000000004 0.0365568891029403
+0.419000000000004 0.0365415932457321
+0.420000000000004 0.0365262672622153
+0.421000000000004 0.0365109111956708
+0.422000000000004 0.0364955250894515
+0.423000000000004 0.0364801089869822
+0.424000000000004 0.0364646629317593
+0.425000000000004 0.0364491869673506
+0.426000000000004 0.0364336811373952
+0.427000000000004 0.0364181454856034
+0.428000000000004 0.036402580055756
+0.429000000000004 0.0363869848917046
+0.430000000000004 0.0363713600373713
+0.431000000000004 0.0363557055367482
+0.432000000000004 0.0363400214338977
+0.433000000000004 0.0363243077729516
+0.434000000000004 0.0363085645981117
+0.435000000000004 0.036292791953649
+0.436000000000004 0.0362769898839036
+0.437000000000004 0.0362611584332848
+0.438000000000004 0.0362452976462704
+0.439000000000004 0.0362294075674069
+0.440000000000004 0.0362134882413092
+0.441000000000004 0.0361975397126602
+0.442000000000004 0.0361815620262109
+0.443000000000004 0.0361655552267798
+0.444000000000004 0.0361495193592532
+0.445000000000004 0.0361334544685845
+0.446000000000004 0.0361173605997942
+0.447000000000004 0.0361012377979697
+0.448000000000004 0.0360850861082653
+0.449000000000004 0.0360689055759013
+0.450000000000004 0.0360526962461647
+0.451000000000004 0.0360364581644084
+0.452000000000004 0.0360201913760509
+0.453000000000004 0.0360038959265768
+0.454000000000004 0.0359875718615356
+0.455000000000004 0.0359712192265423
+0.456000000000004 0.0359548380672769
+0.457000000000004 0.035938428429484
+0.458000000000004 0.0359219903589728
+0.459000000000004 0.0359055239016171
+0.460000000000004 0.0358890291033544
+0.461000000000004 0.0358725060101865
+0.462000000000004 0.0358559546681787
+0.463000000000004 0.0358393751234599
+0.464000000000004 0.0358227674222223
+0.465000000000004 0.035806131610721
+0.466000000000004 0.0357894677352741
+0.467000000000004 0.0357727758422624
+0.468000000000004 0.0357560559781289
+0.469000000000004 0.035739308189379
+0.470000000000004 0.03572253252258
+0.471000000000004 0.0357057290243611
+0.472000000000004 0.0356888977414129
+0.473000000000004 0.0356720387204874
+0.474000000000004 0.0356551520083978
+0.475000000000004 0.0356382376520183
+0.476000000000004 0.0356212956982834
+0.477000000000004 0.0356043261941886
+0.478000000000004 0.0355873291867894
+0.479000000000004 0.0355703047232012
+0.480000000000004 0.0355532528505996
+0.481000000000004 0.0355361736162196
+0.482000000000004 0.0355190670673555
+0.483000000000004 0.035501933251361
+0.484000000000004 0.0354847722156487
+0.485000000000004 0.0354675840076898
+0.486000000000004 0.0354503686750142
+0.487000000000004 0.0354331262652101
+0.488000000000004 0.0354158568259237
+0.489000000000004 0.035398560404859
+0.490000000000004 0.0353812370497779
+0.491000000000004 0.0353638868084995
+0.492000000000004 0.0353465097289003
+0.493000000000004 0.0353291058589135
+0.494000000000004 0.0353116752465295
+0.495000000000004 0.035294217939795
+0.496000000000004 0.0352767339868129
+0.497000000000004 0.0352592234357424
+0.498000000000004 0.0352416863347987
+0.499000000000004 0.0352241227322525
+0.500000000000004 0.0352065326764299
+0.501000000000004 0.0351889162157124
+0.502000000000004 0.0351712733985364
+0.503000000000004 0.0351536042733931
+0.504000000000004 0.0351359088888283
+0.505000000000004 0.0351181872934422
+0.506000000000004 0.035100439535889
+0.507000000000004 0.0350826656648769
+0.508000000000004 0.0350648657291677
+0.509000000000004 0.0350470397775767
+0.510000000000004 0.0350291878589725
+0.511000000000004 0.0350113100222766
+0.512000000000004 0.0349934063164633
+0.513000000000004 0.0349754767905596
+0.514000000000004 0.0349575214936446
+0.515000000000004 0.0349395404748499
+0.516000000000004 0.0349215337833586
+0.517000000000004 0.0349035014684057
+0.518000000000004 0.0348854435792776
+0.519000000000004 0.034867360165312
+0.520000000000004 0.0348492512758974
+0.521000000000004 0.0348311169604733
+0.522000000000004 0.0348129572685296
+0.523000000000004 0.0347947722496067
+0.524000000000004 0.034776561953295
+0.525000000000004 0.0347583264292347
+0.526000000000004 0.0347400657271159
+0.527000000000004 0.0347217798966778
+0.528000000000004 0.0347034689877092
+0.529000000000004 0.0346851330500475
+0.530000000000004 0.0346667721335791
+0.531000000000004 0.0346483862882389
+0.532000000000004 0.0346299755640101
+0.533000000000004 0.0346115400109239
+0.534000000000004 0.0345930796790594
+0.535000000000004 0.0345745946185435
+0.536000000000004 0.0345560848795502
+0.537000000000004 0.0345375505123009
+0.538000000000004 0.0345189915670639
+0.539000000000004 0.0345004080941541
+0.540000000000004 0.0344818001439333
+0.541000000000004 0.034463167766809
+0.542000000000004 0.0344445110132352
+0.543000000000004 0.0344258299337115
+0.544000000000004 0.0344071245787832
+0.545000000000004 0.0343883949990408
+0.546000000000004 0.0343696412451203
+0.547000000000004 0.0343508633677022
+0.548000000000004 0.0343320614175119
+0.549000000000004 0.0343132354453193
+0.550000000000004 0.0342943855019383
+0.551000000000004 0.0342755116382271
+0.552000000000004 0.0342566139050875
+0.553000000000004 0.0342376923534649
+0.554000000000004 0.034218747034348
+0.555000000000004 0.0341997779987686
+0.556000000000004 0.0341807852978014
+0.557000000000004 0.0341617689825637
+0.558000000000004 0.0341427291042151
+0.559000000000004 0.0341236657139577
+0.560000000000004 0.0341045788630352
+0.561000000000004 0.0340854686027332
+0.562000000000004 0.0340663349843788
+0.563000000000004 0.0340471780593404
+0.564000000000004 0.0340279978790273
+0.565000000000004 0.0340087944948897
+0.566000000000004 0.0339895679584184
+0.567000000000005 0.0339703183211445
+0.568000000000005 0.0339510456346393
+0.569000000000005 0.0339317499505139
+0.570000000000005 0.0339124313204191
+0.571000000000005 0.0338930897960453
+0.572000000000005 0.0338737254291217
+0.573000000000005 0.033854338271417
+0.574000000000005 0.0338349283747382
+0.575000000000005 0.0338154957909311
+0.576000000000005 0.0337960405718796
+0.577000000000005 0.0337765627695059
+0.578000000000005 0.0337570624357699
+0.579000000000005 0.0337375396226689
+0.580000000000005 0.033717994382238
+0.581000000000005 0.033698426766549
+0.582000000000005 0.033678836827711
+0.583000000000005 0.0336592246178695
+0.584000000000005 0.0336395901892066
+0.585000000000005 0.0336199335939406
+0.586000000000005 0.0336002548843258
+0.587000000000005 0.0335805541126522
+0.588000000000005 0.0335608313312453
+0.589000000000005 0.0335410865924661
+0.590000000000005 0.0335213199487105
+0.591000000000005 0.0335015314524093
+0.592000000000005 0.033481721156028
+0.593000000000005 0.0334618891120662
+0.594000000000005 0.0334420353730581
+0.595000000000005 0.0334221599915713
+0.596000000000005 0.0334022630202075
+0.597000000000005 0.0333823445116018
+0.598000000000005 0.0333624045184223
+0.599000000000005 0.0333424430933703
+0.600000000000005 0.0333224602891799
+0.601000000000005 0.0333024561586176
+0.602000000000005 0.0332824307544822
+0.603000000000005 0.0332623841296048
+0.604000000000005 0.0332423163368481
+0.605000000000005 0.0332222274291066
+0.606000000000005 0.033202117459306
+0.607000000000005 0.0331819864804034
+0.608000000000005 0.0331618345453866
+0.609000000000005 0.0331416617072742
+0.610000000000005 0.0331214680191152
+0.611000000000005 0.033101253533989
+0.612000000000005 0.0330810183050047
+0.613000000000005 0.0330607623853016
+0.614000000000005 0.0330404858280481
+0.615000000000005 0.0330201886864423
+0.616000000000005 0.032999871013711
+0.617000000000005 0.0329795328631101
+0.618000000000005 0.0329591742879241
+0.619000000000005 0.0329387953414659
+0.620000000000005 0.0329183960770764
+0.621000000000005 0.0328979765481246
+0.622000000000005 0.0328775368080071
+0.623000000000005 0.032857076910148
+0.624000000000005 0.0328365969079987
+0.625000000000005 0.0328160968550374
+0.626000000000005 0.0327955768047693
+0.627000000000005 0.0327750368107261
+0.628000000000005 0.0327544769264657
+0.629000000000005 0.0327338972055722
+0.630000000000005 0.0327132977016554
+0.631000000000005 0.0326926784683508
+0.632000000000005 0.0326720395593195
+0.633000000000005 0.0326513810282474
+0.634000000000005 0.0326307029288455
+0.635000000000005 0.0326100053148496
+0.636000000000005 0.0325892882400198
+0.637000000000005 0.0325685517581404
+0.638000000000005 0.03254779592302
+0.639000000000005 0.0325270207884907
+0.640000000000005 0.0325062264084081
+0.641000000000005 0.0324854128366514
+0.642000000000005 0.0324645801271227
+0.643000000000005 0.032443728333747
+0.644000000000005 0.0324228575104718
+0.645000000000005 0.0324019677112672
+0.646000000000005 0.0323810589901253
+0.647000000000005 0.0323601314010603
+0.648000000000005 0.0323391849981079
+0.649000000000005 0.0323182198353254
+0.650000000000005 0.0322972359667913
+0.651000000000005 0.0322762334466052
+0.652000000000005 0.0322552123288874
+0.653000000000005 0.0322341726677787
+0.654000000000005 0.0322131145174404
+0.655000000000005 0.0321920379320537
+0.656000000000005 0.0321709429658197
+0.657000000000005 0.0321498296729594
+0.658000000000005 0.0321286981077127
+0.659000000000005 0.0321075483243392
+0.660000000000005 0.0320863803771172
+0.661000000000005 0.0320651943203435
+0.662000000000005 0.0320439902083339
+0.663000000000005 0.032022768095422
+0.664000000000005 0.0320015280359596
+0.665000000000005 0.0319802700843164
+0.666000000000005 0.0319589942948794
+0.667000000000005 0.0319377007220533
+0.668000000000005 0.0319163894202596
+0.669000000000005 0.0318950604439368
+0.670000000000005 0.0318737138475401
+0.671000000000005 0.031852349685541
+0.672000000000005 0.0318309680124273
+0.673000000000005 0.0318095688827028
+0.674000000000005 0.031788152350887
+0.675000000000005 0.0317667184715147
+0.676000000000005 0.0317452672991364
+0.677000000000005 0.0317237988883172
+0.678000000000005 0.0317023132936374
+0.679000000000005 0.0316808105696917
+0.680000000000005 0.0316592907710892
+0.681000000000005 0.0316377539524531
+0.682000000000005 0.0316162001684206
+0.683000000000005 0.0315946294736426
+0.684000000000005 0.0315730419227833
+0.685000000000005 0.0315514375705202
+0.686000000000005 0.031529816471544
+0.687000000000005 0.0315081786805578
+0.688000000000005 0.0314865242522776
+0.689000000000005 0.0314648532414314
+0.690000000000005 0.0314431657027596
+0.691000000000005 0.0314214616910143
+0.692000000000005 0.0313997412609592
+0.693000000000005 0.0313780044673694
+0.694000000000005 0.0313562513650313
+0.695000000000005 0.0313344820087423
+0.696000000000005 0.0313126964533103
+0.697000000000005 0.0312908947535539
+0.698000000000005 0.0312690769643018
+0.699000000000005 0.031247243140393
+0.700000000000005 0.031225393336676
+0.701000000000005 0.0312035276080093
+0.702000000000005 0.0311816460092603
+0.703000000000005 0.031159748595306
+0.704000000000005 0.0311378354210321
+0.705000000000005 0.0311159065413328
+0.706000000000005 0.0310939620111111
+0.707000000000005 0.0310720018852782
+0.708000000000005 0.031050026218753
+0.709000000000005 0.0310280350664626
+0.710000000000005 0.0310060284833415
+0.711000000000005 0.0309840065243314
+0.712000000000005 0.0309619692443814
+0.713000000000005 0.0309399166984472
+0.714000000000005 0.0309178489414913
+0.715000000000005 0.0308957660284828
+0.716000000000005 0.0308736680143967
+0.717000000000005 0.0308515549542142
+0.718000000000005 0.0308294269029222
+0.719000000000005 0.0308072839155133
+0.720000000000005 0.0307851260469852
+0.721000000000005 0.0307629533523408
+0.722000000000005 0.0307407658865878
+0.723000000000005 0.0307185637047388
+0.724000000000005 0.0306963468618104
+0.725000000000005 0.0306741154128239
+0.726000000000005 0.0306518694128042
+0.727000000000005 0.03062960891678
+0.728000000000005 0.0306073339797838
+0.729000000000005 0.0305850446568512
+0.730000000000005 0.0305627410030209
+0.731000000000005 0.0305404230733345
+0.732000000000005 0.0305180909228362
+0.733000000000005 0.0304957446065727
+0.734000000000005 0.0304733841795929
+0.735000000000005 0.0304510096969476
+0.736000000000005 0.0304286212136895
+0.737000000000005 0.0304062187848727
+0.738000000000005 0.0303838024655527
+0.739000000000005 0.0303613723107859
+0.740000000000005 0.0303389283756299
+0.741000000000005 0.0303164707151428
+0.742000000000005 0.030293999384383
+0.743000000000005 0.0302715144384093
+0.744000000000005 0.0302490159322804
+0.745000000000005 0.0302265039210548
+0.746000000000005 0.0302039784597906
+0.747000000000005 0.0301814396035451
+0.748000000000005 0.0301588874073749
+0.749000000000005 0.0301363219263353
+0.750000000000005 0.0301137432154803
+0.751000000000005 0.0300911513298626
+0.752000000000005 0.0300685463245328
+0.753000000000005 0.0300459282545397
+0.754000000000005 0.0300232971749299
+0.755000000000005 0.0300006531407476
+0.756000000000005 0.0299779962070341
+0.757000000000005 0.0299553264288283
+0.758000000000005 0.0299326438611655
+0.759000000000005 0.0299099485590782
+0.760000000000005 0.0298872405775952
+0.761000000000005 0.0298645199717413
+0.762000000000005 0.0298417867965379
+0.763000000000005 0.0298190411070017
+0.764000000000005 0.0297962829581454
+0.765000000000005 0.0297735124049768
+0.766000000000005 0.0297507295024993
+0.767000000000005 0.0297279343057109
+0.768000000000005 0.0297051268696044
+0.769000000000005 0.0296823072491674
+0.770000000000005 0.0296594754993815
+0.771000000000005 0.0296366316752226
+0.772000000000005 0.0296137758316605
+0.773000000000005 0.0295909080236586
+0.774000000000005 0.0295680283061738
+0.775000000000005 0.0295451367341562
+0.776000000000005 0.029522233362549
+0.777000000000005 0.0294993182462883
+0.778000000000005 0.0294763914403026
+0.779000000000005 0.0294534529995129
+0.780000000000005 0.0294305029788324
+0.781000000000005 0.0294075414331663
+0.782000000000005 0.0293845684174114
+0.783000000000005 0.0293615839864561
+0.784000000000005 0.0293385881951804
+0.785000000000005 0.0293155810984549
+0.786000000000005 0.0292925627511415
+0.787000000000005 0.0292695332080927
+0.788000000000005 0.0292464925241513
+0.789000000000005 0.0292234407541507
+0.790000000000005 0.029200377952914
+0.791000000000005 0.0291773041752544
+0.792000000000005 0.0291542194759746
+0.793000000000005 0.0291311239098667
+0.794000000000005 0.0291080175317122
+0.795000000000005 0.0290849003962813
+0.796000000000005 0.0290617725583333
+0.797000000000005 0.0290386340726158
+0.798000000000005 0.0290154849938649
+0.799000000000005 0.028992325376805
+0.800000000000005 0.0289691552761482
+0.801000000000005 0.0289459747465944
+0.802000000000005 0.0289227838428312
+0.803000000000005 0.0288995826195333
+0.804000000000005 0.0288763711313627
+0.805000000000005 0.0288531494329681
+0.806000000000005 0.0288299175789852
+0.807000000000005 0.0288066756240359
+0.808000000000005 0.0287834236227285
+0.809000000000005 0.0287601616296573
+0.810000000000005 0.0287368896994027
+0.811000000000005 0.0287136078865305
+0.812000000000005 0.0286903162455921
+0.813000000000005 0.0286670148311241
+0.814000000000005 0.0286437036976481
+0.815000000000005 0.0286203828996706
+0.816000000000005 0.0285970524916827
+0.817000000000005 0.0285737125281601
+0.818000000000005 0.0285503630635623
+0.819000000000005 0.0285270041523333
+0.820000000000005 0.0285036358489006
+0.821000000000005 0.0284802582076754
+0.822000000000005 0.0284568712830524
+0.823000000000005 0.0284334751294092
+0.824000000000005 0.0284100698011068
+0.825000000000005 0.0283866553524886
+0.826000000000005 0.028363231837881
+0.827000000000005 0.0283397993115923
+0.828000000000005 0.0283163578279135
+0.829000000000005 0.0282929074411172
+0.830000000000005 0.0282694482054579
+0.831000000000005 0.0282459801751717
+0.832000000000005 0.0282225034044761
+0.833000000000005 0.0281990179475697
+0.834000000000005 0.0281755238586322
+0.835000000000005 0.0281520211918238
+0.836000000000005 0.0281285100012856
+0.837000000000005 0.0281049903411388
+0.838000000000005 0.028081462265485
+0.839000000000005 0.0280579258284056
+0.840000000000005 0.0280343810839619
+0.841000000000005 0.0280108280861948
+0.842000000000005 0.0279872668891242
+0.843000000000005 0.0279636975467498
+0.844000000000005 0.0279401201130497
+0.845000000000005 0.0279165346419811
+0.846000000000005 0.0278929411874797
+0.847000000000005 0.0278693398034596
+0.848000000000005 0.0278457305438131
+0.849000000000005 0.0278221134624104
+0.850000000000005 0.0277984886130995
+0.851000000000005 0.0277748560497062
+0.852000000000005 0.0277512158260335
+0.853000000000005 0.0277275679958616
+0.854000000000005 0.0277039126129478
+0.855000000000005 0.0276802497310262
+0.856000000000005 0.0276565794038074
+0.857000000000005 0.0276329016849786
+0.858000000000005 0.0276092166282031
+0.859000000000005 0.0275855242871204
+0.860000000000005 0.0275618247153456
+0.861000000000005 0.0275381179664695
+0.862000000000005 0.0275144040940586
+0.863000000000005 0.0274906831516544
+0.864000000000005 0.0274669551927736
+0.865000000000005 0.0274432202709076
+0.866000000000005 0.0274194784395227
+0.867000000000005 0.0273957297520597
+0.868000000000005 0.0273719742619334
+0.869000000000005 0.027348212022533
+0.870000000000005 0.0273244430872215
+0.871000000000005 0.0273006675093357
+0.872000000000005 0.0272768853421859
+0.873000000000005 0.0272530966390557
+0.874000000000005 0.0272293014532019
+0.875000000000005 0.0272054998378542
+0.876000000000005 0.0271816918462153
+0.877000000000005 0.0271578775314601
+0.878000000000005 0.0271340569467363
+0.879000000000005 0.0271102301451636
+0.880000000000005 0.0270863971798337
+0.881000000000005 0.0270625581038102
+0.882000000000005 0.0270387129701284
+0.883000000000005 0.0270148618317951
+0.884000000000005 0.026991004741788
+0.885000000000005 0.0269671417530564
+0.886000000000005 0.0269432729185202
+0.887000000000005 0.0269193982910701
+0.888000000000005 0.0268955179235673
+0.889000000000005 0.0268716318688434
+0.890000000000005 0.0268477401797001
+0.891000000000005 0.0268238429089091
+0.892000000000005 0.0267999401092119
+0.893000000000005 0.0267760318333196
+0.894000000000005 0.0267521181339126
+0.895000000000005 0.0267281990636409
+0.896000000000005 0.0267042746751232
+0.897000000000005 0.0266803450209471
+0.898000000000005 0.0266564101536691
+0.899000000000005 0.0266324701258141
+0.900000000000005 0.0266085249898754
+0.901000000000005 0.0265845747983142
+0.902000000000005 0.0265606196035599
+0.903000000000005 0.0265366594580097
+0.904000000000005 0.0265126944140282
+0.905000000000005 0.0264887245239477
+0.906000000000005 0.0264647498400675
+0.907000000000005 0.0264407704146542
+0.908000000000005 0.0264167862999409
+0.909000000000005 0.0263927975481279
+0.910000000000005 0.0263688042113817
+0.911000000000005 0.0263448063418352
+0.912000000000005 0.0263208039915876
+0.913000000000005 0.0262967972127039
+0.914000000000005 0.0262727860572151
+0.915000000000005 0.0262487705771178
+0.916000000000005 0.0262247508243739
+0.917000000000005 0.0262007268509108
+0.918000000000005 0.026176698708621
+0.919000000000005 0.0261526664493617
+0.920000000000005 0.0261286301249552
+0.921000000000005 0.0261045897871881
+0.922000000000005 0.0260805454878116
+0.923000000000005 0.0260564972785411
+0.924000000000005 0.0260324452110559
+0.925000000000005 0.0260083893369995
+0.926000000000005 0.0259843297079787
+0.927000000000005 0.0259602663755644
+0.928000000000005 0.0259361993912903
+0.929000000000005 0.0259121288066537
+0.930000000000005 0.0258880546731148
+0.931000000000005 0.0258639770420965
+0.932000000000005 0.0258398959649847
+0.933000000000005 0.0258158114931276
+0.934000000000005 0.0257917236778358
+0.935000000000005 0.025767632570382
+0.936000000000005 0.0257435382220011
+0.937000000000005 0.0257194406838896
+0.938000000000005 0.0256953400072058
+0.939000000000005 0.0256712362430696
+0.940000000000005 0.0256471294425619
+0.941000000000005 0.0256230196567252
+0.942000000000005 0.0255989069365625
+0.943000000000005 0.0255747913330382
+0.944000000000005 0.0255506728970768
+0.945000000000005 0.0255265516795636
+0.946000000000005 0.0255024277313443
+0.947000000000005 0.0254783011032245
+0.948000000000005 0.02545417184597
+0.949000000000005 0.0254300400103064
+0.950000000000005 0.0254059056469188
+0.951000000000005 0.025381768806452
+0.952000000000005 0.0253576295395101
+0.953000000000005 0.0253334878966564
+0.954000000000005 0.025309343928413
+0.955000000000005 0.0252851976852611
+0.956000000000005 0.0252610492176405
+0.957000000000005 0.0252368985759495
+0.958000000000005 0.0252127458105448
+0.959000000000005 0.0251885909717412
+0.960000000000005 0.0251644341098116
+0.961000000000005 0.0251402752749869
+0.962000000000005 0.0251161145174555
+0.963000000000005 0.0250919518873636
+0.964000000000005 0.0250677874348145
+0.965000000000005 0.025043621209869
+0.966000000000005 0.0250194532625449
+0.967000000000005 0.0249952836428168
+0.968000000000005 0.0249711124006163
+0.969000000000005 0.0249469395858313
+0.970000000000005 0.0249227652483065
+0.971000000000005 0.0248985894378426
+0.972000000000005 0.0248744122041965
+0.973000000000005 0.0248502335970812
+0.974000000000005 0.0248260536661655
+0.975000000000005 0.0248018724610736
+0.976000000000005 0.0247776900313856
+0.977000000000005 0.0247535064266366
+0.978000000000005 0.0247293216963173
+0.979000000000005 0.024705135889873
+0.980000000000005 0.0246809490567042
+0.981000000000005 0.024656761246166
+0.982000000000005 0.0246325725075682
+0.983000000000005 0.0246083828901749
+0.984000000000005 0.0245841924432046
+0.985000000000005 0.0245600012158299
+0.986000000000005 0.0245358092571773
+0.987000000000005 0.0245116166163271
+0.988000000000005 0.0244874233423136
+0.989000000000005 0.0244632294841242
+0.990000000000005 0.0244390350906998
+0.991000000000005 0.0244148402109348
+0.992000000000005 0.0243906448936764
+0.993000000000005 0.0243664491877246
+0.994000000000005 0.0243422531418326
+0.995000000000005 0.024318056804706
+0.996000000000005 0.0242938602250027
+0.997000000000005 0.0242696634513333
+0.998000000000005 0.0242454665322603
+0.999000000000005 0.0242212695162984
+1 0.0241970724519142
+1.001 0.024172875387526
+1.002 0.0241486783715036
+1.003 0.0241244814521685
+1.004 0.0241002846777933
+1.005 0.024076088096602
+1.006 0.0240518917567693
+1.007 0.0240276957064211
+1.008 0.0240034999936339
+1.009 0.0239793046664347
+1.01 0.0239551097728012
+1.011 0.0239309153606613
+1.012 0.023906721477893
+1.013 0.0238825281723244
+1.014 0.0238583354917335
+1.015 0.0238341434838481
+1.016 0.0238099521963454
+1.017 0.0237857616768523
+1.018 0.0237615719729449
+1.019 0.0237373831321487
+1.02 0.0237131952019379
+1.021 0.023689008229736
+1.022 0.0236648222629149
+1.023 0.0236406373487956
+1.024 0.0236164535346471
+1.025 0.0235922708676872
+1.026 0.0235680893950817
+1.027 0.0235439091639445
+1.028 0.0235197302213376
+1.029 0.0234955526142706
+1.03 0.0234713763897011
+1.031 0.0234472015945341
+1.032 0.0234230282756219
+1.033 0.0233988564797643
+1.034 0.0233746862537082
+1.035 0.0233505176441475
+1.036 0.0233263506977229
+1.037 0.0233021854610221
+1.038 0.0232780219805792
+1.039 0.023253860302875
+1.04 0.0232297004743366
+1.041 0.0232055425413372
+1.042 0.0231813865501964
+1.043 0.0231572325471794
+1.044 0.0231330805784977
+1.045 0.0231089306903081
+1.046 0.0230847829287134
+1.047 0.0230606373397615
+1.048 0.023036493969446
+1.049 0.0230123528637053
+1.05 0.0229882140684233
+1.051 0.0229640776294287
+1.052 0.0229399435924949
+1.053 0.0229158120033403
+1.054 0.0228916829076276
+1.055 0.0228675563509642
+1.056 0.0228434323789016
+1.057 0.0228193110369359
+1.058 0.0227951923705069
+1.059 0.0227710764249985
+1.06 0.0227469632457386
+1.061 0.0227228528779987
+1.062 0.0226987453669938
+1.063 0.0226746407578826
+1.064 0.0226505390957671
+1.065 0.0226264404256925
+1.066 0.022602344792647
+1.067 0.0225782522415621
+1.068 0.0225541628173121
+1.069 0.0225300765647138
+1.07 0.022505993528527
+1.071 0.0224819137534539
+1.072 0.0224578372841391
+1.073 0.0224337641651694
+1.074 0.022409694441074
+1.075 0.022385628156324
+1.076 0.0223615653553326
+1.077 0.0223375060824546
+1.078 0.0223134503819868
+1.079 0.0222893982981674
+1.08 0.0222653498751762
+1.081 0.0222413051571343
+1.082 0.0222172641881042
+1.083 0.0221932270120893
+1.084 0.0221691936730343
+1.085 0.0221451642148248
+1.086 0.0221211386812871
+1.087 0.0220971171161882
+1.088 0.0220730995632358
+1.089 0.0220490860660781
+1.08999999999999 0.0220250766683035
+1.09099999999999 0.0220010714134408
+1.09199999999999 0.021977070344959
+1.09299999999999 0.0219530735062671
+1.09399999999999 0.0219290809407139
+1.09499999999999 0.0219050926915883
+1.09599999999999 0.0218811088021188
+1.09699999999999 0.0218571293154734
+1.09799999999999 0.0218331542747598
+1.09899999999999 0.0218091837230249
+1.09999999999999 0.0217852177032552
+1.10099999999999 0.0217612562583761
+1.10199999999999 0.0217372994312523
+1.10299999999999 0.0217133472646873
+1.10399999999999 0.0216893998014237
+1.10499999999999 0.0216654570841427
+1.10599999999999 0.0216415191554642
+1.10699999999999 0.0216175860579467
+1.10799999999999 0.0215936578340873
+1.10899999999999 0.0215697345263212
+1.10999999999999 0.0215458161770221
+1.11099999999999 0.0215219028285018
+1.11199999999999 0.0214979945230102
+1.11299999999999 0.0214740913027349
+1.11399999999999 0.0214501932098018
+1.11499999999999 0.0214263002862743
+1.11599999999999 0.0214024125741534
+1.11699999999999 0.0213785301153779
+1.11799999999999 0.0213546529518239
+1.11899999999999 0.021330781125305
+1.11999999999999 0.021306914677572
+1.12099999999999 0.0212830536503128
+1.12199999999999 0.0212591980851525
+1.12299999999999 0.0212353480236532
+1.12399999999999 0.0212115035073139
+1.12499999999999 0.0211876645775702
+1.12599999999999 0.0211638312757946
+1.12699999999999 0.0211400036432962
+1.12799999999999 0.0211161817213205
+1.12899999999999 0.0210923655510496
+1.12999999999999 0.0210685551736018
+1.13099999999999 0.0210447506300315
+1.13199999999999 0.0210209519613295
+1.13299999999999 0.0209971592084226
+1.13399999999999 0.0209733724121735
+1.13499999999999 0.0209495916133807
+1.13599999999999 0.0209258168527785
+1.13699999999999 0.0209020481710371
+1.13799999999999 0.0208782856087621
+1.13899999999999 0.0208545292064945
+1.13999999999999 0.0208307790047111
+1.14099999999999 0.0208070350438236
+1.14199999999999 0.0207832973641793
+1.14299999999999 0.0207595660060605
+1.14399999999999 0.0207358410096844
+1.14499999999999 0.0207121224152036
+1.14599999999999 0.0206884102627052
+1.14699999999999 0.0206647045922113
+1.14799999999999 0.0206410054436787
+1.14899999999999 0.0206173128569989
+1.14999999999999 0.0205936268719978
+1.15099999999999 0.0205699475284358
+1.15199999999999 0.020546274866008
+1.15299999999999 0.0205226089243433
+1.15399999999999 0.0204989497430053
+1.15499999999999 0.0204752973614913
+1.15599999999999 0.0204516518192331
+1.15699999999999 0.0204280131555961
+1.15799999999999 0.0204043814098798
+1.15899999999999 0.0203807566213175
+1.15999999999999 0.0203571388290762
+1.16099999999999 0.0203335280722566
+1.16199999999999 0.0203099243898928
+1.16299999999999 0.0202863278209526
+1.16399999999999 0.0202627384043372
+1.16499999999999 0.0202391561788811
+1.16599999999999 0.0202155811833519
+1.16699999999999 0.0201920134564507
+1.16799999999999 0.0201684530368114
+1.16899999999999 0.0201448999630012
+1.16999999999999 0.0201213542735201
+1.17099999999999 0.0200978160068009
+1.17199999999999 0.0200742852012095
+1.17299999999999 0.0200507618950442
+1.17399999999999 0.0200272461265362
+1.17499999999999 0.0200037379338491
+1.17599999999999 0.0199802373550791
+1.17699999999999 0.0199567444282549
+1.17799999999999 0.0199332591913374
+1.17899999999999 0.0199097816822199
+1.17999999999999 0.0198863119387279
+1.18099999999998 0.0198628499986191
+1.18199999999998 0.0198393958995831
+1.18299999999998 0.0198159496792417
+1.18399999999998 0.0197925113751486
+1.18499999999998 0.0197690810247892
+1.18599999999998 0.0197456586655809
+1.18699999999998 0.0197222443348727
+1.18799999999998 0.0196988380699454
+1.18899999999998 0.0196754399080112
+1.18999999999998 0.019652049886214
+1.19099999999998 0.0196286680416291
+1.19199999999998 0.019605294411263
+1.19299999999998 0.0195819290320538
+1.19399999999998 0.0195585719408708
+1.19499999999998 0.0195352231745144
+1.19599999999998 0.0195118827697161
+1.19699999999998 0.0194885507631386
+1.19799999999998 0.0194652271913755
+1.19899999999998 0.0194419120909514
+1.19999999999998 0.0194186054983217
+1.20099999999998 0.0193953074498726
+1.20199999999998 0.0193720179819212
+1.20299999999998 0.0193487371307151
+1.20399999999998 0.0193254649324326
+1.20499999999998 0.0193022014231825
+1.20599999999998 0.0192789466390043
+1.20699999999998 0.0192557006158676
+1.20799999999998 0.0192324633896727
+1.20899999999998 0.01920923499625
+1.20999999999998 0.0191860154713604
+1.21099999999998 0.0191628048506947
+1.21199999999998 0.019139603169874
+1.21299999999998 0.0191164104644496
+1.21399999999998 0.0190932267699027
+1.21499999999998 0.0190700521216444
+1.21599999999998 0.0190468865550158
+1.21699999999998 0.0190237301052879
+1.21799999999998 0.0190005828076614
+1.21899999999998 0.0189774446972669
+1.21999999999998 0.0189543158091645
+1.22099999999998 0.0189311961783441
+1.22199999999998 0.018908085839725
+1.22299999999998 0.0188849848281563
+1.22399999999998 0.0188618931784164
+1.22499999999998 0.0188388109252131
+1.22599999999998 0.0188157381031836
+1.22699999999998 0.0187926747468945
+1.22799999999998 0.0187696208908415
+1.22899999999998 0.0187465765694498
+1.22999999999998 0.0187235418170734
+1.23099999999998 0.0187005166679957
+1.23199999999998 0.0186775011564291
+1.23299999999998 0.0186544953165149
+1.23399999999998 0.0186314991823235
+1.23499999999998 0.0186085127878542
+1.23599999999998 0.0185855361670351
+1.23699999999998 0.0185625693537231
+1.23799999999998 0.018539612381704
+1.23899999999998 0.0185166652846923
+1.23999999999998 0.018493728096331
+1.24099999999998 0.0184708008501921
+1.24199999999998 0.0184478835797757
+1.24299999999998 0.018424976318511
+1.24399999999998 0.0184020790997551
+1.24499999999998 0.0183791919567941
+1.24599999999998 0.0183563149228422
+1.24699999999998 0.018333448031042
+1.24799999999998 0.0183105913144645
+1.24899999999998 0.0182877448061089
+1.24999999999998 0.0182649085389027
+1.25099999999998 0.0182420825457016
+1.25199999999998 0.0182192668592893
+1.25299999999998 0.0181964615123779
+1.25399999999998 0.0181736665376073
+1.25499999999998 0.0181508819675456
+1.25599999999998 0.0181281078346888
+1.25699999999998 0.0181053441714609
+1.25799999999998 0.0180825910102137
+1.25899999999998 0.0180598483832271
+1.25999999999998 0.0180371163227086
+1.26099999999998 0.0180143948607936
+1.26199999999998 0.0179916840295453
+1.26299999999998 0.0179689838609546
+1.26399999999998 0.01794629438694
+1.26499999999998 0.0179236156393478
+1.26599999999998 0.0179009476499517
+1.26699999999998 0.0178782904504532
+1.26799999999998 0.0178556440724812
+1.26899999999998 0.0178330085475921
+1.26999999999998 0.0178103839072699
+1.27099999999998 0.017787770182926
+1.27199999999997 0.0177651674058991
+1.27299999999997 0.0177425756074553
+1.27399999999997 0.0177199948187882
+1.27499999999997 0.0176974250710185
+1.27599999999997 0.0176748663951944
+1.27699999999997 0.017652318822291
+1.27799999999997 0.0176297823832109
+1.27899999999997 0.0176072571087839
+1.27999999999997 0.0175847430297668
+1.28099999999997 0.0175622401768436
+1.28199999999997 0.0175397485806253
+1.28299999999997 0.0175172682716501
+1.28399999999997 0.0174947992803831
+1.28499999999997 0.0174723416372166
+1.28599999999997 0.0174498953724697
+1.28699999999997 0.0174274605163885
+1.28799999999997 0.017405037099146
+1.28899999999997 0.0173826251508422
+1.28999999999997 0.0173602247015039
+1.29099999999997 0.0173378357810847
+1.29199999999997 0.0173154584194651
+1.29299999999997 0.0172930926464524
+1.29399999999997 0.0172707384917805
+1.29499999999997 0.0172483959851104
+1.29599999999997 0.0172260651560294
+1.29699999999997 0.0172037460340518
+1.29799999999997 0.0171814386486185
+1.29899999999997 0.0171591430290969
+1.29999999999997 0.0171368592047814
+1.30099999999997 0.0171145872048925
+1.30199999999997 0.0170923270585778
+1.30299999999997 0.0170700787949111
+1.30399999999997 0.0170478424428928
+1.30499999999997 0.0170256180314501
+1.30599999999997 0.0170034055894363
+1.30699999999997 0.0169812051456316
+1.30799999999997 0.0169590167287422
+1.30899999999997 0.0169368403674012
+1.30999999999997 0.0169146760901679
+1.31099999999997 0.016892523925528
+1.31199999999997 0.0168703839018936
+1.31299999999997 0.0168482560476033
+1.31399999999997 0.016826140390922
+1.31499999999997 0.0168040369600408
+1.31599999999997 0.0167819457830773
+1.31699999999997 0.0167598668880754
+1.31799999999997 0.0167378003030052
+1.31899999999997 0.0167157460557632
+1.31999999999997 0.0166937041741721
+1.32099999999997 0.0166716746859807
+1.32199999999997 0.0166496576188645
+1.32299999999997 0.0166276530004247
+1.32399999999997 0.0166056608581889
+1.32499999999997 0.0165836812196112
+1.32599999999997 0.0165617141120713
+1.32699999999997 0.0165397595628757
+1.32799999999997 0.0165178175992566
+1.32899999999997 0.0164958882483726
+1.32999999999997 0.0164739715373084
+1.33099999999997 0.0164520674930747
+1.33199999999997 0.0164301761426085
+1.33299999999997 0.0164082975127728
+1.33399999999997 0.0163864316303568
+1.33499999999997 0.0163645785220758
+1.33599999999997 0.016342738214571
+1.33699999999997 0.0163209107344099
+1.33799999999997 0.0162990961080861
+1.33899999999997 0.0162772943620189
+1.33999999999997 0.0162555055225541
+1.34099999999997 0.0162337296159634
+1.34199999999997 0.0162119666684444
+1.34299999999997 0.0161902167061209
+1.34399999999997 0.0161684797550427
+1.34499999999997 0.0161467558411856
+1.34599999999997 0.0161250449904515
+1.34699999999997 0.0161033472286683
+1.34799999999997 0.0160816625815898
+1.34899999999997 0.0160599910748959
+1.34999999999997 0.0160383327341927
+1.35099999999997 0.0160166875850119
+1.35199999999997 0.0159950556528116
+1.35299999999997 0.0159734369629757
+1.35399999999997 0.0159518315408142
+1.35499999999997 0.0159302394115629
+1.35599999999997 0.0159086606003838
+1.35699999999997 0.0158870951323649
+1.35799999999997 0.0158655430325202
+1.35899999999997 0.0158440043257896
+1.35999999999997 0.0158224790370391
+1.36099999999997 0.0158009671910605
+1.36199999999997 0.015779468812572
+1.36299999999996 0.0157579839262174
+1.36399999999996 0.0157365125565668
+1.36499999999996 0.0157150547281161
+1.36599999999996 0.0156936104652874
+1.36699999999996 0.0156721797924286
+1.36799999999996 0.0156507627338139
+1.36899999999996 0.0156293593136433
+1.36999999999996 0.0156079695560429
+1.37099999999996 0.0155865934850648
+1.37199999999996 0.0155652311246872
+1.37299999999996 0.0155438824988144
+1.37399999999996 0.0155225476312766
+1.37499999999996 0.0155012265458301
+1.37599999999996 0.0154799192661574
+1.37699999999996 0.0154586258158668
+1.37799999999996 0.015437346218493
+1.37899999999996 0.0154160804974965
+1.37999999999996 0.0153948286762642
+1.38099999999996 0.0153735907781087
+1.38199999999996 0.015352366826269
+1.38299999999996 0.0153311568439102
+1.38399999999996 0.0153099608541235
+1.38499999999996 0.0152887788799262
+1.38599999999996 0.0152676109442616
+1.38699999999996 0.0152464570699996
+1.38799999999996 0.0152253172799358
+1.38899999999996 0.0152041915967922
+1.38999999999996 0.015183080043217
+1.39099999999996 0.0151619826417845
+1.39199999999996 0.0151408994149954
+1.39299999999996 0.0151198303852765
+1.39399999999996 0.0150987755749808
+1.39499999999996 0.0150777350063876
+1.39599999999996 0.0150567087017025
+1.39699999999996 0.0150356966830575
+1.39799999999996 0.0150146989725105
+1.39899999999996 0.0149937155920462
+1.39999999999996 0.0149727465635753
+1.40099999999996 0.014951791908935
+1.40199999999996 0.0149308516498887
+1.40299999999996 0.0149099258081264
+1.40399999999996 0.0148890144052643
+1.40499999999996 0.014868117462845
+1.40599999999996 0.0148472350023378
+1.40699999999996 0.0148263670451381
+1.40799999999996 0.0148055136125678
+1.40899999999996 0.0147846747258756
+1.40999999999996 0.0147638504062364
+1.41099999999996 0.0147430406747516
+1.41199999999996 0.0147222455524494
+1.41299999999996 0.0147014650602842
+1.41399999999996 0.0146806992191372
+1.41499999999996 0.0146599480498161
+1.41599999999996 0.0146392115730554
+1.41699999999996 0.014618489809516
+1.41799999999996 0.0145977827797856
+1.41899999999996 0.0145770905043784
+1.41999999999996 0.0145564130037356
+1.42099999999996 0.0145357502982249
+1.42199999999996 0.0145151024081407
+1.42299999999996 0.0144944693537043
+1.42399999999996 0.0144738511550639
+1.42499999999996 0.0144532478322941
+1.42599999999996 0.0144326594053969
+1.42699999999996 0.0144120858943006
+1.42799999999996 0.0143915273188609
+1.42899999999996 0.0143709836988599
+1.42999999999996 0.0143504550540071
+1.43099999999996 0.0143299414039387
+1.43199999999996 0.014309442768218
+1.43299999999996 0.0142889591663351
+1.43399999999996 0.0142684906177075
+1.43499999999996 0.0142480371416795
+1.43599999999996 0.0142275987575226
+1.43699999999996 0.0142071754844353
+1.43799999999996 0.0141867673415434
+1.43899999999996 0.0141663743478999
+1.43999999999996 0.0141459965224848
+1.44099999999996 0.0141256338842055
+1.44199999999996 0.0141052864518966
+1.44299999999996 0.0140849542443201
+1.44399999999996 0.0140646372801651
+1.44499999999996 0.0140443355780484
+1.44599999999996 0.0140240491565138
+1.44699999999996 0.0140037780340328
+1.44799999999996 0.0139835222290042
+1.44899999999996 0.0139632817597543
+1.44999999999996 0.0139430566445369
+1.45099999999996 0.0139228469015335
+1.45199999999996 0.0139026525488529
+1.45299999999995 0.0138824736045318
+1.45399999999995 0.0138623100865342
+1.45499999999995 0.013842162012752
+1.45599999999995 0.0138220294010049
+1.45699999999995 0.01380191226904
+1.45799999999995 0.0137818106345326
+1.45899999999995 0.0137617245150853
+1.45999999999995 0.0137416539282291
+1.46099999999995 0.0137215988914224
+1.46199999999995 0.0137015594220519
+1.46299999999995 0.0136815355374318
+1.46399999999995 0.0136615272548048
+1.46499999999995 0.0136415345913413
+1.46599999999995 0.0136215575641397
+1.46699999999995 0.0136015961902268
+1.46799999999995 0.0135816504865572
+1.46899999999995 0.0135617204700139
+1.46999999999995 0.0135418061574081
+1.47099999999995 0.013521907565479
+1.47199999999995 0.0135020247108944
+1.47299999999995 0.0134821576102502
+1.47399999999995 0.0134623062800708
+1.47499999999995 0.0134424707368088
+1.47599999999995 0.0134226509968456
+1.47699999999995 0.0134028470764908
+1.47799999999995 0.0133830589919825
+1.47899999999995 0.0133632867594875
+1.47999999999995 0.0133435303951012
+1.48099999999995 0.0133237899148475
+1.48199999999995 0.0133040653346791
+1.48299999999995 0.0132843566704774
+1.48399999999995 0.0132646639380526
+1.48499999999995 0.0132449871531438
+1.48599999999995 0.0132253263314186
+1.48699999999995 0.0132056814884738
+1.48799999999995 0.0131860526398352
+1.48899999999995 0.0131664398009574
+1.48999999999995 0.0131468429872241
+1.49099999999995 0.0131272622139479
+1.49199999999995 0.0131076974963709
+1.49299999999995 0.013088148849664
+1.49399999999995 0.0130686162889274
+1.49499999999995 0.0130490998291907
+1.49599999999995 0.0130295994854126
+1.49699999999995 0.0130101152724813
+1.49799999999995 0.0129906472052142
+1.49899999999995 0.0129711952983584
+1.49999999999995 0.0129517595665901
+1.50099999999995 0.0129323400245155
+1.50199999999995 0.01291293668667
+1.50299999999995 0.0128935495675188
+1.50399999999995 0.0128741786814566
+1.50499999999995 0.0128548240428081
+1.50599999999995 0.0128354856658275
+1.50699999999995 0.012816163564699
+1.50799999999995 0.0127968577535365
+1.50899999999995 0.0127775682463839
+1.50999999999995 0.0127582950572152
+1.51099999999995 0.0127390381999341
+1.51199999999995 0.0127197976883746
+1.51299999999995 0.0127005735363008
+1.51399999999995 0.0126813657574069
+1.51499999999995 0.0126621743653173
+1.51599999999995 0.0126429993735866
+1.51699999999995 0.0126238407956999
+1.51799999999995 0.0126046986450727
+1.51899999999995 0.0125855729350505
+1.51999999999995 0.0125664636789098
+1.52099999999995 0.0125473708898573
+1.52199999999995 0.0125282945810304
+1.52299999999995 0.0125092347654971
+1.52399999999995 0.0124901914562561
+1.52499999999995 0.0124711646662367
+1.52599999999995 0.0124521544082993
+1.52699999999995 0.0124331606952348
+1.52799999999995 0.0124141835397652
+1.52899999999995 0.0123952229545434
+1.52999999999995 0.0123762789521533
+1.53099999999995 0.01235735154511
+1.53199999999995 0.0123384407458594
+1.53299999999995 0.012319546566779
+1.53399999999995 0.0123006690201771
+1.53499999999995 0.0122818081182935
+1.53599999999995 0.0122629638732995
+1.53699999999995 0.0122441362972975
+1.53799999999995 0.0122253254023215
+1.53899999999995 0.0122065312003371
+1.53999999999995 0.0121877537032412
+1.54099999999995 0.0121689929228626
+1.54199999999995 0.0121502488709617
+1.54299999999995 0.0121315215592306
+1.54399999999994 0.0121128109992932
+1.54499999999994 0.0120941172027053
+1.54599999999994 0.0120754401809547
+1.54699999999994 0.0120567799454611
+1.54799999999994 0.0120381365075761
+1.54899999999994 0.0120195098785836
+1.54999999999994 0.0120009000696996
+1.55099999999994 0.0119823070920723
+1.55199999999994 0.0119637309567822
+1.55299999999994 0.0119451716748421
+1.55399999999994 0.0119266292571973
+1.55499999999994 0.0119081037147254
+1.55599999999994 0.0118895950582367
+1.55699999999994 0.0118711032984739
+1.55799999999994 0.0118526284461125
+1.55899999999994 0.0118341705117607
+1.55999999999994 0.0118157295059593
+1.56099999999994 0.0117973054391821
+1.56199999999994 0.0117788983218359
+1.56299999999994 0.0117605081642601
+1.56399999999994 0.0117421349767274
+1.56499999999994 0.0117237787694437
+1.56599999999994 0.0117054395525476
+1.56699999999994 0.0116871173361113
+1.56799999999994 0.0116688121301402
+1.56899999999994 0.011650523944573
+1.56999999999994 0.0116322527892818
+1.57099999999994 0.0116139986740721
+1.57199999999994 0.0115957616086831
+1.57299999999994 0.0115775416027876
+1.57399999999994 0.0115593386659919
+1.57499999999994 0.0115411528078361
+1.57599999999994 0.0115229840377941
+1.57699999999994 0.0115048323652739
+1.57799999999994 0.011486697799617
+1.57899999999994 0.0114685803500992
+1.57999999999994 0.0114504800259303
+1.58099999999994 0.0114323968362543
+1.58199999999994 0.0114143307901492
+1.58299999999994 0.0113962818966274
+1.58399999999994 0.0113782501646357
+1.58499999999994 0.0113602356030553
+1.58599999999994 0.0113422382207017
+1.58699999999994 0.0113242580263251
+1.58799999999994 0.0113062950286102
+1.58899999999994 0.0112883492361765
+1.58999999999994 0.0112704206575781
+1.59099999999994 0.0112525093013042
+1.59199999999994 0.0112346151757785
+1.59299999999994 0.01121673828936
+1.59399999999994 0.0111988786503424
+1.59499999999994 0.0111810362669549
+1.59599999999994 0.0111632111473614
+1.59699999999994 0.0111454032996615
+1.59799999999994 0.0111276127318898
+1.59899999999994 0.0111098394520163
+1.59999999999994 0.0110920834679466
+1.60099999999994 0.0110743447875218
+1.60199999999994 0.0110566234185185
+1.60299999999994 0.011038919368649
+1.60399999999994 0.0110212326455613
+1.60499999999994 0.0110035632568393
+1.60599999999994 0.0109859112100027
+1.60699999999994 0.0109682765125073
+1.60799999999994 0.0109506591717448
+1.60899999999994 0.0109330591950429
+1.60999999999994 0.0109154765896658
+1.61099999999994 0.0108979113628137
+1.61199999999994 0.0108803635216231
+1.61299999999994 0.0108628330731671
+1.61399999999994 0.010845320024455
+1.61499999999994 0.0108278243824329
+1.61599999999994 0.0108103461539834
+1.61699999999994 0.0107928853459258
+1.61799999999994 0.0107754419650162
+1.61899999999994 0.0107580160179474
+1.61999999999994 0.0107406075113495
+1.62099999999994 0.0107232164517891
+1.62199999999994 0.0107058428457703
+1.62299999999994 0.010688486699734
+1.62399999999994 0.0106711480200586
+1.62499999999994 0.0106538268130596
+1.62599999999994 0.01063652308499
+1.62699999999994 0.0106192368420403
+1.62799999999994 0.0106019680903383
+1.62899999999994 0.0105847168359496
+1.62999999999994 0.0105674830848775
+1.63099999999994 0.0105502668430629
+1.63199999999994 0.0105330681163847
+1.63299999999994 0.0105158869106596
+1.63399999999994 0.0104987232316424
+1.63499999999993 0.0104815770850259
+1.63599999999993 0.010464448476441
+1.63699999999993 0.0104473374114571
+1.63799999999993 0.0104302438955815
+1.63899999999993 0.0104131679342602
+1.63999999999993 0.0103961095328775
+1.64099999999993 0.0103790686967564
+1.64199999999993 0.0103620454311584
+1.64299999999993 0.0103450397412837
+1.64399999999993 0.0103280516322714
+1.64499999999993 0.0103110811091993
+1.64599999999993 0.0102941281770842
+1.64699999999993 0.0102771928408821
+1.64799999999993 0.0102602751054879
+1.64899999999993 0.0102433749757357
+1.64999999999993 0.0102264924563989
+1.65099999999993 0.0102096275521904
+1.65199999999993 0.0101927802677622
+1.65299999999993 0.0101759506077062
+1.65399999999993 0.0101591385765535
+1.65499999999993 0.0101423441787752
+1.65599999999993 0.010125567418782
+1.65699999999993 0.0101088083009244
+1.65799999999993 0.0100920668294929
+1.65899999999993 0.010075343008718
+1.65999999999993 0.0100586368427702
+1.66099999999993 0.0100419483357603
+1.66199999999993 0.0100252774917392
+1.66299999999993 0.0100086243146982
+1.66399999999993 0.00999198880856914
+1.66499999999993 0.00997537097722414
+1.66599999999993 0.00995877082447603
+1.66699999999993 0.00994218835407827
+1.66799999999993 0.00992562356972508
+1.66899999999993 0.0099090764750515
+1.66999999999993 0.00989254707363351
+1.67099999999993 0.00987603536898807
+1.67199999999993 0.00985954136457323
+1.67299999999993 0.00984306506378822
+1.67399999999993 0.00982660646997351
+1.67499999999993 0.00981016558641092
+1.67599999999993 0.0097937424163237
+1.67699999999993 0.00977733696287659
+1.67799999999993 0.00976094922917594
+1.67899999999993 0.00974457921826978
+1.67999999999993 0.0097282269331479
+1.68099999999993 0.00971189237674194
+1.68199999999993 0.00969557555192548
+1.68299999999993 0.00967927646151415
+1.68399999999993 0.00966299510826563
+1.68499999999993 0.00964673149487986
+1.68599999999993 0.00963048562399901
+1.68699999999993 0.00961425749820766
+1.68799999999993 0.00959804712003282
+1.68899999999993 0.00958185449194406
+1.68999999999993 0.00956567961635355
+1.69099999999993 0.00954952249561622
+1.69199999999993 0.00953338313202976
+1.69299999999993 0.00951726152783479
+1.69399999999993 0.00950115768521488
+1.69499999999993 0.00948507160629669
+1.69599999999993 0.00946900329315001
+1.69699999999993 0.00945295274778789
+1.69799999999993 0.00943691997216671
+1.69899999999993 0.00942090496818626
+1.69999999999993 0.00940490773768985
+1.70099999999993 0.00938892828246436
+1.70199999999993 0.00937296660424039
+1.70299999999993 0.00935702270469229
+1.70399999999993 0.00934109658543827
+1.70499999999993 0.00932518824804051
+1.70599999999993 0.00930929769400521
+1.70699999999993 0.00929342492478271
+1.70799999999993 0.00927756994176757
+1.70899999999993 0.00926173274629866
+1.70999999999993 0.00924591333965923
+1.71099999999993 0.00923011172307703
+1.71199999999993 0.00921432789772441
+1.71299999999993 0.00919856186471835
+1.71399999999993 0.00918281362512061
+1.71499999999993 0.00916708317993779
+1.71599999999993 0.00915137053012144
+1.71699999999993 0.00913567567656813
+1.71799999999993 0.00911999862011953
+1.71899999999993 0.00910433936156258
+1.71999999999993 0.00908869790162945
+1.72099999999993 0.00907307424099775
+1.72199999999993 0.00905746838029056
+1.72299999999993 0.00904188032007652
+1.72399999999993 0.00902631006086997
+1.72499999999993 0.00901075760313098
+1.72599999999992 0.00899522294726547
+1.72699999999992 0.00897970609362531
+1.72799999999992 0.0089642070425084
+1.72899999999992 0.00894872579415878
+1.72999999999992 0.00893326234876667
+1.73099999999992 0.00891781670646863
+1.73199999999992 0.0089023888673476
+1.73299999999992 0.00888697883143304
+1.73399999999992 0.00887158659870098
+1.73499999999992 0.00885621216907411
+1.73599999999992 0.00884085554242193
+1.73699999999992 0.00882551671856076
+1.73799999999992 0.00881019569725392
+1.73899999999992 0.00879489247821175
+1.73999999999992 0.00877960706109174
+1.74099999999992 0.00876433944549861
+1.74199999999992 0.00874908963098443
+1.74299999999992 0.00873385761704867
+1.74399999999992 0.00871864340313833
+1.74499999999992 0.00870344698864801
+1.74599999999992 0.00868826837292001
+1.74699999999992 0.00867310755524445
+1.74799999999992 0.00865796453485932
+1.74899999999992 0.00864283931095059
+1.74999999999992 0.00862773188265232
+1.75099999999992 0.00861264224904676
+1.75199999999992 0.00859757040916439
+1.75299999999992 0.00858251636198407
+1.75399999999992 0.00856748010643314
+1.75499999999992 0.00855246164138744
+1.75599999999992 0.00853746096567149
+1.75699999999992 0.00852247807805855
+1.75799999999992 0.00850751297727071
+1.75899999999992 0.00849256566197898
+1.75999999999992 0.0084776361308034
+1.76099999999992 0.00846272438231314
+1.76199999999992 0.00844783041502657
+1.76299999999992 0.00843295422741138
+1.76399999999992 0.00841809581788466
+1.76499999999992 0.00840325518481301
+1.76599999999992 0.00838843232651262
+1.76699999999992 0.00837362724124936
+1.76799999999992 0.00835883992723891
+1.76899999999992 0.00834407038264682
+1.76999999999992 0.00832931860558863
+1.77099999999992 0.00831458459412993
+1.77199999999992 0.00829986834628652
+1.77299999999992 0.00828516986002443
+1.77399999999992 0.00827048913326008
+1.77499999999992 0.00825582616386034
+1.77599999999992 0.00824118094964263
+1.77699999999992 0.00822655348837503
+1.77799999999992 0.00821194377777636
+1.77899999999992 0.0081973518155163
+1.77999999999992 0.00818277759921546
+1.78099999999992 0.0081682211264455
+1.78199999999992 0.0081536823947292
+1.78299999999992 0.00813916140154058
+1.78399999999992 0.00812465814430499
+1.78499999999992 0.0081101726203992
+1.78599999999992 0.00809570482715153
+1.78699999999992 0.00808125476184188
+1.78799999999992 0.00806682242170189
+1.78899999999992 0.00805240780391501
+1.78999999999992 0.0080380109056166
+1.79099999999992 0.00802363172389404
+1.79199999999992 0.0080092702557868
+1.79299999999992 0.00799492649828657
+1.79399999999992 0.00798060044833734
+1.79499999999992 0.00796629210283548
+1.79599999999992 0.00795200145862988
+1.79699999999992 0.00793772851252202
+1.79799999999992 0.00792347326126607
+1.79899999999992 0.00790923570156898
+1.79999999999992 0.0078950158300906
+1.80099999999992 0.00788081364344377
+1.80199999999992 0.00786662913819442
+1.80299999999992 0.00785246231086163
+1.80399999999992 0.00783831315791781
+1.80499999999992 0.0078241816757887
+1.80599999999992 0.00781006786085355
+1.80699999999992 0.00779597170944517
+1.80799999999992 0.00778189321785007
+1.80899999999992 0.00776783238230849
+1.80999999999992 0.00775378919901458
+1.81099999999992 0.00773976366411644
+1.81199999999992 0.00772575577371624
+1.81299999999992 0.00771176552387031
+1.81399999999992 0.00769779291058928
+1.81499999999992 0.00768383792983809
+1.81599999999992 0.0076699005775362
+1.81699999999991 0.00765598084955759
+1.81799999999991 0.00764207874173092
+1.81899999999991 0.0076281942498396
+1.81999999999991 0.00761432736962192
+1.82099999999991 0.0076004780967711
+1.82199999999991 0.00758664642693543
+1.82299999999991 0.00757283235571837
+1.82399999999991 0.00755903587867861
+1.82499999999991 0.00754525699133021
+1.82599999999991 0.00753149568914268
+1.82699999999991 0.00751775196754108
+1.82799999999991 0.00750402582190614
+1.82899999999991 0.00749031724757432
+1.82999999999991 0.00747662623983795
+1.83099999999991 0.00746295279394528
+1.83199999999991 0.00744929690510065
+1.83299999999991 0.00743565856846452
+1.83399999999991 0.00742203777915362
+1.83499999999991 0.00740843453224101
+1.83599999999991 0.00739484882275622
+1.83699999999991 0.00738128064568532
+1.83799999999991 0.007367729995971
+1.83899999999991 0.00735419686851275
+1.83999999999991 0.00734068125816687
+1.84099999999991 0.00732718315974662
+1.84199999999991 0.00731370256802231
+1.84299999999991 0.00730023947772139
+1.84399999999991 0.00728679388352855
+1.84499999999991 0.00727336578008585
+1.84599999999991 0.00725995516199279
+1.84699999999991 0.0072465620238064
+1.84799999999991 0.00723318636004136
+1.84899999999991 0.00721982816517013
+1.84999999999991 0.00720648743362298
+1.85099999999991 0.00719316415978814
+1.85199999999991 0.0071798583380119
+1.85299999999991 0.00716656996259866
+1.85399999999991 0.00715329902781112
+1.85499999999991 0.00714004552787028
+1.85599999999991 0.00712680945695563
+1.85699999999991 0.00711359080920518
+1.85799999999991 0.00710038957871559
+1.85899999999991 0.00708720575954228
+1.85999999999991 0.00707403934569952
+1.86099999999991 0.00706089033116052
+1.86199999999991 0.00704775870985755
+1.86299999999991 0.00703464447568202
+1.86399999999991 0.00702154762248461
+1.86499999999991 0.00700846814407531
+1.86599999999991 0.00699540603422362
+1.86699999999991 0.00698236128665854
+1.86799999999991 0.00696933389506875
+1.86899999999991 0.00695632385310268
+1.86999999999991 0.0069433311543686
+1.87099999999991 0.00693035579243476
+1.87199999999991 0.00691739776082943
+1.87299999999991 0.00690445705304106
+1.87399999999991 0.00689153366251836
+1.87499999999991 0.00687862758267037
+1.87599999999991 0.00686573880686661
+1.87699999999991 0.00685286732843714
+1.87799999999991 0.00684001314067269
+1.87899999999991 0.00682717623682474
+1.87999999999991 0.00681435661010564
+1.88099999999991 0.00680155425368868
+1.88199999999991 0.00678876916070824
+1.88299999999991 0.00677600132425983
+1.88399999999991 0.00676325073740023
+1.88499999999991 0.00675051739314759
+1.88599999999991 0.00673780128448152
+1.88699999999991 0.00672510240434319
+1.88799999999991 0.00671242074563543
+1.88899999999991 0.00669975630122285
+1.88999999999991 0.00668710906393189
+1.89099999999991 0.006674479026551
+1.89199999999991 0.00666186618183067
+1.89299999999991 0.00664927052248355
+1.89399999999991 0.00663669204118458
+1.89499999999991 0.00662413073057105
+1.89599999999991 0.00661158658324273
+1.89699999999991 0.00659905959176195
+1.89799999999991 0.00658654974865371
+1.89899999999991 0.00657405704640579
+1.89999999999991 0.00656158147746883
+1.90099999999991 0.00654912303425646
+1.90199999999991 0.00653668170914535
+1.90299999999991 0.00652425749447536
+1.90399999999991 0.00651185038254964
+1.90499999999991 0.00649946036563469
+1.90599999999991 0.0064870874359605
+1.9069999999999 0.00647473158572061
+1.9079999999999 0.00646239280707226
+1.9089999999999 0.00645007109213647
+1.9099999999999 0.00643776643299811
+1.9109999999999 0.00642547882170605
+1.9119999999999 0.00641320825027322
+1.9129999999999 0.00640095471067675
+1.9139999999999 0.00638871819485803
+1.9149999999999 0.00637649869472283
+1.9159999999999 0.00636429620214142
+1.9169999999999 0.00635211070894862
+1.9179999999999 0.00633994220694394
+1.9189999999999 0.00632779068789169
+1.9199999999999 0.00631565614352104
+1.9209999999999 0.00630353856552613
+1.9219999999999 0.00629143794556622
+1.9229999999999 0.00627935427526573
+1.9239999999999 0.00626728754621435
+1.9249999999999 0.00625523774996717
+1.9259999999999 0.00624320487804476
+1.9269999999999 0.00623118892193327
+1.9279999999999 0.00621918987308453
+1.9289999999999 0.00620720772291617
+1.9299999999999 0.00619524246281168
+1.9309999999999 0.00618329408412056
+1.9319999999999 0.00617136257815836
+1.9329999999999 0.00615944793620685
+1.9339999999999 0.00614755014951406
+1.9349999999999 0.00613566920929441
+1.9359999999999 0.00612380510672882
+1.9369999999999 0.00611195783296477
+1.9379999999999 0.00610012737911643
+1.9389999999999 0.00608831373626478
+1.9399999999999 0.00607651689545764
+1.9409999999999 0.00606473684770985
+1.9419999999999 0.00605297358400333
+1.9429999999999 0.00604122709528716
+1.9439999999999 0.00602949737247773
+1.9449999999999 0.0060177844064588
+1.9459999999999 0.00600608818808162
+1.9469999999999 0.00599440870816501
+1.9479999999999 0.00598274595749549
+1.9489999999999 0.00597109992682735
+1.9499999999999 0.00595947060688277
+1.9509999999999 0.0059478579883519
+1.9519999999999 0.00593626206189299
+1.9529999999999 0.00592468281813245
+1.9539999999999 0.00591312024766499
+1.9549999999999 0.00590157434105368
+1.9559999999999 0.00589004508883008
+1.9569999999999 0.00587853248149434
+1.9579999999999 0.00586703650951525
+1.9589999999999 0.00585555716333041
+1.9599999999999 0.0058440944333463
+1.9609999999999 0.00583264830993835
+1.9619999999999 0.00582121878345109
+1.9629999999999 0.0058098058441982
+1.9639999999999 0.00579840948246265
+1.9649999999999 0.00578702968849677
+1.9659999999999 0.00577566645252238
+1.9669999999999 0.00576431976473086
+1.9679999999999 0.00575298961528324
+1.9689999999999 0.00574167599431035
+1.9699999999999 0.00573037889191287
+1.9709999999999 0.00571909829816143
+1.9719999999999 0.00570783420309677
+1.9729999999999 0.00569658659672975
+1.9739999999999 0.00568535546904151
+1.9749999999999 0.00567414080998355
+1.9759999999999 0.00566294260947782
+1.9769999999999 0.00565176085741684
+1.9779999999999 0.00564059554366377
+1.9789999999999 0.00562944665805255
+1.9799999999999 0.00561831419038795
+1.9809999999999 0.0056071981304457
+1.9819999999999 0.00559609846797257
+1.9829999999999 0.0055850151926865
+1.9839999999999 0.00557394829427666
+1.9849999999999 0.00556289776240355
+1.9859999999999 0.00555186358669915
+1.9869999999999 0.00554084575676696
+1.9879999999999 0.0055298442621821
+1.9889999999999 0.00551885909249145
+1.9899999999999 0.00550789023721372
+1.9909999999999 0.00549693768583955
+1.9919999999999 0.00548600142783161
+1.9929999999999 0.0054750814526247
+1.9939999999999 0.00546417774962584
+1.9949999999999 0.00545329030821438
+1.9959999999999 0.00544241911774207
+1.9969999999999 0.00543156416753321
+1.99799999999989 0.00542072544688469
+1.99899999999989 0.00540990294506613
+1.99999999999989 0.00539909665131994
+2.00099999999989 0.00538830655486146
+2.00199999999989 0.00537753264487901
+2.00299999999989 0.00536677491053404
+2.00399999999989 0.00535603334096117
+2.00499999999989 0.00534530792526834
+2.00599999999989 0.00533459865253686
+2.00699999999989 0.00532390551182156
+2.00799999999989 0.00531322849215082
+2.00899999999989 0.00530256758252674
+2.00999999999989 0.00529192277192516
+2.01099999999989 0.00528129404929584
+2.01199999999989 0.00527068140356247
+2.01299999999989 0.00526008482362285
+2.01399999999989 0.00524950429834892
+2.01499999999989 0.0052389398165869
+2.01599999999989 0.00522839136715734
+2.01699999999989 0.00521785893885528
+2.01799999999989 0.00520734252045029
+2.01899999999989 0.00519684210068661
+2.01999999999989 0.00518635766828318
+2.02099999999989 0.00517588921193383
+2.02199999999989 0.0051654367203073
+2.02299999999989 0.00515500018204735
+2.02399999999989 0.0051445795857729
+2.02499999999989 0.00513417492007807
+2.02599999999989 0.0051237861735323
+2.02699999999989 0.00511341333468045
+2.02799999999989 0.00510305639204289
+2.02899999999989 0.00509271533411559
+2.02999999999989 0.00508239014937024
+2.03099999999989 0.00507208082625429
+2.03199999999989 0.00506178735319111
+2.03299999999989 0.00505150971858005
+2.03399999999989 0.00504124791079653
+2.03499999999989 0.00503100191819217
+2.03599999999989 0.00502077172909484
+2.03699999999989 0.00501055733180879
+2.03799999999989 0.00500035871461471
+2.03899999999989 0.00499017586576987
+2.03999999999989 0.00498000877350819
+2.04099999999989 0.00496985742604032
+2.04199999999989 0.00495972181155375
+2.04299999999989 0.00494960191821291
+2.04399999999989 0.00493949773415927
+2.04499999999989 0.00492940924751139
+2.04599999999989 0.00491933644636509
+2.04699999999989 0.00490927931879347
+2.04799999999989 0.00489923785284704
+2.04899999999989 0.00488921203655381
+2.04999999999989 0.00487920185791938
+2.05099999999989 0.00486920730492706
+2.05199999999989 0.00485922836553791
+2.05299999999989 0.00484926502769087
+2.05399999999989 0.00483931727930285
+2.05499999999989 0.00482938510826884
+2.05599999999989 0.00481946850246195
+2.05699999999989 0.00480956744973356
+2.05799999999989 0.00479968193791338
+2.05899999999989 0.00478981195480957
+2.05999999999989 0.00477995748820881
+2.06099999999989 0.00477011852587637
+2.06199999999989 0.00476029505555628
+2.06299999999989 0.00475048706497134
+2.06399999999989 0.00474069454182327
+2.06499999999989 0.00473091747379277
+2.06599999999989 0.00472115584853963
+2.06699999999989 0.0047114096537028
+2.06799999999989 0.00470167887690052
+2.06899999999989 0.00469196350573038
+2.06999999999989 0.00468226352776941
+2.07099999999989 0.00467257893057421
+2.07199999999989 0.004662909701681
+2.07299999999989 0.00465325582860573
+2.07399999999989 0.00464361729884417
+2.07499999999989 0.00463399409987201
+2.07599999999989 0.00462438621914494
+2.07699999999989 0.00461479364409875
+2.07799999999989 0.00460521636214939
+2.07899999999989 0.00459565436069313
+2.07999999999989 0.00458610762710658
+2.08099999999989 0.00457657614874681
+2.08199999999989 0.00456705991295147
+2.08299999999989 0.00455755890703883
+2.08399999999989 0.00454807311830789
+2.08499999999989 0.00453860253403848
+2.08599999999989 0.00452914714149136
+2.08699999999989 0.00451970692790828
+2.08799999999989 0.00451028188051208
+2.08899999999988 0.00450087198650682
+2.08999999999988 0.00449147723307779
+2.09099999999988 0.00448209760739169
+2.09199999999988 0.00447273309659665
+2.09299999999988 0.00446338368782236
+2.09399999999988 0.00445404936818015
+2.09499999999988 0.00444473012476307
+2.09599999999988 0.004435425944646
+2.09699999999988 0.0044261368148857
+2.09799999999988 0.00441686272252097
+2.09899999999988 0.00440760365457265
+2.09999999999988 0.00439835959804379
+2.10099999999988 0.00438913053991969
+2.10199999999988 0.00437991646716801
+2.10299999999988 0.00437071736673884
+2.10399999999988 0.00436153322556482
+2.10499999999988 0.0043523640305612
+2.10599999999988 0.00434320976862594
+2.10699999999988 0.00433407042663981
+2.10799999999988 0.00432494599146645
+2.10899999999988 0.0043158364499525
+2.10999999999988 0.00430674178892764
+2.11099999999988 0.00429766199520471
+2.11199999999988 0.0042885970555798
+2.11299999999988 0.00427954695683231
+2.11399999999988 0.00427051168572508
+2.11499999999988 0.00426149122900444
+2.11599999999988 0.00425248557340031
+2.11699999999988 0.0042434947056263
+2.11799999999988 0.00423451861237979
+2.11899999999988 0.00422555728034199
+2.11999999999988 0.00421661069617809
+2.12099999999988 0.00420767884653728
+2.12199999999988 0.00419876171805288
+2.12299999999988 0.00418985929734242
+2.12399999999988 0.0041809715710077
+2.12499999999988 0.00417209852563492
+2.12599999999988 0.00416324014779472
+2.12699999999988 0.00415439642404233
+2.12799999999988 0.00414556734091758
+2.12899999999988 0.00413675288494504
+2.12999999999988 0.00412795304263409
+2.13099999999988 0.00411916780047901
+2.13199999999988 0.00411039714495904
+2.13299999999988 0.00410164106253853
+2.13399999999988 0.00409289953966695
+2.13499999999988 0.00408417256277903
+2.13599999999988 0.0040754601182948
+2.13699999999988 0.00406676219261974
+2.13799999999988 0.00405807877214479
+2.13899999999988 0.0040494098432465
+2.13999999999988 0.00404075539228708
+2.14099999999988 0.00403211540561447
+2.14199999999988 0.00402348986956248
+2.14299999999988 0.00401487877045084
+2.14399999999988 0.00400628209458525
+2.14499999999988 0.00399769982825755
+2.14599999999988 0.00398913195774573
+2.14699999999988 0.00398057846931405
+2.14799999999988 0.0039720393492131
+2.14899999999988 0.00396351458367992
+2.14999999999988 0.00395500415893806
+2.15099999999988 0.00394650806119765
+2.15199999999988 0.00393802627665552
+2.15299999999988 0.00392955879149526
+2.15399999999988 0.00392110559188731
+2.15499999999988 0.00391266666398903
+2.15599999999988 0.00390424199394482
+2.15699999999988 0.00389583156788616
+2.15799999999988 0.00388743537193172
+2.15899999999988 0.00387905339218744
+2.15999999999988 0.00387068561474659
+2.16099999999988 0.00386233202568989
+2.16199999999988 0.00385399261108556
+2.16299999999988 0.00384566735698944
+2.16399999999988 0.00383735624944502
+2.16499999999988 0.00382905927448357
+2.16599999999988 0.00382077641812419
+2.16699999999988 0.00381250766637393
+2.16799999999988 0.00380425300522782
+2.16899999999988 0.003796012420669
+2.16999999999988 0.00378778589866877
+2.17099999999988 0.00377957342518668
+2.17199999999988 0.00377137498617064
+2.17299999999988 0.00376319056755694
+2.17399999999988 0.0037550201552704
+2.17499999999988 0.00374686373522439
+2.17599999999988 0.00373872129332097
+2.17699999999988 0.00373059281545092
+2.17799999999988 0.00372247828749385
+2.17899999999988 0.00371437769531827
+2.17999999999987 0.00370629102478166
+2.18099999999987 0.00369821826173059
+2.18199999999987 0.00369015939200076
+2.18299999999987 0.00368211440141709
+2.18399999999987 0.00367408327579381
+2.18499999999987 0.00366606600093453
+2.18599999999987 0.00365806256263234
+2.18699999999987 0.00365007294666985
+2.18799999999987 0.0036420971388193
+2.18899999999987 0.00363413512484265
+2.18999999999987 0.00362618689049162
+2.19099999999987 0.00361825242150782
+2.19199999999987 0.00361033170362276
+2.19299999999987 0.003602424722558
+2.19399999999987 0.00359453146402519
+2.19499999999987 0.00358665191372617
+2.19599999999987 0.00357878605735302
+2.19699999999987 0.00357093388058815
+2.19799999999987 0.0035630953691044
+2.19899999999987 0.0035552705085651
+2.19999999999987 0.00354745928462414
+2.20099999999987 0.00353966168292605
+2.20199999999987 0.00353187768910612
+2.20299999999987 0.0035241072887904
+2.20399999999987 0.00351635046759585
+2.20499999999987 0.00350860721113038
+2.20599999999987 0.00350087750499293
+2.20699999999987 0.00349316133477356
+2.20799999999987 0.00348545868605353
+2.20899999999987 0.00347776954440534
+2.20999999999987 0.00347009389539287
+2.21099999999987 0.00346243172457138
+2.21199999999987 0.00345478301748766
+2.21299999999987 0.00344714775968007
+2.21399999999987 0.00343952593667861
+2.21499999999987 0.003431917534005
+2.21599999999987 0.00342432253717279
+2.21699999999987 0.00341674093168738
+2.21799999999987 0.00340917270304614
+2.21899999999987 0.00340161783673848
+2.21999999999987 0.0033940763182459
+2.22099999999987 0.00338654813304207
+2.22199999999987 0.00337903326659296
+2.22299999999987 0.00337153170435682
+2.22399999999987 0.00336404343178436
+2.22499999999987 0.00335656843431873
+2.22599999999987 0.00334910669739565
+2.22699999999987 0.00334165820644349
+2.22799999999987 0.0033342229468833
+2.22899999999987 0.00332680090412893
+2.22999999999987 0.00331939206358708
+2.23099999999987 0.00331199641065737
+2.23199999999987 0.00330461393073245
+2.23299999999987 0.00329724460919801
+2.23399999999987 0.00328988843143292
+2.23499999999987 0.00328254538280928
+2.23599999999987 0.00327521544869246
+2.23699999999987 0.00326789861444122
+2.23799999999987 0.00326059486540776
+2.23899999999987 0.00325330418693782
+2.23999999999987 0.0032460265643707
+2.24099999999987 0.00323876198303939
+2.24199999999987 0.00323151042827059
+2.24299999999987 0.00322427188538484
+2.24399999999987 0.00321704633969655
+2.24499999999987 0.00320983377651407
+2.24599999999987 0.00320263418113981
+2.24699999999987 0.00319544753887025
+2.24799999999987 0.00318827383499605
+2.24899999999987 0.00318111305480213
+2.24999999999987 0.00317396518356769
+2.25099999999987 0.00316683020656635
+2.25199999999987 0.00315970810906617
+2.25299999999987 0.00315259887632974
+2.25399999999987 0.00314550249361427
+2.25499999999987 0.00313841894617161
+2.25599999999987 0.00313134821924837
+2.25699999999987 0.00312429029808598
+2.25799999999987 0.00311724516792073
+2.25899999999987 0.0031102128139839
+2.25999999999987 0.00310319322150176
+2.26099999999987 0.0030961863756957
+2.26199999999987 0.00308919226178225
+2.26299999999987 0.00308221086497321
+2.26399999999987 0.00307524217047564
+2.26499999999987 0.00306828616349202
+2.26599999999987 0.00306134282922024
+2.26699999999987 0.00305441215285372
+2.26799999999987 0.00304749411958147
+2.26899999999987 0.00304058871458814
+2.26999999999987 0.00303369592305409
+2.27099999999986 0.0030268157301555
+2.27199999999986 0.00301994812106439
+2.27299999999986 0.0030130930809487
+2.27399999999986 0.00300625059497238
+2.27499999999986 0.00299942064829545
+2.27599999999986 0.00299260322607405
+2.27699999999986 0.00298579831346052
+2.27799999999986 0.00297900589560348
+2.27899999999986 0.00297222595764787
+2.27999999999986 0.00296545848473505
+2.28099999999986 0.00295870346200284
+2.28199999999986 0.00295196087458561
+2.28299999999986 0.00294523070761433
+2.28399999999986 0.00293851294621665
+2.28499999999986 0.00293180757551694
+2.28599999999986 0.00292511458063641
+2.28699999999986 0.00291843394669312
+2.28799999999986 0.00291176565880207
+2.28899999999986 0.00290510970207528
+2.28999999999986 0.00289846606162185
+2.29099999999986 0.002891834722548
+2.29199999999986 0.00288521566995716
+2.29299999999986 0.00287860888895004
+2.29399999999986 0.00287201436462468
+2.29499999999986 0.00286543208207653
+2.29599999999986 0.00285886202639851
+2.29699999999986 0.00285230418268106
+2.29799999999986 0.00284575853601223
+2.29899999999986 0.00283922507147774
+2.29999999999986 0.00283270377416102
+2.30099999999986 0.00282619462914331
+2.30199999999986 0.00281969762150372
+2.30299999999986 0.00281321273631925
+2.30399999999986 0.00280673995866491
+2.30499999999986 0.00280027927361375
+2.30599999999986 0.00279383066623697
+2.30699999999986 0.00278739412160389
+2.30799999999986 0.00278096962478213
+2.30899999999986 0.00277455716083759
+2.30999999999986 0.00276815671483455
+2.31099999999986 0.00276176827183571
+2.31199999999986 0.00275539181690229
+2.31299999999986 0.00274902733509404
+2.31399999999986 0.00274267481146938
+2.31499999999986 0.00273633423108538
+2.31599999999986 0.00273000557899787
+2.31699999999986 0.00272368884026149
+2.31799999999986 0.00271738399992976
+2.31899999999986 0.00271109104305513
+2.31999999999986 0.00270480995468906
+2.32099999999986 0.00269854071988206
+2.32199999999986 0.00269228332368377
+2.32299999999986 0.00268603775114302
+2.32399999999986 0.00267980398730787
+2.32499999999986 0.0026735820172257
+2.32599999999986 0.00266737182594326
+2.32699999999986 0.00266117339850672
+2.32799999999986 0.00265498671996175
+2.32899999999986 0.00264881177535358
+2.32999999999986 0.00264264854972704
+2.33099999999986 0.00263649702812665
+2.33199999999986 0.00263035719559663
+2.33299999999986 0.00262422903718104
+2.33399999999986 0.00261811253792376
+2.33499999999986 0.00261200768286861
+2.33599999999986 0.00260591445705936
+2.33699999999986 0.00259983284553984
+2.33799999999986 0.00259376283335397
+2.33899999999986 0.0025877044055458
+2.33999999999986 0.00258165754715963
+2.34099999999986 0.00257562224324
+2.34199999999986 0.00256959847883181
+2.34299999999986 0.00256358623898032
+2.34399999999986 0.00255758550873127
+2.34499999999986 0.00255159627313089
+2.34599999999986 0.00254561851722599
+2.34699999999986 0.00253965222606399
+2.34799999999986 0.002533697384693
+2.34899999999986 0.00252775397816189
+2.34999999999986 0.00252182199152029
+2.35099999999986 0.00251590140981873
+2.35199999999986 0.00250999221810863
+2.35299999999986 0.00250409440144238
+2.35399999999986 0.00249820794487343
+2.35499999999986 0.00249233283345628
+2.35599999999986 0.0024864690522466
+2.35699999999986 0.00248061658630126
+2.35799999999986 0.00247477542067837
+2.35899999999986 0.00246894554043738
+2.35999999999986 0.00246312693063909
+2.36099999999985 0.00245731957634575
+2.36199999999985 0.00245152346262108
+2.36299999999985 0.00244573857453035
+2.36399999999985 0.00243996489714042
+2.36499999999985 0.00243420241551979
+2.36599999999985 0.00242845111473871
+2.36699999999985 0.00242271097986915
+2.36799999999985 0.00241698199598492
+2.36899999999985 0.00241126414816171
+2.36999999999985 0.00240555742147713
+2.37099999999985 0.00239986180101078
+2.37199999999985 0.0023941772718443
+2.37299999999985 0.00238850381906142
+2.37399999999985 0.00238284142774803
+2.37499999999985 0.00237719008299221
+2.37599999999985 0.00237154976988431
+2.37699999999985 0.002365920473517
+2.37799999999985 0.00236030217898529
+2.37899999999985 0.00235469487138664
+2.37999999999985 0.00234909853582096
+2.38099999999985 0.00234351315739071
+2.38199999999985 0.00233793872120091
+2.38299999999985 0.00233237521235924
+2.38399999999985 0.00232682261597605
+2.38499999999985 0.00232128091716443
+2.38599999999985 0.00231575010104028
+2.38699999999985 0.00231023015272233
+2.38799999999985 0.00230472105733222
+2.38899999999985 0.00229922279999454
+2.38999999999985 0.00229373536583688
+2.39099999999985 0.0022882587399899
+2.39199999999985 0.00228279290758736
+2.39299999999985 0.00227733785376618
+2.39399999999985 0.00227189356366649
+2.39499999999985 0.0022664600224317
+2.39599999999985 0.00226103721520851
+2.39699999999985 0.00225562512714701
+2.39799999999985 0.00225022374340071
+2.39899999999985 0.00224483304912657
+2.39999999999985 0.00223945302948509
+2.40099999999985 0.00223408366964033
+2.40199999999985 0.00222872495475999
+2.40299999999985 0.00222337687001541
+2.40399999999985 0.00221803940058168
+2.40499999999985 0.00221271253163766
+2.40599999999985 0.00220739624836604
+2.40699999999985 0.00220209053595337
+2.40799999999985 0.00219679537959012
+2.40899999999985 0.00219151076447075
+2.40999999999985 0.00218623667579373
+2.41099999999985 0.00218097309876162
+2.41199999999985 0.00217572001858109
+2.41299999999985 0.00217047742046297
+2.41399999999985 0.00216524528962233
+2.41499999999985 0.0021600236112785
+2.41599999999985 0.00215481237065513
+2.41699999999985 0.00214961155298024
+2.41799999999985 0.00214442114348624
+2.41899999999985 0.00213924112741005
+2.41999999999985 0.00213407148999306
+2.42099999999985 0.00212891221648124
+2.42199999999985 0.00212376329212516
+2.42299999999985 0.00211862470218004
+2.42399999999985 0.00211349643190583
+2.42499999999985 0.00210837846656719
+2.42599999999985 0.00210327079143361
+2.42699999999985 0.00209817339177941
+2.42799999999985 0.0020930862528838
+2.42899999999985 0.00208800936003095
+2.42999999999985 0.00208294269850999
+2.43099999999985 0.0020778862536151
+2.43199999999985 0.00207284001064552
+2.43299999999985 0.00206780395490564
+2.43399999999985 0.002062778071705
+2.43499999999985 0.00205776234635837
+2.43599999999985 0.00205275676418579
+2.43699999999985 0.0020477613105126
+2.43799999999985 0.00204277597066949
+2.43899999999985 0.00203780072999255
+2.43999999999985 0.00203283557382335
+2.44099999999985 0.0020278804875089
+2.44199999999985 0.00202293545640178
+2.44299999999985 0.00201800046586015
+2.44399999999985 0.00201307550124779
+2.44499999999985 0.00200816054793416
+2.44599999999985 0.00200325559129441
+2.44699999999985 0.00199836061670949
+2.44799999999985 0.00199347560956612
+2.44899999999985 0.00198860055525689
+2.44999999999985 0.00198373543918029
+2.45099999999985 0.00197888024674071
+2.45199999999984 0.00197403496334856
+2.45299999999984 0.00196919957442027
+2.45399999999984 0.0019643740653783
+2.45499999999984 0.00195955842165128
+2.45599999999984 0.00195475262867395
+2.45699999999984 0.00194995667188726
+2.45799999999984 0.0019451705367384
+2.45899999999984 0.00194039420868086
+2.45999999999984 0.00193562767317444
+2.46099999999984 0.0019308709156853
+2.46199999999984 0.00192612392168604
+2.46299999999984 0.00192138667665568
+2.46399999999984 0.00191665916607976
+2.46499999999984 0.00191194137545036
+2.46599999999984 0.00190723329026611
+2.46699999999984 0.0019025348960323
+2.46799999999984 0.00189784617826085
+2.46899999999984 0.00189316712247041
+2.46999999999984 0.00188849771418635
+2.47099999999984 0.00188383793894085
+2.47199999999984 0.00187918778227291
+2.47299999999984 0.0018745472297284
+2.47399999999984 0.00186991626686009
+2.47499999999984 0.00186529487922772
+2.47599999999984 0.00186068305239799
+2.47699999999984 0.00185608077194467
+2.47799999999984 0.00185148802344857
+2.47899999999984 0.00184690479249763
+2.47999999999984 0.00184233106468693
+2.48099999999984 0.00183776682561874
+2.48199999999984 0.00183321206090259
+2.48299999999984 0.00182866675615523
+2.48399999999984 0.00182413089700077
+2.48499999999984 0.00181960446907064
+2.48599999999984 0.00181508745800367
+2.48699999999984 0.00181057984944611
+2.48799999999984 0.00180608162905168
+2.48899999999984 0.00180159278248161
+2.48999999999984 0.00179711329540468
+2.49099999999984 0.00179264315349722
+2.49199999999984 0.00178818234244322
+2.49299999999984 0.00178373084793431
+2.49399999999984 0.00177928865566982
+2.49499999999984 0.00177485575135681
+2.49599999999984 0.00177043212071013
+2.49699999999984 0.00176601774945242
+2.49799999999984 0.00176161262331417
+2.49899999999984 0.00175721672803379
+2.49999999999984 0.00175283004935756
+2.50099999999984 0.00174845257303975
+2.50199999999984 0.00174408428484264
+2.50299999999984 0.00173972517053651
+2.50399999999984 0.00173537521589974
+2.50499999999984 0.0017310344067188
+2.50599999999984 0.00172670272878831
+2.50699999999984 0.00172238016791108
+2.50799999999984 0.00171806670989812
+2.50899999999984 0.0017137623405687
+2.50999999999984 0.00170946704575039
+2.51099999999984 0.00170518081127906
+2.51199999999984 0.00170090362299896
+2.51299999999984 0.00169663546676273
+2.51399999999984 0.00169237632843144
+2.51499999999984 0.00168812619387464
+2.51599999999984 0.00168388504897035
+2.51699999999984 0.00167965287960517
+2.51799999999984 0.00167542967167424
+2.51899999999984 0.00167121541108131
+2.51999999999984 0.00166701008373879
+2.52099999999984 0.00166281367556774
+2.52199999999984 0.00165862617249796
+2.52299999999984 0.00165444756046797
+2.52399999999984 0.00165027782542508
+2.52499999999984 0.0016461169533254
+2.52599999999984 0.00164196493013392
+2.52699999999984 0.00163782174182447
+2.52799999999984 0.00163368737437982
+2.52899999999984 0.00162956181379167
+2.52999999999984 0.00162544504606072
+2.53099999999984 0.00162133705719668
+2.53199999999984 0.00161723783321829
+2.53299999999984 0.00161314736015339
+2.53399999999984 0.00160906562403893
+2.53499999999984 0.00160499261092099
+2.53599999999984 0.00160092830685485
+2.53699999999984 0.00159687269790499
+2.53799999999984 0.00159282577014513
+2.53899999999984 0.00158878750965828
+2.53999999999984 0.00158475790253674
+2.54099999999984 0.00158073693488217
+2.54199999999984 0.00157672459280558
+2.54299999999983 0.00157272086242739
+2.54399999999983 0.00156872572987747
+2.54499999999983 0.00156473918129513
+2.54599999999983 0.00156076120282921
+2.54699999999983 0.00155679178063804
+2.54799999999983 0.00155283090088954
+2.54899999999983 0.00154887854976121
+2.54999999999983 0.00154493471344017
+2.55099999999983 0.0015409993781232
+2.55199999999983 0.00153707253001676
+2.55299999999983 0.00153315415533701
+2.55399999999983 0.00152924424030987
+2.55499999999983 0.00152534277117104
+2.55599999999983 0.00152144973416599
+2.55699999999983 0.00151756511555006
+2.55799999999983 0.00151368890158845
+2.55899999999983 0.00150982107855622
+2.55999999999983 0.00150596163273839
+2.56099999999983 0.00150211055042991
+2.56199999999983 0.00149826781793573
+2.56299999999983 0.0014944334215708
+2.56399999999983 0.0014906073476601
+2.56499999999983 0.0014867895825387
+2.56599999999983 0.00148298011255175
+2.56699999999983 0.00147917892405454
+2.56799999999983 0.0014753860034125
+2.56899999999983 0.00147160133700125
+2.56999999999983 0.00146782491120664
+2.57099999999983 0.00146405671242472
+2.57199999999983 0.00146029672706185
+2.57299999999983 0.00145654494153465
+2.57399999999983 0.00145280134227009
+2.57499999999983 0.00144906591570547
+2.57599999999983 0.0014453386482885
+2.57699999999983 0.00144161952647726
+2.57799999999983 0.00143790853674029
+2.57899999999983 0.00143420566555657
+2.57999999999983 0.00143051089941559
+2.58099999999983 0.00142682422481734
+2.58199999999983 0.00142314562827236
+2.58299999999983 0.00141947509630175
+2.58399999999983 0.0014158126154372
+2.58499999999983 0.00141215817222105
+2.58599999999983 0.00140851175320625
+2.58699999999983 0.00140487334495646
+2.58799999999983 0.00140124293404602
+2.58899999999983 0.00139762050705999
+2.58999999999983 0.0013940060505942
+2.59099999999983 0.00139039955125524
+2.59199999999983 0.00138680099566053
+2.59299999999983 0.00138321037043829
+2.59399999999983 0.00137962766222761
+2.59499999999983 0.00137605285767846
+2.59599999999983 0.00137248594345171
+2.59699999999983 0.00136892690621915
+2.59799999999983 0.00136537573266355
+2.59899999999983 0.00136183240947864
+2.59999999999983 0.00135829692336917
+2.60099999999983 0.00135476926105089
+2.60199999999983 0.00135124940925063
+2.60299999999983 0.0013477373547063
+2.60399999999983 0.00134423308416689
+2.60499999999983 0.00134073658439252
+2.60599999999983 0.00133724784215449
+2.60699999999983 0.00133376684423523
+2.60799999999983 0.0013302935774284
+2.60899999999983 0.00132682802853886
+2.60999999999983 0.00132337018438273
+2.61099999999983 0.00131992003178739
+2.61199999999983 0.00131647755759151
+2.61299999999983 0.00131304274864509
+2.61399999999983 0.00130961559180943
+2.61499999999983 0.00130619607395723
+2.61599999999983 0.00130278418197256
+2.61699999999983 0.00129937990275088
+2.61799999999983 0.0012959832231991
+2.61899999999983 0.00129259413023557
+2.61999999999983 0.00128921261079012
+2.62099999999983 0.00128583865180406
+2.62199999999983 0.00128247224023023
+2.62299999999983 0.00127911336303301
+2.62399999999983 0.00127576200718833
+2.62499999999983 0.00127241815968372
+2.62599999999983 0.00126908180751831
+2.62699999999983 0.00126575293770283
+2.62799999999983 0.00126243153725969
+2.62899999999983 0.00125911759322296
+2.62999999999983 0.0012558110926384
+2.63099999999983 0.00125251202256346
+2.63199999999983 0.00124922037006736
+2.63299999999983 0.00124593612223104
+2.63399999999982 0.00124265926614723
+2.63499999999982 0.00123938978892045
+2.63599999999982 0.00123612767766704
+2.63699999999982 0.00123287291951516
+2.63799999999982 0.00122962550160484
+2.63899999999982 0.00122638541108797
+2.63999999999982 0.00122315263512836
+2.64099999999982 0.00121992716090172
+2.64199999999982 0.00121670897559569
+2.64299999999982 0.00121349806640987
+2.64399999999982 0.00121029442055584
+2.64499999999982 0.00120709802525716
+2.64599999999982 0.00120390886774943
+2.64699999999982 0.00120072693528025
+2.64799999999982 0.00119755221510929
+2.64899999999982 0.00119438469450829
+2.64999999999982 0.00119122436076108
+2.65099999999982 0.00118807120116359
+2.65199999999982 0.00118492520302389
+2.65299999999982 0.00118178635366218
+2.65399999999982 0.00117865464041084
+2.65499999999982 0.00117553005061443
+2.65599999999982 0.0011724125716297
+2.65699999999982 0.00116930219082563
+2.65799999999982 0.00116619889558343
+2.65899999999982 0.00116310267329658
+2.65999999999982 0.00116001351137081
+2.66099999999982 0.00115693139722415
+2.66199999999982 0.00115385631828695
+2.66299999999982 0.00115078826200187
+2.66399999999982 0.00114772721582392
+2.66499999999982 0.00114467316722048
+2.66599999999982 0.00114162610367128
+2.66699999999982 0.00113858601266848
+2.66799999999982 0.00113555288171663
+2.66899999999982 0.00113252669833271
+2.66999999999982 0.00112950745004615
+2.67099999999982 0.00112649512439884
+2.67199999999982 0.00112348970894515
+2.67299999999982 0.00112049119125195
+2.67399999999982 0.0011174995588986
+2.67499999999982 0.00111451479947702
+2.67599999999982 0.00111153690059164
+2.67699999999982 0.00110856584985948
+2.67799999999982 0.00110560163491012
+2.67899999999982 0.00110264424338573
+2.67999999999982 0.00109969366294109
+2.68099999999982 0.0010967498812436
+2.68199999999982 0.00109381288597332
+2.68299999999982 0.00109088266482292
+2.68399999999982 0.00108795920549778
+2.68499999999982 0.00108504249571594
+2.68599999999982 0.00108213252320815
+2.68699999999982 0.00107922927571787
+2.68799999999982 0.0010763327410013
+2.68899999999982 0.00107344290682736
+2.68999999999982 0.00107055976097774
+2.69099999999982 0.00106768329124692
+2.69199999999982 0.00106481348544213
+2.69299999999982 0.00106195033138345
+2.69399999999982 0.00105909381690373
+2.69499999999982 0.00105624392984868
+2.69599999999982 0.00105340065807684
+2.69699999999982 0.00105056398945961
+2.69799999999982 0.00104773391188126
+2.69899999999982 0.00104491041323897
+2.69999999999982 0.00104209348144277
+2.70099999999982 0.00103928310441565
+2.70199999999982 0.00103647927009351
+2.70299999999982 0.00103368196642517
+2.70399999999982 0.00103089118137244
+2.70499999999982 0.00102810690291006
+2.70599999999982 0.00102532911902577
+2.70699999999982 0.0010225578177203
+2.70799999999982 0.00101979298700738
+2.70899999999982 0.00101703461491376
+2.70999999999982 0.00101428268947921
+2.71099999999982 0.00101153719875656
+2.71199999999982 0.00100879813081169
+2.71299999999982 0.00100606547372354
+2.71399999999982 0.00100333921558412
+2.71499999999982 0.00100061934449857
+2.71599999999982 0.000997905848585089
+2.71699999999982 0.00099519871597502
+2.71799999999982 0.000992497934812825
+2.71899999999982 0.000989803493256104
+2.71999999999982 0.000987115379475609
+2.72099999999982 0.000984433581655257
+2.72199999999982 0.000981758087992135
+2.72299999999982 0.000979088886696519
+2.72399999999982 0.000976425965991878
+2.72499999999981 0.000973769314114891
+2.72599999999981 0.000971118919315456
+2.72699999999981 0.000968474769856699
+2.72799999999981 0.000965836854014989
+2.72899999999981 0.000963205160079944
+2.72999999999981 0.000960579676354445
+2.73099999999981 0.000957960391154647
+2.73199999999981 0.000955347292809987
+2.73299999999981 0.000952740369663195
+2.73399999999981 0.000950139610070305
+2.73499999999981 0.000947545002400668
+2.73599999999981 0.000944956535036954
+2.73699999999981 0.000942374196375172
+2.73799999999981 0.000939797974824673
+2.73899999999981 0.000937227858808161
+2.73999999999981 0.000934663836761707
+2.74099999999981 0.000932105897134752
+2.74199999999981 0.000929554028390122
+2.74299999999981 0.000927008219004034
+2.74399999999981 0.000924468457466108
+2.74499999999981 0.000921934732279374
+2.74599999999981 0.000919407031960283
+2.74699999999981 0.000916885345038714
+2.74799999999981 0.000914369660057988
+2.74899999999981 0.000911859965574867
+2.74999999999981 0.000909356250159575
+2.75099999999981 0.000906858502395797
+2.75199999999981 0.000904366710880694
+2.75299999999981 0.000901880864224906
+2.75399999999981 0.000899400951052566
+2.75499999999981 0.000896926960001304
+2.75599999999981 0.000894458879722257
+2.75699999999981 0.00089199669888008
+2.75799999999981 0.000889540406152947
+2.75899999999981 0.000887089990232566
+2.75999999999981 0.000884645439824184
+2.76099999999981 0.000882206743646594
+2.76199999999981 0.000879773890432144
+2.76299999999981 0.000877346868926746
+2.76399999999981 0.000874925667889879
+2.76499999999981 0.000872510276094601
+2.76599999999981 0.000870100682327555
+2.76699999999981 0.000867696875388977
+2.76799999999981 0.000865298844092699
+2.76899999999981 0.000862906577266162
+2.76999999999981 0.000860520063750421
+2.77099999999981 0.000858139292400148
+2.77199999999981 0.000855764252083645
+2.77299999999981 0.000853394931682848
+2.77399999999981 0.000851031320093333
+2.77499999999981 0.000848673406224321
+2.77599999999981 0.00084632117899869
+2.77699999999981 0.000843974627352977
+2.77799999999981 0.000841633740237386
+2.77899999999981 0.00083929850661579
+2.77999999999981 0.000836968915465748
+2.78099999999981 0.000834644955778497
+2.78199999999981 0.000832326616558968
+2.78299999999981 0.000830013886825789
+2.78399999999981 0.000827706755611291
+2.78499999999981 0.000825405211961511
+2.78599999999981 0.000823109244936203
+2.78699999999981 0.000820818843608839
+2.78799999999981 0.000818533997066615
+2.78899999999981 0.000816254694410461
+2.78999999999981 0.000813980924755039
+2.79099999999981 0.000811712677228754
+2.79199999999981 0.000809449940973758
+2.79299999999981 0.000807192705145951
+2.79399999999981 0.000804940958914992
+2.79499999999981 0.000802694691464302
+2.79599999999981 0.000800453891991064
+2.79699999999981 0.000798218549706236
+2.79799999999981 0.000795988653834549
+2.79899999999981 0.000793764193614513
+2.79999999999981 0.000791545158298425
+2.80099999999981 0.000789331537152369
+2.80199999999981 0.000787123319456223
+2.80299999999981 0.000784920494503662
+2.80399999999981 0.000782723051602163
+2.80499999999981 0.000780530980073007
+2.80599999999981 0.000778344269251286
+2.80699999999981 0.000776162908485907
+2.80799999999981 0.000773986887139592
+2.80899999999981 0.000771816194588884
+2.80999999999981 0.000769650820224153
+2.81099999999981 0.000767490753449596
+2.81199999999981 0.000765335983683242
+2.81299999999981 0.000763186500356957
+2.81399999999981 0.000761042292916443
+2.8149999999998 0.000758903350821246
+2.8159999999998 0.000756769663544758
+2.8169999999998 0.000754641220574218
+2.8179999999998 0.000752518011410716
+2.8189999999998 0.000750400025569199
+2.8199999999998 0.000748287252578469
+2.8209999999998 0.000746179681981189
+2.8219999999998 0.000744077303333884
+2.8229999999998 0.000741980106206948
+2.8239999999998 0.000739888080184639
+2.8249999999998 0.000737801214865088
+2.8259999999998 0.000735719499860299
+2.8269999999998 0.000733642924796151
+2.8279999999998 0.000731571479312401
+2.8289999999998 0.000729505153062687
+2.8299999999998 0.000727443935714527
+2.8309999999998 0.000725387816949325
+2.8319999999998 0.000723336786462372
+2.8329999999998 0.000721290833962844
+2.8339999999998 0.00071924994917381
+2.8349999999998 0.000717214121832229
+2.8359999999998 0.000715183341688955
+2.8369999999998 0.000713157598508736
+2.8379999999998 0.000711136882070216
+2.8389999999998 0.000709121182165937
+2.8399999999998 0.000707110488602342
+2.8409999999998 0.000705104791199774
+2.8419999999998 0.000703104079792478
+2.8429999999998 0.000701108344228601
+2.8439999999998 0.000699117574370196
+2.8449999999998 0.00069713176009322
+2.8459999999998 0.000695150891287539
+2.8469999999998 0.000693174957856921
+2.8479999999998 0.000691203949719047
+2.8489999999998 0.000689237856805503
+2.8499999999998 0.000687276669061787
+2.8509999999998 0.000685320376447305
+2.8519999999998 0.000683368968935376
+2.8529999999998 0.000681422436513227
+2.8539999999998 0.000679480769181997
+2.8549999999998 0.000677543956956739
+2.8559999999998 0.000675611989866415
+2.8569999999998 0.000673684857953899
+2.8579999999998 0.000671762551275981
+2.8589999999998 0.000669845059903359
+2.8599999999998 0.000667932373920644
+2.8609999999998 0.00066602448342636
+2.8619999999998 0.000664121378532943
+2.8629999999998 0.000662223049366739
+2.8639999999998 0.000660329486068007
+2.8649999999998 0.000658440678790917
+2.8659999999998 0.000656556617703547
+2.8669999999998 0.000654677292987889
+2.8679999999998 0.00065280269483984
+2.8689999999998 0.000650932813469209
+2.8699999999998 0.000649067639099711
+2.8709999999998 0.00064720716196897
+2.8719999999998 0.000645351372328514
+2.8729999999998 0.000643500260443778
+2.8739999999998 0.000641653816594101
+2.8749999999998 0.000639812031072727
+2.8759999999998 0.000637974894186799
+2.8769999999998 0.000636142396257363
+2.8779999999998 0.000634314527619366
+2.8789999999998 0.000632491278621651
+2.8799999999998 0.00063067263962696
+2.8809999999998 0.000628858601011929
+2.8819999999998 0.000627049153167089
+2.8829999999998 0.000625244286496864
+2.8839999999998 0.000623443991419569
+2.8849999999998 0.000621648258367406
+2.8859999999998 0.000619857077786467
+2.8869999999998 0.000618070440136729
+2.8879999999998 0.000616288335892052
+2.8889999999998 0.000614510755540178
+2.8899999999998 0.000612737689582729
+2.8909999999998 0.000610969128535203
+2.8919999999998 0.000609205062926976
+2.8929999999998 0.000607445483301296
+2.8939999999998 0.00060569038021528
+2.8949999999998 0.000603939744239917
+2.8959999999998 0.00060219356596006
+2.8969999999998 0.000600451835974427
+2.8979999999998 0.000598714544895594
+2.8989999999998 0.000596981683350001
+2.8999999999998 0.000595253241977938
+2.9009999999998 0.000593529211433553
+2.9019999999998 0.000591809582384842
+2.9029999999998 0.000590094345513648
+2.9039999999998 0.00058838349151566
+2.9049999999998 0.000586677011100409
+2.90599999999979 0.000584974894991263
+2.90699999999979 0.000583277133925427
+2.90799999999979 0.000581583718653939
+2.90899999999979 0.000579894639941663
+2.90999999999979 0.000578209888567293
+2.91099999999979 0.000576529455323344
+2.91199999999979 0.000574853331016149
+2.91299999999979 0.000573181506465859
+2.91399999999979 0.000571513972506436
+2.91499999999979 0.00056985071998565
+2.91599999999979 0.000568191739765079
+2.91699999999979 0.0005665370227201
+2.91799999999979 0.000564886559739888
+2.91899999999979 0.000563240341727414
+2.91999999999979 0.000561598359599435
+2.92099999999979 0.000559960604286499
+2.92199999999979 0.000558327066732933
+2.92299999999979 0.000556697737896844
+2.92399999999979 0.000555072608750111
+2.92499999999979 0.000553451670278385
+2.92599999999979 0.000551834913481082
+2.92699999999979 0.00055022232937138
+2.92799999999979 0.000548613908976214
+2.92899999999979 0.000547009643336271
+2.92999999999979 0.000545409523505987
+2.93099999999979 0.000543813540553543
+2.93199999999979 0.000542221685560858
+2.93299999999979 0.000540633949623588
+2.93399999999979 0.000539050323851117
+2.93499999999979 0.000537470799366554
+2.93599999999979 0.000535895367306732
+2.93699999999979 0.000534324018822197
+2.93799999999979 0.000532756745077208
+2.93899999999979 0.00053119353724973
+2.93999999999979 0.000529634386531427
+2.94099999999979 0.000528079284127662
+2.94199999999979 0.000526528221257488
+2.94299999999979 0.000524981189153644
+2.94399999999979 0.000523438179062549
+2.94499999999979 0.000521899182244301
+2.94599999999979 0.000520364189972664
+2.94699999999979 0.00051883319353507
+2.94799999999979 0.000517306184232609
+2.94899999999979 0.000515783153380025
+2.94999999999979 0.000514264092305712
+2.95099999999979 0.000512748992351707
+2.95199999999979 0.000511237844873683
+2.95299999999979 0.000509730641240947
+2.95399999999979 0.000508227372836429
+2.95499999999979 0.000506728031056683
+2.95599999999979 0.000505232607311876
+2.95699999999979 0.000503741093025782
+2.95799999999979 0.000502253479635781
+2.95899999999979 0.000500769758592848
+2.95999999999979 0.000499289921361549
+2.96099999999979 0.000497813959420036
+2.96199999999979 0.000496341864260037
+2.96299999999979 0.000494873627386855
+2.96399999999979 0.00049340924031936
+2.96499999999979 0.000491948694589978
+2.96599999999979 0.000490491981744694
+2.96699999999979 0.000489039093343036
+2.96799999999979 0.000487590020958077
+2.96899999999979 0.00048614475617642
+2.96999999999979 0.0004847032905982
+2.97099999999979 0.000483265615837072
+2.97199999999979 0.000481831723520205
+2.97299999999979 0.000480401605288278
+2.97399999999979 0.000478975252795471
+2.97499999999979 0.000477552657709458
+2.97599999999979 0.000476133811711402
+2.97699999999979 0.000474718706495947
+2.97799999999979 0.00047330733377121
+2.97899999999979 0.000471899685258778
+2.97999999999979 0.000470495752693697
+2.98099999999979 0.000469095527824465
+2.98199999999979 0.00046769900241303
+2.98299999999979 0.000466306168234775
+2.98399999999979 0.000464917017078519
+2.98499999999979 0.000463531540746502
+2.98599999999979 0.000462149731054385
+2.98699999999979 0.000460771579831237
+2.98799999999979 0.000459397078919531
+2.98899999999979 0.000458026220175135
+2.98999999999979 0.000456658995467307
+2.99099999999979 0.000455295396678683
+2.99199999999979 0.000453935415705274
+2.99299999999979 0.000452579044456456
+2.99399999999979 0.000451226274854962
+2.99499999999979 0.000449877098836877
+2.99599999999979 0.000448531508351628
+2.99699999999978 0.000447189495361977
+2.99799999999978 0.000445851051844012
+2.99899999999978 0.000444516169787142
+2.99999999999978 0.000443184841194087
+3.00099999999978 0.000441857058080869
+3.00199999999978 0.000440532812476807
+3.00299999999978 0.000439212096424508
+3.00399999999978 0.000437894901979857
+3.00499999999978 0.000436581221212011
+3.00599999999978 0.00043527104620339
+3.00699999999978 0.00043396436904967
+3.00799999999978 0.000432661181859773
+3.00899999999978 0.000431361476755861
+3.00999999999978 0.000430065245873325
+3.01099999999978 0.000428772481360778
+3.01199999999978 0.000427483175380048
+3.01299999999978 0.000426197320106167
+3.01399999999978 0.000424914907727364
+3.01499999999978 0.000423635930445056
+3.01599999999978 0.000422360380473842
+3.01699999999978 0.000421088250041489
+3.01799999999978 0.000419819531388929
+3.01899999999978 0.000418554216770246
+3.01999999999978 0.00041729229845267
+3.02099999999978 0.000416033768716569
+3.02199999999978 0.000414778619855437
+3.02299999999978 0.000413526844175887
+3.02399999999978 0.000412278433997642
+3.02499999999978 0.000411033381653527
+3.02599999999978 0.000409791679489459
+3.02699999999978 0.000408553319864437
+3.02799999999978 0.000407318295150536
+3.02899999999978 0.000406086597732896
+3.02999999999978 0.000404858220009711
+3.03099999999978 0.000403633154392225
+3.03199999999978 0.000402411393304718
+3.03299999999978 0.000401192929184499
+3.03399999999978 0.000399977754481897
+3.03499999999978 0.000398765861660251
+3.03599999999978 0.000397557243195899
+3.03699999999978 0.000396351891578173
+3.03799999999978 0.000395149799309388
+3.03899999999978 0.000393950958904827
+3.03999999999978 0.00039275536289274
+3.04099999999978 0.000391563003814332
+3.04199999999978 0.000390373874223748
+3.04299999999978 0.00038918796668807
+3.04399999999978 0.000388005273787307
+3.04499999999978 0.000386825788114379
+3.04599999999978 0.000385649502275116
+3.04699999999978 0.000384476408888243
+3.04799999999978 0.000383306500585369
+3.04899999999978 0.000382139770010983
+3.04999999999978 0.000380976209822438
+3.05099999999978 0.000379815812689945
+3.05199999999978 0.000378658571296563
+3.05299999999978 0.000377504478338188
+3.05399999999978 0.000376353526523542
+3.05499999999978 0.000375205708574165
+3.05599999999978 0.000374061017224403
+3.05699999999978 0.000372919445221403
+3.05799999999978 0.000371780985325094
+3.05899999999978 0.000370645630308186
+3.05999999999978 0.000369513372956155
+3.06099999999978 0.000368384206067231
+3.06199999999978 0.000367258122452394
+3.06299999999978 0.00036613511493536
+3.06399999999978 0.000365015176352568
+3.06499999999978 0.000363898299553175
+3.06599999999978 0.000362784477399044
+3.06699999999978 0.000361673702764732
+3.06799999999978 0.000360565968537479
+3.06899999999978 0.000359461267617203
+3.06999999999978 0.000358359592916482
+3.07099999999978 0.000357260937360548
+3.07199999999978 0.000356165293887278
+3.07299999999978 0.000355072655447178
+3.07399999999978 0.000353983015003379
+3.07499999999978 0.000352896365531619
+3.07599999999978 0.000351812700020239
+3.07699999999978 0.000350732011470168
+3.07799999999978 0.000349654292894917
+3.07899999999978 0.000348579537320561
+3.07999999999978 0.000347507737785734
+3.08099999999978 0.000346438887341618
+3.08199999999978 0.000345372979051929
+3.08299999999978 0.000344310005992909
+3.08399999999978 0.000343249961253313
+3.08499999999978 0.000342192837934401
+3.08599999999978 0.000341138629149923
+3.08699999999978 0.000340087328026111
+3.08799999999977 0.000339038927701668
+3.08899999999977 0.000337993421327755
+3.08999999999977 0.000336950802067983
+3.09099999999977 0.000335911063098396
+3.09199999999977 0.00033487419760747
+3.09299999999977 0.000333840198796089
+3.09399999999977 0.000332809059877547
+3.09499999999977 0.000331780774077526
+3.09599999999977 0.000330755334634092
+3.09699999999977 0.000329732734797678
+3.09799999999977 0.000328712967831078
+3.09899999999977 0.000327696027009434
+3.09999999999977 0.000326681905620221
+3.10099999999977 0.000325670596963242
+3.10199999999977 0.000324662094350612
+3.10299999999977 0.000323656391106746
+3.10399999999977 0.000322653480568353
+3.10499999999977 0.000321653356084419
+3.10599999999977 0.000320656011016198
+3.10699999999977 0.000319661438737198
+3.10799999999977 0.000318669632633176
+3.10899999999977 0.000317680586102118
+3.10999999999977 0.000316694292554232
+3.11099999999977 0.000315710745411937
+3.11199999999977 0.00031472993810985
+3.11299999999977 0.000313751864094773
+3.11399999999977 0.000312776516825683
+3.11499999999977 0.000311803889773722
+3.11599999999977 0.000310833976422181
+3.11699999999977 0.000309866770266492
+3.11799999999977 0.000308902264814213
+3.11899999999977 0.000307940453585021
+3.11999999999977 0.000306981330110693
+3.12099999999977 0.000306024887935102
+3.12199999999977 0.000305071120614199
+3.12299999999977 0.000304120021716004
+3.12399999999977 0.000303171584820595
+3.12499999999977 0.000302225803520092
+3.12599999999977 0.00030128267141865
+3.12699999999977 0.000300342182132443
+3.12799999999977 0.000299404329289656
+3.12899999999977 0.000298469106530466
+3.12999999999977 0.000297536507507039
+3.13099999999977 0.000296606525883512
+3.13199999999977 0.000295679155335982
+3.13299999999977 0.000294754389552493
+3.13399999999977 0.000293832222233028
+3.13499999999977 0.000292912647089491
+3.13599999999977 0.0002919956578457
+3.13699999999977 0.000291081248237371
+3.13799999999977 0.000290169412012107
+3.13899999999977 0.000289260142929387
+3.13999999999977 0.000288353434760553
+3.14099999999977 0.000287449281288796
+3.14199999999977 0.000286547676309145
+3.14299999999977 0.000285648613628458
+3.14399999999977 0.000284752087065401
+3.14499999999977 0.000283858090450446
+3.14599999999977 0.000282966617625851
+3.14699999999977 0.000282077662445651
+3.14799999999977 0.000281191218775644
+3.14899999999977 0.000280307280493381
+3.14999999999977 0.000279425841488149
+3.15099999999977 0.000278546895660964
+3.15199999999977 0.000277670436924554
+3.15299999999977 0.000276796459203351
+3.15399999999977 0.000275924956433471
+3.15499999999977 0.000275055922562712
+3.15599999999977 0.00027418935155053
+3.15699999999977 0.000273325237368035
+3.15799999999977 0.000272463573997976
+3.15899999999977 0.000271604355434725
+3.15999999999977 0.00027074757568427
+3.16099999999977 0.000269893228764195
+3.16199999999977 0.000269041308703677
+3.16299999999977 0.000268191809543465
+3.16399999999977 0.000267344725335869
+3.16499999999977 0.00026650005014475
+3.16599999999977 0.000265657778045507
+3.16699999999977 0.000264817903125059
+3.16799999999977 0.000263980419481841
+3.16899999999977 0.000263145321225781
+3.16999999999977 0.000262312602478297
+3.17099999999977 0.000261482257372276
+3.17199999999977 0.000260654280052067
+3.17299999999977 0.000259828664673464
+3.17399999999977 0.000259005405403697
+3.17499999999977 0.000258184496421414
+3.17599999999977 0.000257365931916674
+3.17699999999977 0.000256549706090929
+3.17799999999977 0.000255735813157013
+3.17899999999976 0.000254924247339131
+3.17999999999976 0.000254115002872842
+3.18099999999976 0.00025330807400505
+3.18199999999976 0.000252503454993987
+3.18299999999976 0.000251701140109203
+3.18399999999976 0.000250901123631553
+3.18499999999976 0.00025010339985318
+3.18599999999976 0.000249307963077508
+3.18699999999976 0.000248514807619222
+3.18799999999976 0.000247723927804263
+3.18899999999976 0.000246935317969807
+3.18999999999976 0.000246148972464256
+3.19099999999976 0.000245364885647224
+3.19199999999976 0.000244583051889525
+3.19299999999976 0.000243803465573157
+3.19399999999976 0.000243026121091293
+3.19499999999976 0.000242251012848262
+3.19599999999976 0.000241478135259541
+3.19699999999976 0.000240707482751741
+3.19799999999976 0.000239939049762589
+3.19899999999976 0.000239172830740921
+3.19999999999976 0.000238408820146665
+3.20099999999976 0.00023764701245083
+3.20199999999976 0.00023688740213549
+3.20299999999976 0.000236129983693771
+3.20399999999976 0.000235374751629842
+3.20499999999976 0.000234621700458895
+3.20599999999976 0.000233870824707137
+3.20699999999976 0.000233122118911774
+3.20799999999976 0.000232375577620998
+3.20899999999976 0.000231631195393974
+3.20999999999976 0.000230888966800826
+3.21099999999976 0.000230148886422626
+3.21199999999976 0.000229410948851376
+3.21299999999976 0.000228675148689998
+3.21399999999976 0.00022794148055232
+3.21499999999976 0.000227209939063062
+3.21599999999976 0.000226480518857822
+3.21699999999976 0.000225753214583066
+3.21799999999976 0.000225028020896108
+3.21899999999976 0.000224304932465102
+3.21999999999976 0.000223583943969026
+3.22099999999976 0.000222865050097672
+3.22199999999976 0.000222148245551625
+3.22299999999976 0.000221433525042257
+3.22399999999976 0.00022072088329171
+3.22499999999976 0.000220010315032884
+3.22599999999976 0.000219301815009419
+3.22699999999976 0.000218595377975687
+3.22799999999976 0.000217890998696778
+3.22899999999976 0.00021718867194848
+3.22999999999976 0.000216488392517274
+3.23099999999976 0.000215790155200315
+3.23199999999976 0.000215093954805418
+3.23299999999976 0.000214399786151048
+3.23399999999976 0.000213707644066303
+3.23499999999976 0.000213017523390902
+3.23599999999976 0.000212329418975172
+3.23699999999976 0.000211643325680033
+3.23799999999976 0.000210959238376982
+3.23899999999976 0.000210277151948085
+3.23999999999976 0.000209597061285959
+3.24099999999976 0.000208918961293759
+3.24199999999976 0.000208242846885166
+3.24299999999976 0.00020756871298437
+3.24399999999976 0.00020689655452606
+3.24499999999976 0.000206226366455408
+3.24599999999976 0.000205558143728056
+3.24699999999976 0.0002048918813101
+3.24799999999976 0.00020422757417808
+3.24899999999976 0.000203565217318965
+3.24999999999976 0.000202904805730137
+3.25099999999976 0.000202246334419379
+3.25199999999976 0.000201589798404862
+3.25299999999976 0.00020093519271513
+3.25399999999976 0.000200282512389084
+3.25499999999976 0.000199631752475974
+3.25599999999976 0.00019898290803538
+3.25699999999976 0.000198335974137199
+3.25799999999976 0.000197690945861633
+3.25899999999976 0.000197047818299176
+3.25999999999976 0.000196406586550594
+3.26099999999976 0.000195767245726919
+3.26199999999976 0.000195129790949429
+3.26299999999976 0.000194494217349641
+3.26399999999976 0.000193860520069286
+3.26499999999976 0.000193228694260309
+3.26599999999976 0.000192598735084842
+3.26699999999976 0.000191970637715201
+3.26799999999976 0.000191344397333864
+3.26899999999975 0.000190720009133461
+3.26999999999975 0.00019009746831676
+3.27099999999975 0.000189476770096653
+3.27199999999975 0.000188857909696139
+3.27299999999975 0.000188240882348315
+3.27399999999975 0.000187625683296358
+3.27499999999975 0.000187012307793515
+3.27599999999975 0.000186400751103085
+3.27699999999975 0.000185791008498407
+3.27799999999975 0.000185183075262845
+3.27899999999975 0.000184576946689776
+3.27999999999975 0.000183972618082576
+3.28099999999975 0.000183370084754604
+3.28199999999975 0.000182769342029187
+3.28299999999975 0.000182170385239611
+3.28399999999975 0.000181573209729102
+3.28499999999975 0.000180977810850815
+3.28599999999975 0.000180384183967819
+3.28699999999975 0.000179792324453084
+3.28799999999975 0.000179202227689463
+3.28899999999975 0.000178613889069684
+3.28999999999975 0.000178027303996333
+3.29099999999975 0.000177442467881838
+3.29199999999975 0.000176859376148458
+3.29299999999975 0.000176278024228269
+3.29399999999975 0.000175698407563149
+3.29499999999975 0.000175120521604762
+3.29599999999975 0.000174544361814548
+3.29699999999975 0.000173969923663706
+3.29799999999975 0.000173397202633181
+3.29899999999975 0.00017282619421365
+3.29999999999975 0.000172256893905509
+3.30099999999975 0.000171689297218856
+3.30199999999975 0.00017112339967348
+3.30299999999975 0.000170559196798846
+3.30399999999975 0.000169996684134078
+3.30499999999975 0.000169435857227952
+3.30599999999975 0.000168876711638875
+3.30699999999975 0.000168319242934874
+3.30799999999975 0.000167763446693581
+3.30899999999975 0.000167209318502221
+3.30999999999975 0.000166656853957596
+3.31099999999975 0.00016610604866607
+3.31199999999975 0.000165556898243557
+3.31299999999975 0.000165009398315509
+3.31399999999975 0.000164463544516895
+3.31499999999975 0.000163919332492194
+3.31599999999975 0.000163376757895376
+3.31699999999975 0.000162835816389894
+3.31799999999975 0.000162296503648661
+3.31899999999975 0.000161758815354044
+3.31999999999975 0.000161222747197847
+3.32099999999975 0.000160688294881295
+3.32199999999975 0.000160155454115024
+3.32299999999975 0.000159624220619062
+3.32399999999975 0.000159094590122822
+3.32499999999975 0.000158566558365078
+3.32599999999975 0.000158040121093961
+3.32699999999975 0.000157515274066939
+3.32799999999975 0.000156992013050803
+3.32899999999975 0.000156470333821657
+3.32999999999975 0.0001559502321649
+3.33099999999975 0.000155431703875212
+3.33199999999975 0.000154914744756543
+3.33299999999975 0.000154399350622097
+3.33399999999975 0.000153885517294316
+3.33499999999975 0.000153373240604871
+3.33599999999975 0.000152862516394643
+3.33699999999975 0.000152353340513711
+3.33799999999975 0.000151845708821338
+3.33899999999975 0.000151339617185958
+3.33999999999975 0.000150835061485158
+3.34099999999975 0.000150332037605669
+3.34199999999975 0.00014983054144335
+3.34299999999975 0.00014933056890317
+3.34399999999975 0.000148832115899202
+3.34499999999975 0.000148335178354602
+3.34599999999975 0.000147839752201596
+3.34699999999975 0.000147345833381472
+3.34799999999975 0.000146853417844556
+3.34899999999975 0.000146362501550208
+3.34999999999975 0.000145873080466799
+3.35099999999975 0.000145385150571704
+3.35199999999975 0.000144898707851284
+3.35299999999975 0.000144413748300875
+3.35399999999975 0.000143930267924768
+3.35499999999975 0.000143448262736204
+3.35599999999975 0.000142967728757352
+3.35699999999975 0.000142488662019299
+3.35799999999975 0.000142011058562034
+3.35899999999975 0.000141534914434436
+3.35999999999974 0.000141060225694259
+3.36099999999974 0.000140586988408118
+3.36199999999974 0.000140115198651474
+3.36299999999974 0.000139644852508621
+3.36399999999974 0.000139175946072674
+3.36499999999974 0.00013870847544555
+3.36599999999974 0.000138242436737959
+3.36699999999974 0.000137777826069387
+3.36799999999974 0.000137314639568083
+3.36899999999974 0.000136852873371046
+3.36999999999974 0.000136392523624008
+3.37099999999974 0.000135933586481424
+3.37199999999974 0.000135476058106454
+3.37299999999974 0.000135019934670953
+3.37399999999974 0.000134565212355453
+3.37499999999974 0.000134111887349154
+3.37599999999974 0.000133659955849904
+3.37699999999974 0.000133209414064189
+3.37799999999974 0.00013276025820712
+3.37899999999974 0.000132312484502415
+3.37999999999974 0.000131866089182389
+3.38099999999974 0.000131421068487936
+3.38199999999974 0.000130977418668521
+3.38299999999974 0.000130535135982159
+3.38399999999974 0.000130094216695406
+3.38499999999974 0.000129654657083345
+3.38599999999974 0.000129216453429567
+3.38699999999974 0.000128779602026165
+3.38799999999974 0.000128344099173713
+3.38899999999974 0.000127909941181256
+3.38999999999974 0.000127477124366295
+3.39099999999974 0.000127045645054773
+3.39199999999974 0.000126615499581061
+3.39299999999974 0.000126186684287945
+3.39399999999974 0.00012575919552661
+3.39499999999974 0.000125333029656631
+3.39599999999974 0.000124908183045951
+3.39699999999974 0.000124484652070876
+3.39799999999974 0.000124062433116054
+3.39899999999974 0.000123641522574467
+3.39999999999974 0.000123221916847411
+3.40099999999974 0.000122803612344487
+3.40199999999974 0.000122386605483587
+3.40299999999974 0.000121970892690877
+3.40399999999974 0.000121556470400785
+3.40499999999974 0.000121143335055988
+3.40599999999974 0.000120731483107395
+3.40699999999974 0.000120320911014139
+3.40799999999974 0.000119911615243557
+3.40899999999974 0.00011950359227118
+3.40999999999974 0.000119096838580718
+3.41099999999974 0.000118691350664044
+3.41199999999974 0.000118287125021187
+3.41299999999974 0.00011788415816031
+3.41399999999974 0.0001174824465977
+3.41499999999974 0.000117081986857757
+3.41599999999974 0.000116682775472975
+3.41699999999974 0.000116284808983931
+3.41799999999974 0.000115888083939271
+3.41899999999974 0.000115492596895697
+3.41999999999974 0.000115098344417951
+3.42099999999974 0.000114705323078805
+3.42199999999974 0.000114313529459042
+3.42299999999974 0.000113922960147448
+3.42399999999974 0.000113533611740793
+3.42499999999974 0.000113145480843822
+3.42599999999974 0.000112758564069239
+3.42699999999974 0.000112372858037693
+3.42799999999974 0.000111988359377763
+3.42899999999974 0.00011160506472595
+3.42999999999974 0.000111222970726657
+3.43099999999974 0.000110842074032177
+3.43199999999974 0.000110462371302683
+3.43299999999974 0.00011008385920621
+3.43399999999974 0.000109706534418642
+3.43499999999974 0.000109330393623701
+3.43599999999974 0.000108955433512931
+3.43699999999974 0.000108581650785685
+3.43799999999974 0.000108209042149111
+3.43899999999974 0.000107837604318141
+3.43999999999974 0.000107467334015471
+3.44099999999974 0.000107098227971556
+3.44199999999974 0.000106730282924591
+3.44299999999974 0.000106363495620498
+3.44399999999974 0.000105997862812912
+3.44499999999974 0.00010563338126317
+3.44599999999974 0.000105270047740296
+3.44699999999974 0.000104907859020987
+3.44799999999974 0.0001045468118896
+3.44899999999974 0.000104186903138138
+3.44999999999974 0.000103828129566236
+3.45099999999973 0.000103470487981151
+3.45199999999973 0.000103113975197744
+3.45299999999973 0.000102758588038468
+3.45399999999973 0.000102404323333356
+3.45499999999973 0.000102051177920007
+3.45599999999973 0.00010169914864357
+3.45699999999973 0.000101348232356734
+3.45799999999973 0.000100998425919713
+3.45899999999973 0.000100649726200232
+3.45999999999973 0.000100302130073516
+3.46099999999973 9.99556344222727e-05
+3.46199999999973 9.96102361366825e-05
+3.46299999999973 9.92659321143836e-05
+3.46399999999973 9.89227192604589e-05
+3.46499999999973 9.85805944874225e-05
+3.46599999999973 9.82395547152069e-05
+3.46699999999973 9.78995968711486e-05
+3.46799999999973 9.75607178899757e-05
+3.46899999999973 9.72229147137942e-05
+3.46999999999973 9.68861842920744e-05
+3.47099999999973 9.65505235816384e-05
+3.47199999999973 9.62159295466457e-05
+3.47299999999973 9.58823991585809e-05
+3.47399999999973 9.55499293962395e-05
+3.47499999999973 9.52185172457156e-05
+3.47599999999973 9.48881597003876e-05
+3.47699999999973 9.45588537609059e-05
+3.47799999999973 9.4230596435179e-05
+3.47899999999973 9.39033847383603e-05
+3.47999999999973 9.35772156928353e-05
+3.48099999999973 9.3252086328208e-05
+3.48199999999973 9.29279936812878e-05
+3.48299999999973 9.26049347960763e-05
+3.48399999999973 9.22829067237539e-05
+3.48499999999973 9.19619065226671e-05
+3.48599999999973 9.16419312583148e-05
+3.48699999999973 9.13229780033356e-05
+3.48799999999973 9.10050438374943e-05
+3.48899999999973 9.0688125847669e-05
+3.48999999999973 9.03722211278374e-05
+3.49099999999973 9.00573267790649e-05
+3.49199999999973 8.974343990949e-05
+3.49299999999973 8.94305576343125e-05
+3.49399999999973 8.91186770757792e-05
+3.49499999999973 8.8807795363172e-05
+3.49599999999973 8.84979096327941e-05
+3.49699999999973 8.81890170279569e-05
+3.49799999999973 8.78811146989676e-05
+3.49899999999973 8.75741998031153e-05
+3.49999999999973 8.72682695046587e-05
+3.50099999999973 8.69633209748125e-05
+3.50199999999973 8.6659351391735e-05
+3.50299999999973 8.63563579405148e-05
+3.50399999999973 8.60543378131574e-05
+3.50499999999973 8.57532882085731e-05
+3.50599999999973 8.54532063325632e-05
+3.50699999999973 8.51540893978077e-05
+3.50799999999973 8.48559346238518e-05
+3.50899999999973 8.45587392370936e-05
+3.50999999999973 8.42625004707705e-05
+3.51099999999973 8.39672155649468e-05
+3.51199999999973 8.36728817665006e-05
+3.51299999999973 8.33794963291109e-05
+3.51399999999973 8.30870565132448e-05
+3.51499999999973 8.27955595861446e-05
+3.51599999999973 8.2505002821815e-05
+3.51699999999973 8.22153835010101e-05
+3.51799999999973 8.19266989112208e-05
+3.51899999999973 8.16389463466618e-05
+3.51999999999973 8.13521231082589e-05
+3.52099999999973 8.10662265036362e-05
+3.52199999999973 8.07812538471032e-05
+3.52299999999973 8.04972024596423e-05
+3.52399999999973 8.02140696688955e-05
+3.52499999999973 7.99318528091524e-05
+3.52599999999973 7.96505492213368e-05
+3.52699999999973 7.93701562529946e-05
+3.52799999999973 7.90906712582801e-05
+3.52899999999973 7.88120915979447e-05
+3.52999999999973 7.85344146393228e-05
+3.53099999999973 7.82576377563203e-05
+3.53199999999973 7.79817583294009e-05
+3.53299999999973 7.77067737455743e-05
+3.53399999999973 7.74326813983832e-05
+3.53499999999973 7.71594786878905e-05
+3.53599999999973 7.68871630206669e-05
+3.53699999999973 7.66157318097783e-05
+3.53799999999973 7.63451824747733e-05
+3.53899999999973 7.60755124416702e-05
+3.53999999999973 7.58067191429448e-05
+3.54099999999973 7.5538800017518e-05
+3.54199999999972 7.52717525107427e-05
+3.54299999999972 7.50055740743916e-05
+3.54399999999972 7.4740262166645e-05
+3.54499999999972 7.44758142520774e-05
+3.54599999999972 7.42122278016459e-05
+3.54699999999972 7.39495002926775e-05
+3.54799999999972 7.36876292088561e-05
+3.54899999999972 7.34266120402108e-05
+3.54999999999972 7.31664462831028e-05
+3.55099999999972 7.29071294402134e-05
+3.55199999999972 7.26486590205314e-05
+3.55299999999972 7.23910325393408e-05
+3.55399999999972 7.21342475182084e-05
+3.55499999999972 7.1878301484971e-05
+3.55599999999972 7.16231919737238e-05
+3.55699999999972 7.13689165248072e-05
+3.55799999999972 7.11154726847953e-05
+3.55899999999972 7.08628580064828e-05
+3.55999999999972 7.06110700488733e-05
+3.56099999999972 7.03601063771664e-05
+3.56199999999972 7.01099645627459e-05
+3.56299999999972 6.98606421831674e-05
+3.56399999999972 6.96121368221457e-05
+3.56499999999972 6.93644460695432e-05
+3.56599999999972 6.9117567521357e-05
+3.56699999999972 6.88714987797069e-05
+3.56799999999972 6.86262374528233e-05
+3.56899999999972 6.83817811550351e-05
+3.56999999999972 6.81381275067569e-05
+3.57099999999972 6.78952741344776e-05
+3.57199999999972 6.76532186707478e-05
+3.57299999999972 6.74119587541677e-05
+3.57399999999972 6.71714920293748e-05
+3.57499999999972 6.69318161470324e-05
+3.57599999999972 6.66929287638167e-05
+3.57699999999972 6.64548275424052e-05
+3.57799999999972 6.62175101514643e-05
+3.57899999999972 6.59809742656375e-05
+3.57999999999972 6.57452175655334e-05
+3.58099999999972 6.55102377377131e-05
+3.58199999999972 6.52760324746789e-05
+3.58299999999972 6.50425994748619e-05
+3.58399999999972 6.48099364426097e-05
+3.58499999999972 6.45780410881752e-05
+3.58599999999972 6.43469111277037e-05
+3.58699999999972 6.41165442832218e-05
+3.58799999999972 6.38869382826247e-05
+3.58899999999972 6.36580908596649e-05
+3.58999999999972 6.34299997539396e-05
+3.59099999999972 6.32026627108795e-05
+3.59199999999972 6.29760774817365e-05
+3.59299999999972 6.27502418235715e-05
+3.59399999999972 6.25251534992436e-05
+3.59499999999972 6.2300810277397e-05
+3.59599999999972 6.20772099324497e-05
+3.59699999999972 6.18543502445821e-05
+3.59799999999972 6.16322289997242e-05
+3.59899999999972 6.14108439895449e-05
+3.59999999999972 6.11901930114392e-05
+3.60099999999972 6.09702738685172e-05
+3.60199999999972 6.07510843695919e-05
+3.60299999999972 6.05326223291675e-05
+3.60399999999972 6.03148855674281e-05
+3.60499999999972 6.0097871910225e-05
+3.60599999999972 5.98815791890662e-05
+3.60699999999972 5.96660052411038e-05
+3.60799999999972 5.94511479091229e-05
+3.60899999999972 5.92370050415294e-05
+3.60999999999972 5.90235744923387e-05
+3.61099999999972 5.88108541211643e-05
+3.61199999999972 5.85988417932054e-05
+3.61299999999972 5.83875353792362e-05
+3.61399999999972 5.81769327555935e-05
+3.61499999999972 5.79670318041657e-05
+3.61599999999972 5.7757830412381e-05
+3.61699999999972 5.75493264731958e-05
+3.61799999999972 5.73415178850834e-05
+3.61899999999972 5.71344025520219e-05
+3.61999999999972 5.69279783834837e-05
+3.62099999999972 5.67222432944229e-05
+3.62199999999972 5.65171952052645e-05
+3.62299999999972 5.63128320418929e-05
+3.62399999999972 5.61091517356399e-05
+3.62499999999972 5.59061522232741e-05
+3.62599999999972 5.57038314469887e-05
+3.62699999999972 5.55021873543907e-05
+3.62799999999972 5.53012178984889e-05
+3.62899999999972 5.51009210376832e-05
+3.62999999999972 5.49012947357526e-05
+3.63099999999972 5.47023369618443e-05
+3.63199999999972 5.4504045690462e-05
+3.63299999999971 5.4306418901455e-05
+3.63399999999971 5.41094545800064e-05
+3.63499999999971 5.39131507166222e-05
+3.63599999999971 5.37175053071199e-05
+3.63699999999971 5.3522516352617e-05
+3.63799999999971 5.33281818595203e-05
+3.63899999999971 5.31344998395139e-05
+3.63999999999971 5.29414683095486e-05
+3.64099999999971 5.27490852918305e-05
+3.64199999999971 5.25573488138098e-05
+3.64299999999971 5.23662569081695e-05
+3.64399999999971 5.21758076128144e-05
+3.64499999999971 5.19859989708599e-05
+3.64599999999971 5.17968290306207e-05
+3.64699999999971 5.16082958456e-05
+3.64799999999971 5.14203974744781e-05
+3.64899999999971 5.12331319811017e-05
+3.64999999999971 5.1046497434472e-05
+3.65099999999971 5.08604919087348e-05
+3.65199999999971 5.06751134831684e-05
+3.65299999999971 5.04903602421731e-05
+3.65399999999971 5.03062302752602e-05
+3.65499999999971 5.01227216770409e-05
+3.65599999999971 4.99398325472149e-05
+3.65699999999971 4.97575609905602e-05
+3.65799999999971 4.95759051169216e-05
+3.65899999999971 4.93948630412e-05
+3.65999999999971 4.92144328833412e-05
+3.66099999999971 4.90346127683253e-05
+3.66199999999971 4.88554008261555e-05
+3.66299999999971 4.86767951918475e-05
+3.66399999999971 4.84987940054183e-05
+3.66499999999971 4.83213954118758e-05
+3.66599999999971 4.81445975612074e-05
+3.66699999999971 4.79683986083696e-05
+3.66799999999971 4.77927967132771e-05
+3.66899999999971 4.76177900407919e-05
+3.66999999999971 4.74433767607124e-05
+3.67099999999971 4.7269555047763e-05
+3.67199999999971 4.7096323081583e-05
+3.67299999999971 4.69236790467161e-05
+3.67399999999971 4.67516211325995e-05
+3.67499999999971 4.65801475335533e-05
+3.67599999999971 4.64092564487697e-05
+3.67699999999971 4.62389460823024e-05
+3.67799999999971 4.60692146430561e-05
+3.67899999999971 4.59000603447754e-05
+3.67999999999971 4.57314814060345e-05
+3.68099999999971 4.55634760502268e-05
+3.68199999999971 4.53960425055537e-05
+3.68299999999971 4.52291790050143e-05
+3.68399999999971 4.5062883786395e-05
+3.68499999999971 4.48971550922589e-05
+3.68599999999971 4.47319911699348e-05
+3.68699999999971 4.45673902715072e-05
+3.68799999999971 4.44033506538057e-05
+3.68899999999971 4.42398705783942e-05
+3.68999999999971 4.40769483115606e-05
+3.69099999999971 4.39145821243066e-05
+3.69199999999971 4.37527702923367e-05
+3.69299999999971 4.35915110960482e-05
+3.69399999999971 4.34308028205205e-05
+3.69499999999971 4.32706437555049e-05
+3.69599999999971 4.31110321954142e-05
+3.69699999999971 4.29519664393119e-05
+3.69799999999971 4.27934447909025e-05
+3.69899999999971 4.26354655585207e-05
+3.69999999999971 4.24780270551211e-05
+3.70099999999971 4.23211275982682e-05
+3.70199999999971 4.21647655101256e-05
+3.70299999999971 4.2008939117446e-05
+3.70399999999971 4.18536467515611e-05
+3.70499999999971 4.1698886748371e-05
+3.70599999999971 4.15446574483339e-05
+3.70699999999971 4.13909571964564e-05
+3.70799999999971 4.12377843422828e-05
+3.70899999999971 4.1085137239885e-05
+3.70999999999971 4.09330142478525e-05
+3.71099999999971 4.07814137292818e-05
+3.71199999999971 4.06303340517669e-05
+3.71299999999971 4.04797735873886e-05
+3.71399999999971 4.03297307127047e-05
+3.71499999999971 4.01802038087397e-05
+3.71599999999971 4.00311912609747e-05
+3.71699999999971 3.98826914593375e-05
+3.71799999999971 3.97347027981925e-05
+3.71899999999971 3.95872236763306e-05
+3.71999999999971 3.94402524969589e-05
+3.72099999999971 3.92937876676912e-05
+3.72199999999971 3.91478276005378e-05
+3.7229999999997 3.90023707118952e-05
+3.7239999999997 3.88574154225365e-05
+3.7249999999997 3.87129601576015e-05
+3.7259999999997 3.85690033465863e-05
+3.7269999999997 3.84255434233339e-05
+3.7279999999997 3.82825788260239e-05
+3.7289999999997 3.81401079971628e-05
+3.7299999999997 3.79981293835741e-05
+3.7309999999997 3.78566414363884e-05
+3.7319999999997 3.77156426110336e-05
+3.7329999999997 3.75751313672251e-05
+3.7339999999997 3.74351061689556e-05
+3.7349999999997 3.72955654844859e-05
+3.7359999999997 3.71565077863348e-05
+3.7369999999997 3.70179315512692e-05
+3.7379999999997 3.68798352602946e-05
+3.7389999999997 3.67422173986452e-05
+3.7399999999997 3.66050764557742e-05
+3.7409999999997 3.64684109253441e-05
+3.7419999999997 3.63322193052171e-05
+3.7429999999997 3.61965000974453e-05
+3.7439999999997 3.60612518082609e-05
+3.7449999999997 3.59264729480669e-05
+3.7459999999997 3.57921620314271e-05
+3.7469999999997 3.56583175770568e-05
+3.7479999999997 3.5524938107813e-05
+3.7489999999997 3.53920221506848e-05
+3.7499999999997 3.52595682367839e-05
+3.7509999999997 3.51275749013351e-05
+3.7519999999997 3.49960406836665e-05
+3.7529999999997 3.48649641272003e-05
+3.7539999999997 3.47343437794431e-05
+3.7549999999997 3.46041781919764e-05
+3.7559999999997 3.44744659204471e-05
+3.7569999999997 3.4345205524558e-05
+3.7579999999997 3.42163955680589e-05
+3.7589999999997 3.4088034618736e-05
+3.7599999999997 3.39601212484037e-05
+3.7609999999997 3.38326540328943e-05
+3.7619999999997 3.37056315520492e-05
+3.7629999999997 3.35790523897093e-05
+3.7639999999997 3.34529151337054e-05
+3.7649999999997 3.33272183758493e-05
+3.7659999999997 3.3201960711924e-05
+3.7669999999997 3.3077140741675e-05
+3.7679999999997 3.29527570688002e-05
+3.7689999999997 3.28288083009414e-05
+3.7699999999997 3.27052930496745e-05
+3.7709999999997 3.25822099305005e-05
+3.7719999999997 3.2459557562836e-05
+3.7729999999997 3.23373345700044e-05
+3.7739999999997 3.22155395792263e-05
+3.7749999999997 3.20941712216105e-05
+3.7759999999997 3.19732281321447e-05
+3.7769999999997 3.18527089496865e-05
+3.7779999999997 3.17326123169541e-05
+3.7789999999997 3.16129368805172e-05
+3.7799999999997 3.1493681290788e-05
+3.7809999999997 3.1374844202012e-05
+3.7819999999997 3.12564242722588e-05
+3.7829999999997 3.11384201634133e-05
+3.7839999999997 3.10208305411662e-05
+3.7849999999997 3.09036540750057e-05
+3.7859999999997 3.07868894382076e-05
+3.7869999999997 3.06705353078269e-05
+3.7879999999997 3.05545903646885e-05
+3.7889999999997 3.04390532933786e-05
+3.7899999999997 3.03239227822352e-05
+3.7909999999997 3.02091975233393e-05
+3.7919999999997 3.00948762125065e-05
+3.7929999999997 2.99809575492773e-05
+3.7939999999997 2.98674402369086e-05
+3.7949999999997 2.97543229823648e-05
+3.7959999999997 2.9641604496309e-05
+3.7969999999997 2.95292834930939e-05
+3.7979999999997 2.9417358690753e-05
+3.7989999999997 2.93058288109919e-05
+3.7999999999997 2.91946925791797e-05
+3.8009999999997 2.90839487243395e-05
+3.8019999999997 2.89735959791403e-05
+3.8029999999997 2.88636330798881e-05
+3.8039999999997 2.87540587665166e-05
+3.8049999999997 2.86448717825792e-05
+3.8059999999997 2.85360708752401e-05
+3.8069999999997 2.8427654795265e-05
+3.8079999999997 2.83196222970134e-05
+3.8089999999997 2.82119721384289e-05
+3.8099999999997 2.81047030810312e-05
+3.8109999999997 2.79978138899075e-05
+3.8119999999997 2.78913033337032e-05
+3.8129999999997 2.77851701846141e-05
+3.81399999999969 2.76794132183771e-05
+3.81499999999969 2.75740312142622e-05
+3.81599999999969 2.74690229550636e-05
+3.81699999999969 2.73643872270909e-05
+3.81799999999969 2.72601228201613e-05
+3.81899999999969 2.71562285275903e-05
+3.81999999999969 2.70527031461837e-05
+3.82099999999969 2.69495454762287e-05
+3.82199999999969 2.68467543214859e-05
+3.82299999999969 2.67443284891803e-05
+3.82399999999969 2.66422667899933e-05
+3.82499999999969 2.65405680380539e-05
+3.82599999999969 2.64392310509307e-05
+3.82699999999969 2.6338254649623e-05
+3.82799999999969 2.62376376585528e-05
+3.82899999999969 2.61373789055561e-05
+3.82999999999969 2.60374772218748e-05
+3.83099999999969 2.59379314421484e-05
+3.83199999999969 2.58387404044053e-05
+3.83299999999969 2.57399029500548e-05
+3.83399999999969 2.56414179238788e-05
+3.83499999999969 2.55432841740231e-05
+3.83599999999969 2.54455005519899e-05
+3.83699999999969 2.53480659126286e-05
+3.83799999999969 2.52509791141285e-05
+3.83899999999969 2.51542390180098e-05
+3.83999999999969 2.50578444891157e-05
+3.84099999999969 2.49617943956044e-05
+3.84199999999969 2.48660876089406e-05
+3.84299999999969 2.47707230038873e-05
+3.84399999999969 2.46756994584981e-05
+3.84499999999969 2.45810158541085e-05
+3.84599999999969 2.44866710753281e-05
+3.84699999999969 2.43926640100324e-05
+3.84799999999969 2.42989935493549e-05
+3.84899999999969 2.42056585876785e-05
+3.84999999999969 2.4112658022628e-05
+3.85099999999969 2.40199907550619e-05
+3.85199999999969 2.3927655689064e-05
+3.85299999999969 2.3835651731936e-05
+3.85399999999969 2.37439777941889e-05
+3.85499999999969 2.36526327895355e-05
+3.85599999999969 2.35616156348819e-05
+3.85699999999969 2.34709252503201e-05
+3.85799999999969 2.33805605591196e-05
+3.85899999999969 2.32905204877199e-05
+3.85999999999969 2.3200803965722e-05
+3.86099999999969 2.31114099258811e-05
+3.86199999999969 2.30223373040983e-05
+3.86299999999969 2.2933585039413e-05
+3.86399999999969 2.28451520739947e-05
+3.86499999999969 2.27570373531355e-05
+3.86599999999969 2.26692398252422e-05
+3.86699999999969 2.25817584418283e-05
+3.86799999999969 2.24945921575064e-05
+3.86899999999969 2.24077399299802e-05
+3.86999999999969 2.23212007200371e-05
+3.87099999999969 2.223497349154e-05
+3.87199999999969 2.21490572114198e-05
+3.87299999999969 2.20634508496678e-05
+3.87399999999969 2.19781533793275e-05
+3.87499999999969 2.18931637764877e-05
+3.87599999999969 2.18084810202738e-05
+3.87699999999969 2.17241040928411e-05
+3.87799999999969 2.16400319793664e-05
+3.87899999999969 2.15562636680411e-05
+3.87999999999969 2.14727981500627e-05
+3.88099999999969 2.13896344196279e-05
+3.88199999999969 2.13067714739247e-05
+3.88299999999969 2.12242083131249e-05
+3.88399999999969 2.11419439403763e-05
+3.88499999999969 2.10599773617956e-05
+3.88599999999969 2.09783075864605e-05
+3.88699999999969 2.08969336264023e-05
+3.88799999999969 2.08158544965983e-05
+3.88899999999969 2.07350692149644e-05
+3.88999999999969 2.06545768023477e-05
+3.89099999999969 2.05743762825189e-05
+3.89199999999969 2.04944666821648e-05
+3.89299999999969 2.04148470308809e-05
+3.89399999999969 2.03355163611641e-05
+3.89499999999969 2.02564737084053e-05
+3.89599999999969 2.01777181108818e-05
+3.89699999999969 2.009924860975e-05
+3.89799999999969 2.00210642490381e-05
+3.89899999999969 1.99431640756387e-05
+3.89999999999969 1.98655471393016e-05
+3.90099999999969 1.97882124926263e-05
+3.90199999999969 1.97111591910545e-05
+3.90299999999969 1.96343862928634e-05
+3.90399999999969 1.9557892859158e-05
+3.90499999999968 1.94816779538637e-05
+3.90599999999968 1.94057406437195e-05
+3.90699999999968 1.93300799982703e-05
+3.90799999999968 1.92546950898601e-05
+3.90899999999968 1.91795849936244e-05
+3.90999999999968 1.91047487874833e-05
+3.91099999999968 1.90301855521343e-05
+3.91199999999968 1.89558943710447e-05
+3.91299999999968 1.88818743304452e-05
+3.91399999999968 1.88081245193221e-05
+3.91499999999968 1.87346440294104e-05
+3.91599999999968 1.8661431955187e-05
+3.91699999999968 1.85884873938629e-05
+3.91799999999968 1.85158094453769e-05
+3.91899999999968 1.8443397212388e-05
+3.91999999999968 1.83712498002685e-05
+3.92099999999968 1.82993663170971e-05
+3.92199999999968 1.82277458736517e-05
+3.92299999999968 1.81563875834023e-05
+3.92399999999968 1.80852905625043e-05
+3.92499999999968 1.80144539297913e-05
+3.92599999999968 1.79438768067682e-05
+3.92699999999968 1.78735583176044e-05
+3.92799999999968 1.78034975891262e-05
+3.92899999999968 1.7733693750811e-05
+3.92999999999968 1.76641459347792e-05
+3.93099999999968 1.75948532757881e-05
+3.93199999999968 1.75258149112249e-05
+3.93299999999968 1.74570299810994e-05
+3.93399999999968 1.73884976280376e-05
+3.93499999999968 1.73202169972746e-05
+3.93599999999968 1.72521872366479e-05
+3.93699999999968 1.71844074965906e-05
+3.93799999999968 1.71168769301245e-05
+3.93899999999968 1.70495946928532e-05
+3.93999999999968 1.69825599429557e-05
+3.94099999999968 1.69157718411792e-05
+3.94199999999968 1.68492295508328e-05
+3.94299999999968 1.67829322377803e-05
+3.94399999999968 1.67168790704338e-05
+3.94499999999968 1.66510692197468e-05
+3.94599999999968 1.65855018592079e-05
+3.94699999999968 1.65201761648335e-05
+3.94799999999968 1.64550913151617e-05
+3.94899999999968 1.63902464912451e-05
+3.94999999999968 1.63256408766449e-05
+3.95099999999968 1.62612736574234e-05
+3.95199999999968 1.61971440221382e-05
+3.95299999999968 1.61332511618351e-05
+3.95399999999968 1.60695942700416e-05
+3.95499999999968 1.60061725427604e-05
+3.95599999999968 1.59429851784629e-05
+3.95699999999968 1.58800313780826e-05
+3.95799999999968 1.58173103450084e-05
+3.95899999999968 1.57548212850784e-05
+3.95999999999968 1.56925634065732e-05
+3.96099999999968 1.56305359202093e-05
+3.96199999999968 1.5568738039133e-05
+3.96299999999968 1.55071689789135e-05
+3.96399999999968 1.54458279575369e-05
+3.96499999999968 1.53847141953993e-05
+3.96599999999968 1.53238269153008e-05
+3.96699999999968 1.52631653424386e-05
+3.96799999999968 1.52027287044012e-05
+3.96899999999968 1.51425162311616e-05
+3.96999999999968 1.50825271550711e-05
+3.97099999999968 1.50227607108528e-05
+3.97199999999968 1.49632161355954e-05
+3.97299999999968 1.49038926687468e-05
+3.97399999999968 1.4844789552108e-05
+3.97499999999968 1.47859060298263e-05
+3.97599999999968 1.47272413483896e-05
+3.97699999999968 1.46687947566196e-05
+3.97799999999968 1.4610565505666e-05
+3.97899999999968 1.45525528489999e-05
+3.97999999999968 1.44947560424078e-05
+3.98099999999968 1.44371743439851e-05
+3.98199999999968 1.43798070141303e-05
+3.98299999999968 1.43226533155384e-05
+3.98399999999968 1.42657125131951e-05
+3.98499999999968 1.420898387437e-05
+3.98599999999968 1.41524666686114e-05
+3.98699999999968 1.40961601677393e-05
+3.98799999999968 1.40400636458396e-05
+3.98899999999968 1.3984176379258e-05
+3.98999999999968 1.3928497646594e-05
+3.99099999999968 1.38730267286946e-05
+3.99199999999968 1.38177629086481e-05
+3.99299999999968 1.37627054717785e-05
+3.99399999999968 1.37078537056392e-05
+3.99499999999968 1.36532069000068e-05
+3.99599999999967 1.35987643468751e-05
+3.99699999999967 1.35445253404496e-05
+3.99799999999967 1.34904891771407e-05
+3.99899999999967 1.34366551555584e-05
+3.99999999999967 1.3383022576506e-05
+4.00099999999967 1.33295907429739e-05
+4.00199999999967 1.32763589601344e-05
+4.00299999999968 1.32233265353348e-05
+4.00399999999968 1.31704927780925e-05
+4.00499999999968 1.31178570000881e-05
+4.00599999999968 1.30654185151603e-05
+4.00699999999968 1.30131766392995e-05
+4.00799999999968 1.29611306906422e-05
+4.00899999999968 1.29092799894649e-05
+4.00999999999968 1.28576238581787e-05
+4.01099999999968 1.2806161621323e-05
+4.01199999999968 1.27548926055597e-05
+4.01299999999968 1.27038161396678e-05
+4.01399999999968 1.26529315545372e-05
+4.01499999999968 1.26022381831633e-05
+4.01599999999968 1.25517353606407e-05
+4.01699999999968 1.25014224241578e-05
+4.01799999999968 1.24512987129912e-05
+4.01899999999968 1.24013635684996e-05
+4.01999999999968 1.23516163341182e-05
+4.02099999999968 1.23020563553532e-05
+4.02199999999968 1.22526829797758e-05
+4.02299999999968 1.22034955570168e-05
+4.02399999999968 1.21544934387606e-05
+4.02499999999968 1.21056759787399e-05
+4.02599999999968 1.20570425327299e-05
+4.02699999999968 1.20085924585426e-05
+4.02799999999968 1.19603251160212e-05
+4.02899999999968 1.19122398670346e-05
+4.02999999999968 1.18643360754717e-05
+4.03099999999968 1.18166131072359e-05
+4.03199999999968 1.17690703302395e-05
+4.03299999999969 1.1721707114398e-05
+4.03399999999969 1.16745228316249e-05
+4.03499999999969 1.16275168558258e-05
+4.03599999999969 1.15806885628931e-05
+4.03699999999969 1.15340373307003e-05
+4.03799999999969 1.14875625390969e-05
+4.03899999999969 1.14412635699022e-05
+4.03999999999969 1.13951398069009e-05
+4.04099999999969 1.13491906358364e-05
+4.04199999999969 1.13034154444063e-05
+4.04299999999969 1.12578136222566e-05
+4.04399999999969 1.12123845609763e-05
+4.04499999999969 1.1167127654092e-05
+4.04599999999969 1.11220422970624e-05
+4.04699999999969 1.10771278872733e-05
+4.04799999999969 1.10323838240316e-05
+4.04899999999969 1.09878095085604e-05
+4.04999999999969 1.09434043439938e-05
+4.05099999999969 1.08991677353708e-05
+4.05199999999969 1.0855099089631e-05
+4.05299999999969 1.08111978156084e-05
+4.05399999999969 1.07674633240266e-05
+4.05499999999969 1.07238950274933e-05
+4.05599999999969 1.06804923404951e-05
+4.05699999999969 1.06372546793923e-05
+4.05799999999969 1.05941814624136e-05
+4.05899999999969 1.05512721096506e-05
+4.05999999999969 1.05085260430531e-05
+4.06099999999969 1.04659426864234e-05
+4.06199999999969 1.04235214654113e-05
+4.0629999999997 1.03812618075089e-05
+4.0639999999997 1.03391631420455e-05
+4.0649999999997 1.02972249001822e-05
+4.0659999999997 1.02554465149069e-05
+4.0669999999997 1.02138274210292e-05
+4.0679999999997 1.01723670551752e-05
+4.0689999999997 1.01310648557821e-05
+4.0699999999997 1.00899202630939e-05
+4.0709999999997 1.00489327191552e-05
+4.0719999999997 1.0008101667807e-05
+4.0729999999997 9.96742655468116e-06
+4.0739999999997 9.92690682719561e-06
+4.0749999999997 9.88654193454903e-06
+4.0759999999997 9.84633132771601e-06
+4.0769999999997 9.80627445944191e-06
+4.0779999999997 9.7663707842379e-06
+4.0789999999997 9.72661975837592e-06
+4.0799999999997 9.68702083988375e-06
+4.0809999999997 9.64757348853994e-06
+4.0819999999997 9.60827716586887e-06
+4.0829999999997 9.56913133513584e-06
+4.0839999999997 9.53013546134204e-06
+4.0849999999997 9.49128901121966e-06
+4.0859999999997 9.45259145322695e-06
+4.0869999999997 9.41404225754337e-06
+4.0879999999997 9.37564089606455e-06
+4.0889999999997 9.33738684239754e-06
+4.0899999999997 9.29927957185584e-06
+4.0909999999997 9.26131856145456e-06
+4.0919999999997 9.22350328990559e-06
+4.09299999999971 9.18583323761272e-06
+4.09399999999971 9.14830788666679e-06
+4.09499999999971 9.11092672084093e-06
+4.09599999999971 9.07368922558569e-06
+4.09699999999971 9.03659488802427e-06
+4.09799999999971 8.99964319694772e-06
+4.09899999999971 8.96283364281015e-06
+4.09999999999971 8.926165717724e-06
+4.10099999999971 8.88963891545523e-06
+4.10199999999971 8.85325273141867e-06
+4.10299999999971 8.81700666267316e-06
+4.10399999999971 8.78090020791692e-06
+4.10499999999971 8.74493286748281e-06
+4.10599999999971 8.70910414333365e-06
+4.10699999999971 8.6734135390575e-06
+4.10799999999971 8.637860559863e-06
+4.10899999999971 8.60244471257468e-06
+4.10999999999971 8.56716550562838e-06
+4.11099999999971 8.53202244906651e-06
+4.11199999999971 8.49701505453348e-06
+4.11299999999971 8.46214283527103e-06
+4.11399999999971 8.42740530611369e-06
+4.11499999999971 8.39280198348409e-06
+4.11599999999971 8.35833238538846e-06
+4.11699999999971 8.32399603141199e-06
+4.11799999999971 8.28979244271428e-06
+4.11899999999971 8.25572114202479e-06
+4.11999999999971 8.22178165363828e-06
+4.12099999999971 8.18797350341032e-06
+4.12199999999971 8.15429621875268e-06
+4.12299999999972 8.12074932862891e-06
+4.12399999999972 8.08733236354981e-06
+4.12499999999972 8.05404485556886e-06
+4.12599999999972 8.02088633827787e-06
+4.12699999999972 7.98785634680242e-06
+4.12799999999972 7.95495441779743e-06
+4.12899999999972 7.92218008944271e-06
+4.12999999999972 7.88953290143852e-06
+4.13099999999972 7.85701239500113e-06
+4.13199999999972 7.82461811285845e-06
+4.13299999999972 7.79234959924557e-06
+4.13399999999972 7.76020639990041e-06
+4.13499999999972 7.72818806205926e-06
+4.13599999999972 7.69629413445252e-06
+4.13699999999972 7.66452416730025e-06
+4.13799999999972 7.63287771230785e-06
+4.13899999999972 7.6013543226617e-06
+4.13999999999972 7.56995355302486e-06
+4.14099999999972 7.53867495953273e-06
+4.14199999999972 7.50751809978872e-06
+4.14299999999972 7.47648253285997e-06
+4.14399999999972 7.44556781927309e-06
+4.14499999999972 7.41477352100983e-06
+4.14599999999972 7.38409920150284e-06
+4.14699999999972 7.35354442563139e-06
+4.14799999999972 7.32310875971717e-06
+4.14899999999972 7.29279177151998e-06
+4.14999999999972 7.26259303023357e-06
+4.15099999999972 7.23251210648137e-06
+4.15199999999972 7.20254857231236e-06
+4.15299999999973 7.17270200119675e-06
+4.15399999999973 7.14297196802195e-06
+4.15499999999973 7.11335804908825e-06
+4.15599999999973 7.08385982210476e-06
+4.15699999999973 7.05447686618516e-06
+4.15799999999973 7.02520876184367e-06
+4.15899999999973 6.99605509099081e-06
+4.15999999999973 6.96701543692934e-06
+4.16099999999973 6.93808938435011e-06
+4.16199999999973 6.90927651932797e-06
+4.16299999999973 6.88057642931769e-06
+4.16399999999973 6.85198870314988e-06
+4.16499999999973 6.82351293102686e-06
+4.16599999999973 6.79514870451862e-06
+4.16699999999973 6.76689561655887e-06
+4.16799999999973 6.73875326144082e-06
+4.16899999999973 6.71072123481328e-06
+4.16999999999973 6.68279913367656e-06
+4.17099999999973 6.65498655637854e-06
+4.17199999999973 6.62728310261054e-06
+4.17299999999973 6.59968837340348e-06
+4.17399999999973 6.57220197112376e-06
+4.17499999999973 6.54482349946939e-06
+4.17599999999973 6.51755256346591e-06
+4.17699999999973 6.49038876946259e-06
+4.17799999999973 6.46333172512834e-06
+4.17899999999973 6.43638103944788e-06
+4.17999999999973 6.40953632271773e-06
+4.18099999999973 6.38279718654236e-06
+4.18199999999973 6.35616324383028e-06
+4.18299999999974 6.32963410879012e-06
+4.18399999999974 6.30320939692674e-06
+4.18499999999974 6.27688872503738e-06
+4.18599999999974 6.25067171120778e-06
+4.18699999999974 6.22455797480832e-06
+4.18799999999974 6.19854713649019e-06
+4.18899999999974 6.17263881818156e-06
+4.18999999999974 6.14683264308369e-06
+4.19099999999974 6.12112823566722e-06
+4.19199999999974 6.09552522166823e-06
+4.19299999999974 6.07002322808458e-06
+4.19399999999974 6.04462188317203e-06
+4.19499999999974 6.01932081644047e-06
+4.19599999999974 5.99411965865019e-06
+4.19699999999974 5.96901804180809e-06
+4.19799999999974 5.94401559916393e-06
+4.19899999999974 5.9191119652066e-06
+4.19999999999974 5.8943067756604e-06
+4.20099999999974 5.86959966748127e-06
+4.20199999999974 5.84499027885314e-06
+4.20299999999974 5.82047824918418e-06
+4.20399999999974 5.79606321910312e-06
+4.20499999999974 5.77174483045559e-06
+4.20599999999974 5.74752272630042e-06
+4.20699999999974 5.72339655090595e-06
+4.20799999999974 5.69936594974645e-06
+4.20899999999974 5.67543056949838e-06
+4.20999999999974 5.65159005803682e-06
+4.21099999999974 5.62784406443184e-06
+4.21199999999974 5.60419223894484e-06
+4.21299999999975 5.58063423302494e-06
+4.21399999999975 5.55716969930544e-06
+4.21499999999975 5.5337982916002e-06
+4.21599999999975 5.51051966489998e-06
+4.21699999999975 5.48733347536902e-06
+4.21799999999975 5.46423938034134e-06
+4.21899999999975 5.44123703831724e-06
+4.21999999999975 5.41832610895979e-06
+4.22099999999975 5.3955062530912e-06
+4.22199999999975 5.37277713268941e-06
+4.22299999999975 5.35013841088445e-06
+4.22399999999975 5.32758975195506e-06
+4.22499999999975 5.30513082132505e-06
+4.22599999999975 5.28276128555994e-06
+4.22699999999975 5.26048081236339e-06
+4.22799999999975 5.23828907057376e-06
+4.22899999999975 5.21618573016067e-06
+4.22999999999975 5.19417046222147e-06
+4.23099999999975 5.17224293897787e-06
+4.23199999999975 5.15040283377249e-06
+4.23299999999975 5.12864982106541e-06
+4.23399999999975 5.10698357643072e-06
+4.23499999999975 5.0854037765532e-06
+4.23599999999975 5.06391009922483e-06
+4.23699999999975 5.04250222334146e-06
+4.23799999999975 5.0211798288994e-06
+4.23899999999975 4.99994259699201e-06
+4.23999999999975 4.9787902098064e-06
+4.24099999999975 4.95772235062005e-06
+4.24199999999975 4.93673870379743e-06
+4.24299999999976 4.91583895478669e-06
+4.24399999999976 4.89502279011632e-06
+4.24499999999976 4.87428989739185e-06
+4.24599999999976 4.85363996529248e-06
+4.24699999999976 4.83307268356784e-06
+4.24799999999976 4.81258774303467e-06
+4.24899999999976 4.7921848355735e-06
+4.24999999999976 4.77186365412541e-06
+4.25099999999976 4.75162389268876e-06
+4.25199999999976 4.73146524631589e-06
+4.25299999999976 4.71138741110991e-06
+4.25399999999976 4.69139008422144e-06
+4.25499999999976 4.67147296384536e-06
+4.25599999999976 4.6516357492176e-06
+4.25699999999976 4.63187814061191e-06
+4.25799999999976 4.61219983933666e-06
+4.25899999999976 4.59260054773161e-06
+4.25999999999976 4.57307996916479e-06
+4.26099999999976 4.55363780802918e-06
+4.26199999999976 4.5342737697397e-06
+4.26299999999976 4.5149875607299e-06
+4.26399999999976 4.49577888844887e-06
+4.26499999999976 4.4766474613581e-06
+4.26599999999976 4.45759298892827e-06
+4.26699999999976 4.43861518163619e-06
+4.26799999999976 4.41971375096162e-06
+4.26899999999976 4.40088840938418e-06
+4.26999999999976 4.38213887038022e-06
+4.27099999999976 4.36346484841975e-06
+4.27199999999976 4.3448660589633e-06
+4.27299999999977 4.32634221845889e-06
+4.27399999999977 4.30789304433889e-06
+4.27499999999977 4.28951825501702e-06
+4.27599999999977 4.27121756988521e-06
+4.27699999999977 4.25299070931063e-06
+4.27799999999977 4.23483739463258e-06
+4.27899999999977 4.2167573481595e-06
+4.27999999999977 4.19875029316591e-06
+4.28099999999977 4.1808159538894e-06
+4.28199999999977 4.16295405552763e-06
+4.28299999999977 4.1451643242353e-06
+4.28399999999977 4.12744648712118e-06
+4.28499999999977 4.10980027224513e-06
+4.28599999999977 4.09222540861506e-06
+4.28699999999977 4.07472162618404e-06
+4.28799999999977 4.05728865584729e-06
+4.28899999999977 4.0399262294392e-06
+4.28999999999977 4.02263407973045e-06
+4.29099999999977 4.00541194042502e-06
+4.29199999999977 3.98825954615727e-06
+4.29299999999977 3.97117663248902e-06
+4.29399999999977 3.95416293590663e-06
+4.29499999999977 3.93721819381809e-06
+4.29599999999977 3.92034214455013e-06
+4.29699999999977 3.90353452734532e-06
+4.29799999999977 3.88679508235916e-06
+4.29899999999977 3.87012355065727e-06
+4.29999999999977 3.85351967421245e-06
+4.30099999999977 3.83698319590186e-06
+4.30199999999977 3.82051385950414e-06
+4.30299999999978 3.8041114096966e-06
+4.30399999999978 3.78777559205234e-06
+4.30499999999978 3.77150615303745e-06
+4.30599999999978 3.75530284000817e-06
+4.30699999999978 3.73916540120809e-06
+4.30799999999978 3.72309358576534e-06
+4.30899999999978 3.70708714368976e-06
+4.30999999999978 3.69114582587015e-06
+4.31099999999978 3.67526938407148e-06
+4.31199999999978 3.65945757093208e-06
+4.31299999999978 3.6437101399609e-06
+4.31399999999978 3.62802684553473e-06
+4.31499999999978 3.61240744289548e-06
+4.31599999999978 3.5968516881474e-06
+4.31699999999978 3.58135933825434e-06
+4.31799999999978 3.56593015103702e-06
+4.31899999999978 3.55056388517035e-06
+4.31999999999978 3.53526030018066e-06
+4.32099999999978 3.52001915644299e-06
+4.32199999999978 3.50484021517843e-06
+4.32299999999978 3.48972323845141e-06
+4.32399999999978 3.47466798916697e-06
+4.32499999999978 3.45967423106815e-06
+4.32599999999978 3.44474172873327e-06
+4.32699999999978 3.4298702475733e-06
+4.32799999999978 3.41505955382914e-06
+4.32899999999978 3.40030941456905e-06
+4.32999999999978 3.38561959768595e-06
+4.33099999999978 3.37098987189481e-06
+4.33199999999978 3.35642000673003e-06
+4.33299999999979 3.34190977254276e-06
+4.33399999999979 3.32745894049838e-06
+4.33499999999979 3.31306728257383e-06
+4.33599999999979 3.298734571555e-06
+4.33699999999979 3.2844605810342e-06
+4.33799999999979 3.2702450854075e-06
+4.33899999999979 3.25608785987224e-06
+4.33999999999979 3.24198868042437e-06
+4.34099999999979 3.22794732385593e-06
+4.34199999999979 3.2139635677525e-06
+4.34299999999979 3.20003719049065e-06
+4.34399999999979 3.18616797123538e-06
+4.34499999999979 3.17235568993758e-06
+4.34599999999979 3.15860012733155e-06
+4.34699999999979 3.14490106493241e-06
+4.34799999999979 3.13125828503365e-06
+4.34899999999979 3.11767157070458e-06
+4.34999999999979 3.10414070578785e-06
+4.35099999999979 3.09066547489694e-06
+4.35199999999979 3.07724566341371e-06
+4.35299999999979 3.06388105748588e-06
+4.35399999999979 3.0505714440246e-06
+4.35499999999979 3.03731661070191e-06
+4.35599999999979 3.0241163459484e-06
+4.35699999999979 3.01097043895063e-06
+4.35799999999979 2.99787867964878e-06
+4.35899999999979 2.98484085873419e-06
+4.35999999999979 2.97185676764689e-06
+4.36099999999979 2.95892619857322e-06
+4.36199999999979 2.94604894444341e-06
+4.3629999999998 2.93322479892912e-06
+4.3639999999998 2.92045355644113e-06
+4.3649999999998 2.90773501212684e-06
+4.3659999999998 2.89506896186796e-06
+4.3669999999998 2.88245520227808e-06
+4.3679999999998 2.86989353070031e-06
+4.3689999999998 2.85738374520492e-06
+4.3699999999998 2.84492564458695e-06
+4.3709999999998 2.83251902836388e-06
+4.3719999999998 2.82016369677328e-06
+4.3729999999998 2.80785945077044e-06
+4.3739999999998 2.79560609202607e-06
+4.3749999999998 2.78340342292393e-06
+4.3759999999998 2.77125124655855e-06
+4.3769999999998 2.75914936673287e-06
+4.3779999999998 2.74709758795598e-06
+4.3789999999998 2.73509571544076e-06
+4.3799999999998 2.72314355510164e-06
+4.3809999999998 2.71124091355225e-06
+4.3819999999998 2.69938759810321e-06
+4.3829999999998 2.68758341675978e-06
+4.3839999999998 2.67582817821962e-06
+4.3849999999998 2.66412169187054e-06
+4.3859999999998 2.65246376778822e-06
+4.3869999999998 2.64085421673398e-06
+4.3879999999998 2.6292928501525e-06
+4.3889999999998 2.61777948016961e-06
+4.3899999999998 2.60631391959007e-06
+4.3909999999998 2.59489598189531e-06
+4.3919999999998 2.58352548124122e-06
+4.39299999999981 2.57220223245595e-06
+4.39399999999981 2.56092605103771e-06
+4.39499999999981 2.54969675315253e-06
+4.39599999999981 2.53851415563211e-06
+4.39699999999981 2.52737807597161e-06
+4.39799999999981 2.51628833232748e-06
+4.39899999999981 2.50524474351527e-06
+4.39999999999981 2.49424712900747e-06
+4.40099999999981 2.48329530893134e-06
+4.40199999999981 2.47238910406677e-06
+4.40299999999981 2.46152833584411e-06
+4.40399999999981 2.45071282634205e-06
+4.40499999999981 2.43994239828546e-06
+4.40599999999981 2.42921687504325e-06
+4.40699999999981 2.4185360806263e-06
+4.40799999999981 2.40789983968525e-06
+4.40899999999981 2.39730797750848e-06
+4.40999999999981 2.38676032001995e-06
+4.41099999999981 2.37625669377709e-06
+4.41199999999981 2.36579692596874e-06
+4.41299999999981 2.35538084441306e-06
+4.41399999999981 2.3450082775554e-06
+4.41499999999981 2.33467905446628e-06
+4.41599999999981 2.3243930048393e-06
+4.41699999999981 2.31414995898903e-06
+4.41799999999981 2.30394974784905e-06
+4.41899999999981 2.29379220296979e-06
+4.41999999999981 2.28367715651657e-06
+4.42099999999981 2.27360444126749e-06
+4.42199999999981 2.26357389061143e-06
+4.42299999999982 2.25358533854604e-06
+4.42399999999982 2.24363861967568e-06
+4.42499999999982 2.23373356920942e-06
+4.42599999999982 2.22387002295901e-06
+4.42699999999982 2.21404781733691e-06
+4.42799999999982 2.20426678935427e-06
+4.42899999999982 2.19452677661892e-06
+4.42999999999982 2.18482761733341e-06
+4.43099999999982 2.17516915029302e-06
+4.43199999999982 2.16555121488378e-06
+4.43299999999982 2.15597365108049e-06
+4.43399999999982 2.14643629944477e-06
+4.43499999999982 2.13693900112311e-06
+4.43599999999982 2.12748159784489e-06
+4.43699999999982 2.11806393192044e-06
+4.43799999999982 2.10868584623911e-06
+4.43899999999982 2.09934718426734e-06
+4.43999999999982 2.0900477900467e-06
+4.44099999999982 2.080787508192e-06
+4.44199999999982 2.07156618388933e-06
+4.44299999999982 2.0623836628942e-06
+4.44399999999982 2.05323979152957e-06
+4.44499999999982 2.044134416684e-06
+4.44599999999982 2.03506738580975e-06
+4.44699999999982 2.02603854692083e-06
+4.44799999999982 2.0170477485912e-06
+4.44899999999982 2.00809483995283e-06
+4.44999999999982 1.99917967069385e-06
+4.45099999999982 1.99030209105665e-06
+4.45199999999982 1.98146195183608e-06
+4.45299999999983 1.97265910437754e-06
+4.45399999999983 1.96389340057513e-06
+4.45499999999983 1.95516469286983e-06
+4.45599999999983 1.94647283424764e-06
+4.45699999999983 1.93781767823775e-06
+4.45799999999983 1.92919907891072e-06
+4.45899999999983 1.92061689087661e-06
+4.45999999999983 1.91207096928324e-06
+4.46099999999983 1.9035611698143e-06
+4.46199999999983 1.89508734868759e-06
+4.46299999999983 1.88664936265317e-06
+4.46399999999983 1.87824706899163e-06
+4.46499999999983 1.86988032551224e-06
+4.46599999999983 1.86154899055117e-06
+4.46699999999983 1.85325292296974e-06
+4.46799999999983 1.84499198215263e-06
+4.46899999999983 1.83676602800606e-06
+4.46999999999983 1.82857492095612e-06
+4.47099999999983 1.82041852194692e-06
+4.47199999999983 1.81229669243888e-06
+4.47299999999983 1.80420929440698e-06
+4.47399999999983 1.79615619033899e-06
+4.47499999999983 1.78813724323377e-06
+4.47599999999983 1.78015231659949e-06
+4.47699999999983 1.77220127445193e-06
+4.47799999999983 1.76428398131274e-06
+4.47899999999983 1.75640030220774e-06
+4.47999999999983 1.74855010266522e-06
+4.48099999999983 1.74073324871415e-06
+4.48199999999984 1.73294960688258e-06
+4.48299999999984 1.72519904419589e-06
+4.48399999999984 1.71748142817509e-06
+4.48499999999984 1.70979662683516e-06
+4.48599999999984 1.70214450868334e-06
+4.48699999999984 1.69452494271746e-06
+4.48799999999984 1.68693779842429e-06
+4.48899999999984 1.67938294577785e-06
+4.48999999999984 1.67186025523773e-06
+4.49099999999984 1.66436959774748e-06
+4.49199999999984 1.65691084473291e-06
+4.49299999999984 1.64948386810049e-06
+4.49399999999984 1.64208854023564e-06
+4.49499999999984 1.63472473400117e-06
+4.49599999999984 1.62739232273559e-06
+4.49699999999984 1.62009118025151e-06
+4.49799999999984 1.61282118083401e-06
+4.49899999999984 1.60558219923902e-06
+4.49999999999984 1.59837411069169e-06
+4.50099999999984 1.59119679088483e-06
+4.50199999999984 1.58405011597726e-06
+4.50299999999984 1.57693396259223e-06
+4.50399999999984 1.56984820781583e-06
+4.50499999999984 1.56279272919538e-06
+4.50599999999984 1.55576740473789e-06
+4.50699999999984 1.54877211290843e-06
+4.50799999999984 1.54180673262858e-06
+4.50899999999984 1.53487114327489e-06
+4.50999999999984 1.52796522467723e-06
+4.51099999999984 1.52108885711734e-06
+4.51199999999985 1.5142419213272e-06
+4.51299999999985 1.50742429848748e-06
+4.51399999999985 1.50063587022604e-06
+4.51499999999985 1.49387651861635e-06
+4.51599999999985 1.48714612617597e-06
+4.51699999999985 1.48044457586504e-06
+4.51799999999985 1.47377175108468e-06
+4.51899999999985 1.46712753567555e-06
+4.51999999999985 1.4605118139163e-06
+4.52099999999985 1.45392447052204e-06
+4.52199999999985 1.44736539064287e-06
+4.52299999999985 1.44083445986234e-06
+4.52399999999985 1.43433156419597e-06
+4.52499999999985 1.42785659008975e-06
+4.52599999999985 1.42140942441866e-06
+4.52699999999985 1.41498995448517e-06
+4.52799999999985 1.40859806801777e-06
+4.52899999999985 1.40223365316949e-06
+4.52999999999985 1.39589659851642e-06
+4.53099999999985 1.38958679305628e-06
+4.53199999999985 1.3833041262069e-06
+4.53299999999985 1.37704848780481e-06
+4.53399999999985 1.37081976810377e-06
+4.53499999999985 1.36461785777331e-06
+4.53599999999985 1.3584426478973e-06
+4.53699999999985 1.35229402997251e-06
+4.53799999999985 1.34617189590716e-06
+4.53899999999985 1.34007613801953e-06
+4.53999999999985 1.33400664903647e-06
+4.54099999999985 1.32796332209201e-06
+4.54199999999986 1.32194605072598e-06
+4.54299999999986 1.31595472888252e-06
+4.54399999999986 1.30998925090873e-06
+4.54499999999986 1.30404951155325e-06
+4.54599999999986 1.29813540596485e-06
+4.54699999999986 1.29224682969103e-06
+4.54799999999986 1.28638367867667e-06
+4.54899999999986 1.28054584926258e-06
+4.54999999999986 1.27473323818417e-06
+4.55099999999986 1.26894574257003e-06
+4.55199999999986 1.2631832599406e-06
+4.55299999999986 1.25744568820677e-06
+4.55399999999986 1.25173292566849e-06
+4.55499999999986 1.24604487101349e-06
+4.55599999999986 1.24038142331584e-06
+4.55699999999986 1.23474248203464e-06
+4.55799999999986 1.22912794701264e-06
+4.55899999999986 1.22353771847495e-06
+4.55999999999986 1.21797169702764e-06
+4.56099999999986 1.21242978365644e-06
+4.56199999999986 1.20691187972539e-06
+4.56299999999986 1.20141788697553e-06
+4.56399999999986 1.19594770752356e-06
+4.56499999999986 1.19050124386053e-06
+4.56599999999986 1.18507839885051e-06
+4.56699999999986 1.17967907572931e-06
+4.56799999999986 1.17430317810314e-06
+4.56899999999986 1.16895060994732e-06
+4.56999999999986 1.16362127560499e-06
+4.57099999999986 1.15831507978579e-06
+4.57199999999987 1.15303192756462e-06
+4.57299999999987 1.14777172438027e-06
+4.57399999999987 1.14253437603424e-06
+4.57499999999987 1.13731978868936e-06
+4.57599999999987 1.13212786886861e-06
+4.57699999999987 1.12695852345375e-06
+4.57799999999987 1.12181165968416e-06
+4.57899999999987 1.11668718515549e-06
+4.57999999999987 1.11158500781845e-06
+4.58099999999987 1.10650503597754e-06
+4.58199999999987 1.1014471782898e-06
+4.58299999999987 1.09641134376356e-06
+4.58399999999987 1.09139744175721e-06
+4.58499999999987 1.08640538197794e-06
+4.58599999999987 1.08143507448053e-06
+4.58699999999987 1.07648642966611e-06
+4.58799999999987 1.07155935828092e-06
+4.58899999999987 1.0666537714151e-06
+4.58999999999987 1.06176958050147e-06
+4.59099999999987 1.05690669731431e-06
+4.59199999999987 1.05206503396816e-06
+4.59299999999987 1.04724450291659e-06
+4.59399999999987 1.04244501695102e-06
+4.59499999999987 1.03766648919951e-06
+4.59599999999987 1.03290883312556e-06
+4.59699999999987 1.02817196252692e-06
+4.59799999999987 1.02345579153442e-06
+4.59899999999987 1.01876023461073e-06
+4.59999999999987 1.01408520654926e-06
+4.60099999999987 1.00943062247292e-06
+4.60199999999988 1.00479639783296e-06
+4.60299999999988 1.00018244840782e-06
+4.60399999999988 9.95588690301945e-07
+4.60499999999988 9.91015039944636e-07
+4.60599999999988 9.8646141408888e-07
+4.60699999999988 9.81927729810196e-07
+4.60799999999988 9.77413904505491e-07
+4.60899999999988 9.7291985589191e-07
+4.60999999999988 9.68445502005691e-07
+4.61099999999988 9.63990761201023e-07
+4.61199999999988 9.59555552148918e-07
+4.61299999999988 9.55139793836064e-07
+4.61399999999988 9.50743405563712e-07
+4.61499999999988 9.46366306946538e-07
+4.61599999999988 9.42008417911527e-07
+4.61699999999988 9.37669658696855e-07
+4.61799999999988 9.33349949850769e-07
+4.61899999999988 9.29049212230485e-07
+4.61999999999988 9.24767367001069e-07
+4.62099999999988 9.20504335634347e-07
+4.62199999999988 9.16260039907791e-07
+4.62299999999988 9.1203440190343e-07
+4.62399999999988 9.07827344006755e-07
+4.62499999999988 9.03638788905627e-07
+4.62599999999988 8.99468659589197e-07
+4.62699999999988 8.95316879346816e-07
+4.62799999999988 8.91183371766957e-07
+4.62899999999988 8.87068060736145e-07
+4.62999999999988 8.82970870437882e-07
+4.63099999999988 8.78891725351568e-07
+4.63199999999989 8.74830550251456e-07
+4.63299999999989 8.7078727020557e-07
+4.63399999999989 8.66761810574659e-07
+4.63499999999989 8.62754097011138e-07
+4.63599999999989 8.58764055458037e-07
+4.63699999999989 8.5479161214795e-07
+4.63799999999989 8.50836693601996e-07
+4.63899999999989 8.46899226628772e-07
+4.63999999999989 8.42979138323316e-07
+4.64099999999989 8.39076356066075e-07
+4.64199999999989 8.35190807521876e-07
+4.64299999999989 8.31322420638886e-07
+4.64399999999989 8.27471123647604e-07
+4.64499999999989 8.23636845059825e-07
+4.64599999999989 8.19819513667636e-07
+4.64699999999989 8.16019058542385e-07
+4.64799999999989 8.12235409033687e-07
+4.64899999999989 8.08468494768401e-07
+4.64999999999989 8.04718245649638e-07
+4.65099999999989 8.00984591855749e-07
+4.65199999999989 7.97267463839334e-07
+4.65299999999989 7.93566792326246e-07
+4.65399999999989 7.89882508314593e-07
+4.65499999999989 7.86214543073758e-07
+4.65599999999989 7.82562828143413e-07
+4.65699999999989 7.78927295332528e-07
+4.65799999999989 7.75307876718407e-07
+4.65899999999989 7.71704504645696e-07
+4.65999999999989 7.68117111725424e-07
+4.66099999999989 7.6454563083403e-07
+4.6619999999999 7.60989995112391e-07
+4.6629999999999 7.5745013796487e-07
+4.6639999999999 7.53925993058347e-07
+4.6649999999999 7.50417494321267e-07
+4.6659999999999 7.46924575942686e-07
+4.6669999999999 7.43447172371322e-07
+4.6679999999999 7.39985218314605e-07
+4.6689999999999 7.36538648737736e-07
+4.6699999999999 7.33107398862744e-07
+4.6709999999999 7.2969140416755e-07
+4.6719999999999 7.26290600385034e-07
+4.6729999999999 7.22904923502097e-07
+4.6739999999999 7.19534309758737e-07
+4.6749999999999 7.1617869564713e-07
+4.6759999999999 7.12838017910691e-07
+4.6769999999999 7.09512213543173e-07
+4.6779999999999 7.06201219787739e-07
+4.6789999999999 7.0290497413605e-07
+4.6799999999999 6.99623414327364e-07
+4.6809999999999 6.96356478347613e-07
+4.6819999999999 6.93104104428516e-07
+4.6829999999999 6.89866231046662e-07
+4.6839999999999 6.86642796922628e-07
+4.6849999999999 6.83433741020067e-07
+4.6859999999999 6.80239002544827e-07
+4.6869999999999 6.7705852094406e-07
+4.6879999999999 6.73892235905332e-07
+4.6889999999999 6.70740087355743e-07
+4.6899999999999 6.67602015461046e-07
+4.6909999999999 6.64477960624767e-07
+4.69199999999991 6.61367863487334e-07
+4.69299999999991 6.58271664925203e-07
+4.69399999999991 6.55189306049989e-07
+4.69499999999991 6.52120728207603e-07
+4.69599999999991 6.49065872977385e-07
+4.69699999999991 6.46024682171243e-07
+4.69799999999991 6.42997097832807e-07
+4.69899999999991 6.39983062236557e-07
+4.69999999999991 6.36982517886986e-07
+4.70099999999991 6.33995407517743e-07
+4.70199999999991 6.31021674090791e-07
+4.70299999999991 6.28061260795563e-07
+4.70399999999991 6.25114111048122e-07
+4.70499999999991 6.22180168490321e-07
+4.70599999999991 6.19259376988972e-07
+4.70699999999991 6.16351680635016e-07
+4.70799999999991 6.13457023742684e-07
+4.70899999999991 6.10575350848683e-07
+4.70999999999991 6.07706606711366e-07
+4.71099999999991 6.0485073630991e-07
+4.71199999999991 6.02007684843502e-07
+4.71299999999991 5.9917739773052e-07
+4.71399999999991 5.96359820607728e-07
+4.71499999999991 5.93554899329453e-07
+4.71599999999991 5.90762579966794e-07
+4.71699999999991 5.87982808806802e-07
+4.71799999999991 5.85215532351693e-07
+4.71899999999991 5.82460697318034e-07
+4.71999999999991 5.79718250635962e-07
+4.72099999999991 5.76988139448379e-07
+4.72199999999992 5.74270311110167e-07
+4.72299999999992 5.71564713187397e-07
+4.72399999999992 5.68871293456544e-07
+4.72499999999992 5.66189999903709e-07
+4.72599999999992 5.63520780723828e-07
+4.72699999999992 5.60863584319906e-07
+4.72799999999992 5.58218359302235e-07
+4.72899999999992 5.55585054487621e-07
+4.72999999999992 5.52963618898621e-07
+4.73099999999992 5.5035400176277e-07
+4.73199999999992 5.47756152511817e-07
+4.73299999999992 5.45170020780964e-07
+4.73399999999992 5.42595556408107e-07
+4.73499999999992 5.40032709433082e-07
+4.73599999999992 5.37481430096902e-07
+4.73699999999992 5.34941668841015e-07
+4.73799999999992 5.32413376306549e-07
+4.73899999999992 5.29896503333568e-07
+4.73999999999992 5.27391000960328e-07
+4.74099999999992 5.24896820422532e-07
+4.74199999999992 5.22413913152596e-07
+4.74299999999992 5.1994223077891e-07
+4.74399999999992 5.17481725125103e-07
+4.74499999999992 5.15032348209313e-07
+4.74599999999992 5.12594052243458e-07
+4.74699999999992 5.1016678963251e-07
+4.74799999999992 5.07750512973768e-07
+4.74899999999992 5.05345175056141e-07
+4.74999999999992 5.02950728859425e-07
+4.75099999999992 5.00567127553588e-07
+4.75199999999993 4.98194324498056e-07
+4.75299999999993 4.95832273241001e-07
+4.75399999999993 4.9348092751863e-07
+4.75499999999993 4.91140241254483e-07
+4.75599999999993 4.88810168558721e-07
+4.75699999999993 4.86490663727429e-07
+4.75799999999993 4.8418168124192e-07
+4.75899999999993 4.81883175768027e-07
+4.75999999999993 4.79595102155417e-07
+4.76099999999993 4.77317415436895e-07
+4.76199999999993 4.75050070827716e-07
+4.76299999999993 4.72793023724894e-07
+4.76399999999993 4.70546229706518e-07
+4.76499999999993 4.68309644531073e-07
+4.76599999999993 4.66083224136752e-07
+4.76699999999993 4.6386692464078e-07
+4.76799999999993 4.61660702338745e-07
+4.76899999999993 4.59464513703913e-07
+4.76999999999993 4.57278315386564e-07
+4.77099999999993 4.55102064213322e-07
+4.77199999999993 4.52935717186485e-07
+4.77299999999993 4.50779231483365e-07
+4.77399999999993 4.48632564455622e-07
+4.77499999999993 4.46495673628608e-07
+4.77599999999993 4.44368516700701e-07
+4.77699999999993 4.42251051542664e-07
+4.77799999999993 4.40143236196978e-07
+4.77899999999993 4.38045028877197e-07
+4.77999999999993 4.35956387967301e-07
+4.78099999999993 4.33877272021045e-07
+4.78199999999994 4.31807639761322e-07
+4.78299999999994 4.29747450079512e-07
+4.78399999999994 4.27696662034849e-07
+4.78499999999994 4.25655234853783e-07
+4.78599999999994 4.2362312792934e-07
+4.78699999999994 4.21600300820495e-07
+4.78799999999994 4.19586713251536e-07
+4.78899999999994 4.1758232511144e-07
+4.78999999999994 4.15587096453243e-07
+4.79099999999994 4.13600987493418e-07
+4.79199999999994 4.11623958611249e-07
+4.79299999999994 4.09655970348217e-07
+4.79399999999994 4.07696983407376e-07
+4.79499999999994 4.05746958652743e-07
+4.79599999999994 4.03805857108679e-07
+4.79699999999994 4.01873639959283e-07
+4.79799999999994 3.99950268547776e-07
+4.79899999999994 3.98035704375903e-07
+4.79999999999994 3.9612990910332e-07
+4.80099999999994 3.94232844546991e-07
+4.80199999999994 3.92344472680595e-07
+4.80299999999994 3.9046475563392e-07
+4.80399999999994 3.88593655692269e-07
+4.80499999999994 3.86731135295862e-07
+4.80599999999994 3.84877157039253e-07
+4.80699999999994 3.83031683670727e-07
+4.80799999999994 3.81194678091719e-07
+4.80899999999994 3.7936610335623e-07
+4.80999999999994 3.77545922670235e-07
+4.81099999999994 3.75734099391107e-07
+4.81199999999995 3.73930597027033e-07
+4.81299999999995 3.72135379236441e-07
+4.81399999999995 3.70348409827417e-07
+4.81499999999995 3.68569652757137e-07
+4.81599999999995 3.66799072131291e-07
+4.81699999999995 3.65036632203513e-07
+4.81799999999995 3.63282297374818e-07
+4.81899999999995 3.61536032193028e-07
+4.81999999999995 3.59797801352216e-07
+4.82099999999995 3.58067569692135e-07
+4.82199999999995 3.56345302197668e-07
+4.82299999999995 3.54630963998261e-07
+4.82399999999995 3.52924520367372e-07
+4.82499999999995 3.51225936721914e-07
+4.82599999999995 3.49535178621706e-07
+4.82699999999995 3.47852211768917e-07
+4.82799999999995 3.46177002007526e-07
+4.82899999999995 3.44509515322765e-07
+4.82999999999995 3.42849717840585e-07
+4.83099999999995 3.41197575827105e-07
+4.83199999999995 3.39553055688077e-07
+4.83299999999995 3.37916123968344e-07
+4.83399999999995 3.36286747351303e-07
+4.83499999999995 3.34664892658373e-07
+4.83599999999995 3.33050526848458e-07
+4.83699999999995 3.3144361701742e-07
+4.83799999999995 3.29844130397545e-07
+4.83899999999995 3.28252034357018e-07
+4.83999999999995 3.26667296399399e-07
+4.84099999999995 3.25089884163096e-07
+4.84199999999996 3.23519765420846e-07
+4.84299999999996 3.2195690807919e-07
+4.84399999999996 3.20401280177964e-07
+4.84499999999996 3.18852849889771e-07
+4.84599999999996 3.17311585519477e-07
+4.84699999999996 3.15777455503692e-07
+4.84799999999996 3.1425042841026e-07
+4.84899999999996 3.12730472937752e-07
+4.84999999999996 3.11217557914958e-07
+4.85099999999996 3.09711652300378e-07
+4.85199999999996 3.08212725181727e-07
+4.85299999999996 3.06720745775422e-07
+4.85399999999996 3.0523568342609e-07
+4.85499999999996 3.03757507606067e-07
+4.85599999999996 3.02286187914903e-07
+4.85699999999996 3.00821694078863e-07
+4.85799999999996 2.99363995950439e-07
+4.85899999999996 2.97913063507856e-07
+4.85999999999996 2.96468866854584e-07
+4.86099999999996 2.95031376218847e-07
+4.86199999999996 2.93600561953145e-07
+4.86299999999996 2.92176394533758e-07
+4.86399999999996 2.90758844560273e-07
+4.86499999999996 2.893478827551e-07
+4.86599999999996 2.87943479962993e-07
+4.86699999999996 2.8654560715057e-07
+4.86799999999996 2.85154235405842e-07
+4.86899999999996 2.83769335937739e-07
+4.86999999999996 2.82390880075631e-07
+4.87099999999996 2.81018839268865e-07
+4.87199999999997 2.79653185086295e-07
+4.87299999999997 2.78293889215807e-07
+4.87399999999997 2.76940923463866e-07
+4.87499999999997 2.75594259755043e-07
+4.87599999999997 2.74253870131554e-07
+4.87699999999997 2.72919726752805e-07
+4.87799999999997 2.71591801894926e-07
+4.87899999999997 2.70270067950317e-07
+4.87999999999997 2.68954497427194e-07
+4.88099999999997 2.67645062949133e-07
+4.88199999999997 2.66341737254618e-07
+4.88299999999997 2.6504449319659e-07
+4.88399999999997 2.63753303742e-07
+4.88499999999997 2.62468141971357e-07
+4.88599999999997 2.61188981078289e-07
+4.88699999999997 2.59915794369092e-07
+4.88799999999997 2.58648555262293e-07
+4.88899999999997 2.57387237288205e-07
+4.88999999999997 2.5613181408849e-07
+4.89099999999997 2.54882259415718e-07
+4.89199999999997 2.53638547132935e-07
+4.89299999999997 2.52400651213227e-07
+4.89399999999997 2.51168545739283e-07
+4.89499999999997 2.49942204902971e-07
+4.89599999999997 2.487216030049e-07
+4.89699999999997 2.47506714453998e-07
+4.89799999999997 2.46297513767082e-07
+4.89899999999997 2.45093975568431e-07
+4.89999999999997 2.43896074589366e-07
+4.90099999999997 2.42703785667828e-07
+4.90199999999998 2.41517083747953e-07
+4.90299999999998 2.40335943879655e-07
+4.90399999999998 2.39160341218212e-07
+4.90499999999998 2.37990251023842e-07
+4.90599999999998 2.36825648661297e-07
+4.90699999999998 2.35666509599444e-07
+4.90799999999998 2.34512809410855e-07
+4.90899999999998 2.33364523771397e-07
+4.90999999999998 2.32221628459825e-07
+4.91099999999998 2.31084099357371e-07
+4.91199999999998 2.29951912447344e-07
+4.91299999999998 2.28825043814718e-07
+4.91399999999998 2.27703469645738e-07
+4.91499999999998 2.26587166227513e-07
+4.91599999999998 2.25476109947617e-07
+4.91699999999998 2.24370277293693e-07
+4.91799999999998 2.23269644853053e-07
+4.91899999999998 2.22174189312287e-07
+4.91999999999998 2.21083887456862e-07
+4.92099999999998 2.19998716170739e-07
+4.92199999999998 2.18918652435972e-07
+4.92299999999998 2.17843673332326e-07
+4.92399999999998 2.16773756036883e-07
+4.92499999999998 2.15708877823663e-07
+4.92599999999998 2.14649016063227e-07
+4.92699999999998 2.13594148222305e-07
+4.92799999999998 2.12544251863406e-07
+4.92899999999998 2.11499304644437e-07
+4.92999999999998 2.10459284318329e-07
+4.93099999999998 2.0942416873265e-07
+4.93199999999999 2.08393935829238e-07
+4.93299999999999 2.07368563643815e-07
+4.93399999999999 2.06348030305622e-07
+4.93499999999999 2.05332314037039e-07
+4.93599999999999 2.04321393153218e-07
+4.93699999999999 2.0331524606171e-07
+4.93799999999999 2.023138512621e-07
+4.93899999999999 2.01317187345635e-07
+4.93999999999999 2.00325232994861e-07
+4.94099999999999 1.99337966983258e-07
+4.94199999999999 1.98355368174874e-07
+4.94299999999999 1.97377415523968e-07
+4.94399999999999 1.96404088074644e-07
+4.94499999999999 1.95435364960495e-07
+4.94599999999999 1.94471225404244e-07
+4.94699999999999 1.93511648717387e-07
+4.94799999999999 1.92556614299839e-07
+4.94899999999999 1.91606101639577e-07
+4.94999999999999 1.9066009031229e-07
+4.95099999999999 1.89718559981025e-07
+4.95199999999999 1.88781490395843e-07
+4.95299999999999 1.87848861393459e-07
+4.95399999999999 1.86920652896906e-07
+4.95499999999999 1.85996844915182e-07
+4.95599999999999 1.85077417542905e-07
+4.95699999999999 1.84162350959974e-07
+4.95799999999999 1.8325162543122e-07
+4.95899999999999 1.82345221306071e-07
+4.95999999999999 1.81443119018208e-07
+4.96099999999999 1.80545299085228e-07
+4.962 1.79651742108305e-07
+4.963 1.78762428771857e-07
+4.964 1.77877339843207e-07
+4.965 1.76996456172254e-07
+4.966 1.76119758691136e-07
+4.967 1.75247228413901e-07
+4.968 1.74378846436178e-07
+4.969 1.73514593934846e-07
+4.97 1.72654452167709e-07
+4.971 1.71798402473166e-07
+4.972 1.7094642626989e-07
+4.973 1.70098505056504e-07
+4.974 1.69254620411252e-07
+4.975 1.68414753991688e-07
+4.976 1.67578887534345e-07
+4.977 1.66747002854425e-07
+4.978 1.65919081845474e-07
+4.979 1.6509510647907e-07
+4.98 1.64275058804506e-07
+4.981 1.63458920948476e-07
+4.982 1.62646675114761e-07
+4.983 1.61838303583916e-07
+4.984 1.61033788712963e-07
+4.985 1.60233112935078e-07
+4.986 1.59436258759284e-07
+4.987 1.58643208770143e-07
+4.988 1.5785394562745e-07
+4.989 1.57068452065929e-07
+4.99 1.56286710894925e-07
+4.991 1.5550870499811e-07
+4.99200000000001 1.5473441733317e-07
+4.99300000000001 1.53963830931514e-07
+4.99400000000001 1.5319692889797e-07
+4.99500000000001 1.52433694410488e-07
+4.99600000000001 1.51674110719841e-07
+4.99700000000001 1.50918161149334e-07
+4.99800000000001 1.50165829094503e-07
+4.99900000000001 1.49417098022825e-07
Index: /branches/czw_branch/20100519/archive/noise_model/plot.gp
===================================================================
--- /branches/czw_branch/20100519/archive/noise_model/plot.gp	(revision 28304)
+++ /branches/czw_branch/20100519/archive/noise_model/plot.gp	(revision 28304)
@@ -0,0 +1,65 @@
+### gnuplot commands to generate histogram plots
+###
+### Generate Gaussian ("gauss.dat") with:
+### perl -e 'use Math::Trig; for (my $x = -5; $x <= 5; $x += 0.001) { $y = exp(-0.5*$x**2)/10/sqrt(2*pi()); print "$x $y\n"; }' > gauss.dat
+
+set xrange [-5:5]
+set yrange [0:0.045]
+set border linewidth 3
+set term postscript color eps font "Times-Roman,14"
+
+# Input
+set output "input.ps"
+plot \
+    "hist_0.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_18.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_36.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Warp phot
+set output "warp_phot.ps"
+plot \
+    "hist_3.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_21.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_39.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Warp conv phot
+set output "warp_conv_phot.ps"
+plot \
+    "hist_5.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_23.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_41.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Stack
+set output "stack.ps"
+plot \
+    "hist_50.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_51.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_59.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Stack phot
+set output "stack_phot.ps"
+plot \
+    "hist_51.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_52.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_60.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Diff
+set output "diff.ps"
+plot \
+    "hist_48.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_56.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_63.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
+
+# Diff phot
+set output "diff_phot.ps"
+plot \
+    "hist_49.dat" notitle with lines lt 1 lw 3 lc 1 , \
+    "hist_57.dat" notitle with lines lt 1 lw 3 lc 3 , \
+    "hist_64.dat" notitle with lines lt 1 lw 3 lc 11 , \
+    "gauss.dat" notitle with lines lt 1 lw 3 lc 7
Index: /branches/czw_branch/20100519/archive/noise_model/simulate.c
===================================================================
--- /branches/czw_branch/20100519/archive/noise_model/simulate.c	(revision 28303)
+++ /branches/czw_branch/20100519/archive/noise_model/simulate.c	(revision 28304)
@@ -10,9 +10,10 @@
 #define SCALE 0.654321
 #define ROT M_PI_2
-#define INTERPOLATION PS_INTERPOLATE_LANCZOS3
+#define INTERPOLATION PS_INTERPOLATE_LANCZOS4
 #define OFFSET 16
 #define SMOOTH_SIGMA 6.54321
 #define SMOOTH_N_SIGMA 2.0
 #define DUAL_KERNEL "sub.subkernel"
+#define WARP_NUM 10000
 
 static const float variances[] = { 3.0, 10.0, 30.0, 100.0, 300.0, 1000.0, 3000.0, 10000.0 };
@@ -94,21 +95,81 @@
         }
     }
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
-    psStats *stats = psStatsAlloc(PS_STAT_ROBUST_STDEV);
-    psImageBackground(stats, NULL, sn, mask, 0xFF, rng);
-    float noise = stats->robustStdev;
+    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
+    psImageStats(stats, sn, mask, 0xFF);
+    float noise = stats->sampleStdev;
+    float offset = stats->sampleMean;
     psFree(stats);
-    psFree(rng);
+
+    psHistogram *hist = psHistogramAlloc(-5, +5, 101);
+    psVector *data = psVectorAlloc(sn->numCols * sn->numRows, PS_TYPE_F32);
+    psVector *dataMask = psVectorAlloc(sn->numCols * sn->numRows, PS_TYPE_VECTOR_MASK);
+    psVectorInit(dataMask, 0);
+    long num = 0;
+    for (int y = 0, i = 0; y < sn->numRows; y++) {
+        for (int x = 0; x < sn->numCols; x++, i++) {
+            data->data.F32[i] = sn->data.F32[y][x] - offset;
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x]) {
+                dataMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xFF;
+            } else {
+                num++;
+            }
+        }
+    }
+    psVectorHistogram(hist, data, NULL, dataMask, 0xFF);
+    psFree(data);
+    psFree(dataMask);
     psFree(sn);
+
+    static int number = 0;
+    psString name = NULL;
+    fprintf(stderr, "Writing histogram %d\n", number);
+    psStringAppend(&name, "hist_%d.dat", number++);
+    FILE *file = fopen(name, "w");
+    psFree(name);
+    fprintf(file, "# Sig Frac\n");
+    for (int i = 0; i < hist->bounds->n - 1; i++) {
+        fprintf(file, "%f %f\n",
+                0.5 * (hist->bounds->data.F32[i] + hist->bounds->data.F32[i+1]),
+                hist->nums->data.F32[i] / num);
+    }
+    fclose(file);
+    psFree(hist);
+
     return noise;
 }
 
+void convolve(psImage **smoothImage, psImage **smoothMask, psImage **smoothVariance, psKernel **smoothCovar,
+              const psImage *image, const psImage *mask, const psImage *variance, const psKernel *covar,
+              const psKernel *kernel)
+{
+    psKernel *kernel2 = psKernelAlloc(kernel->xMin, kernel->xMax, kernel->yMin, kernel->yMax);
+    double sum = 0.0, sum2 = 0.0;
+    for (int y = kernel->yMin; y <= kernel->yMax; y++) {
+        for (int x = kernel->xMin; x <= kernel->xMax; x++) {
+            sum += kernel->kernel[y][x];
+            sum2 += kernel2->kernel[y][x] = PS_SQR(kernel->kernel[y][x]);
+        }
+    }
+    for (int y = kernel->yMin; y <= kernel->yMax; y++) {
+        for (int x = kernel->xMin; x <= kernel->xMax; x++) {
+            kernel2->kernel[y][x] /= sum2;
+        }
+    }
+    *smoothImage = psImageConvolveDirect(NULL, image, kernel);
+    *smoothVariance = psImageConvolveDirect(NULL, variance, kernel2);
+    *smoothCovar = psImageCovarianceCalculate(kernel, covar);
+    *smoothMask = psImageCopy(NULL, mask, PS_TYPE_IMAGE_MASK); // Cheating
+    psFree(kernel2);
+}
+
+
 void phot(psImage *image, psImage *mask, psImage *variance, psKernel *covar)
 {
+#if 1
     psImage *smoothImage = psImageCopy(NULL, image, PS_TYPE_F32);
+    psImage *smoothVariance = psImageCopy(NULL, variance, PS_TYPE_F32);
     psImageSmoothMask(smoothImage, smoothImage, mask, 0xFF, SMOOTH_SIGMA, SMOOTH_N_SIGMA, 0.1);
-    psImage *smoothVariance = psImageCopy(NULL, variance, PS_TYPE_F32);
     psImageSmoothMask(smoothVariance, smoothVariance, mask, 0xFF,
-                      SMOOTH_SIGMA * M_SQRT1_2, SMOOTH_N_SIGMA, 0.1);
+                      SMOOTH_SIGMA * M_SQRT1_2, SMOOTH_N_SIGMA / M_SQRT1_2, 0.1);
     int extent = SMOOTH_SIGMA * SMOOTH_N_SIGMA + 0.5;
     psImage *smoothMask = psImageConvolveMask(NULL, mask, 0xFF, 0xFF, -extent, extent, -extent, extent);
@@ -118,4 +179,25 @@
     psFree(kernel);
     psImageCovarianceTransfer(smoothVariance, smoothCovar);
+#else
+    psKernel *kernel = psImageSmoothKernel(SMOOTH_SIGMA, SMOOTH_N_SIGMA); // Kernel used for smoothing
+    psKernel *kernel2 = psKernelAlloc(kernel->xMin, kernel->xMax, kernel->yMin, kernel->yMax);
+    double sum = 0.0, sum2 = 0.0;
+    for (int y = kernel->yMin; y <= kernel->yMax; y++) {
+        for (int x = kernel->xMin; x <= kernel->xMax; x++) {
+            sum += kernel->kernel[y][x];
+            sum2 += kernel2->kernel[y][x] = PS_SQR(kernel->kernel[y][x]);
+        }
+    }
+    fprintf(stderr, "Kernel sum: %f %f\n", sum, sum2);
+    for (int y = kernel->yMin; y <= kernel->yMax; y++) {
+        for (int x = kernel->xMin; x <= kernel->xMax; x++) {
+            kernel2->kernel[y][x] /= sum2;
+        }
+    }
+    psImage *smoothImage = psImageConvolveDirect(NULL, image, kernel);
+    psImage *smoothVariance = psImageConvolveDirect(NULL, variance, kernel2);
+    psKernel *smoothCovar = psImageCovarianceCalculate(kernel, covar);
+    psImage *smoothMask = psImageCopy(NULL, mask, PS_TYPE_IMAGE_MASK);
+#endif
 
     fprintf(stderr, "Phot: S/N: %f Covar: %f Var: %f\n",
@@ -200,31 +282,52 @@
     float xOffset = psRandomUniform(rng) * 2 * OFFSET - OFFSET;
     float yOffset = psRandomUniform(rng) * 2 * OFFSET - OFFSET;
-    for (int y = 0; y < SKY_SIZE; y++) {
-        for (int x = 0; x < SKY_SIZE; x++) {
-            float xIn = SCALE * ((x - SKY_SIZE/2) * cos(ROT) + (y - SKY_SIZE/2) * sin(ROT)) + DET_SIZE / 2 + xOffset;
-            float yIn = SCALE * ((x - SKY_SIZE/2) * -sin(ROT) + (y - SKY_SIZE/2) * cos(ROT)) + DET_SIZE / 2 + yOffset;
-
-            double img, var;
-            psImageMaskType msk;
+    for (int y = 0, index = 0; y < SKY_SIZE; y++) {
+        float dy = y - SKY_SIZE/2;
+        for (int x = 0; x < SKY_SIZE; x++, index++) {
+            float dx = x - SKY_SIZE/2;
+            float xIn = SCALE * (dx * cos(ROT) + dy * sin(ROT)) + DET_SIZE / 2 + xOffset;
+            float yIn = SCALE * (dx * -sin(ROT) + dy * cos(ROT)) + DET_SIZE / 2 + yOffset;
+
+#if 0
+            xIn += 0.12345e-6 * PS_SQR(dx);
+            yIn += 0.12345e-6 * PS_SQR(dy);
+#endif
+
+            double img = NAN, var = NAN;
+            psImageMaskType msk = 0;
             psImageInterpolate(&img, &var, &msk, xIn, yIn, interp);
 
             (*outImage)->data.F32[y][x] = img;
             (*outVariance)->data.F32[y][x] = var;
-            (*outMask)->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = isfinite(img) || isfinite(var) ? msk : 0xFF;
-        }
-    }
-
-    psArray *covariances = psArrayAlloc(1000);
-    for (int i = 0; i < covariances->n; i++) {
+            (*outMask)->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = isfinite(img) && isfinite(var) ? msk : 0xFF;
+        }
+    }
+
+    psArray *covariances = psArrayAlloc(WARP_NUM);
+    psVector *factors = psVectorAlloc(WARP_NUM, PS_TYPE_F32);
+    double mean = 0.0;
+    for (int i = 0; i < WARP_NUM; i++) {
         psKernel *kernel = psImageInterpolationKernel(psRandomUniform(rng), psRandomUniform(rng),
                                                       INTERPOLATION);
-        covariances->data[i] = psImageCovarianceCalculate(kernel, inCovar);
+        psKernel *covar = covariances->data[i] = psImageCovarianceCalculate(kernel, inCovar);
         psFree(kernel);
+        mean += factors->data.F32[i] = psImageCovarianceFactor(covar);
     }
     psFree(rng);
     psKernel *avgCovar = psImageCovarianceAverage(covariances);
     psFree(covariances);
+
     *outCovar = psImageCovarianceScale(avgCovar, SCALE);
     psFree(avgCovar);
+
+    mean /= WARP_NUM;
+
+    double stdev = 0.0;
+    for (int i = 0; i < WARP_NUM; i++) {
+        stdev += PS_SQR(factors->data.F32[i] - mean);
+    }
+    stdev = sqrt(stdev/(WARP_NUM-1));
+    fprintf(stderr, "Warp covariance mean: %f stdev: %f\n", mean, stdev);
+    psFree(factors);
 }
 
@@ -265,5 +368,18 @@
 #endif
 
-        psImageCovarianceTransfer(inVariance, inCovar);
+        //        psImageCovarianceTransfer(inVariance, inCovar);
+
+        {
+            psString imageName = NULL, maskName = NULL, varName = NULL;
+            psStringAppend(&imageName, "input.image.%d.fits", i);
+            psStringAppend(&maskName, "input.mask.%d.fits", i);
+            psStringAppend(&varName, "input.var.%d.fits", i);
+            writeImage(inImage, imageName);
+            writeImage(inMask, maskName);
+            writeImage(inVariance, varName);
+            psFree(imageName);
+            psFree(maskName);
+            psFree(varName);
+        }
 
         fprintf(stderr, "Input image %d: S/N: %f Covar: %f Var: %f\n",
@@ -272,4 +388,6 @@
                 psImageCovarianceFactor(inCovar),
                 meanVar(inVariance, inMask, inCovar));
+
+        phot(inImage, inMask, inVariance, inCovar);
 
         psImage *warpImage = NULL, *warpMask = NULL, *warpVariance = NULL;
@@ -281,5 +399,21 @@
         psFree(inCovar);
 
-        psImageCovarianceTransfer(warpVariance, warpCovar);
+        //        psImageCovarianceTransfer(warpVariance, warpCovar);
+
+        {
+            psString imageName = NULL, maskName = NULL, varName = NULL, covarName = NULL;
+            psStringAppend(&imageName, "warp.image.%d.fits", i);
+            psStringAppend(&maskName, "warp.mask.%d.fits", i);
+            psStringAppend(&varName, "warp.var.%d.fits", i);
+            psStringAppend(&covarName, "warp.covar.%d.fits", i);
+            writeImage(warpImage, imageName);
+            writeImage(warpMask, maskName);
+            writeImage(warpVariance, varName);
+            writeImage(warpCovar->image, covarName);
+            psFree(imageName);
+            psFree(maskName);
+            psFree(varName);
+            psFree(covarName);
+        }
 
         fprintf(stderr, "Warp image %d: S/N: %f Covar: %f Var: %f\n",
@@ -300,4 +434,21 @@
         pmReadoutReadSubtractionKernels(ro, fits);
         pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, ro->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL);
+#if 0
+        for (int i = 0; i < kernels->num; i++) {
+            for (int y = 0, index = i; y < kernels->spatialOrder; y++) {
+                for (int x = 0; x < kernels->spatialOrder - y; x++, index++) {
+                    if (x != 0 && y != 0) {
+                        if (kernels->solution1) {
+                            kernels->solution1->data.F64[index] = 0.0;
+                        }
+                        if (kernels->solution2) {
+                            kernels->solution2->data.F64[index] = 0.0;
+                        }
+                    }
+                }
+            }
+        }
+#endif
+
         kernels->xMax = SKY_SIZE;
         kernels->yMax = SKY_SIZE;
@@ -305,15 +456,41 @@
 
         pmReadout *conv = pmReadoutAlloc(NULL);
+#if 1
         conv->image = psImageAlloc(SKY_SIZE, SKY_SIZE, PS_TYPE_F32);
         conv->mask = psImageAlloc(SKY_SIZE, SKY_SIZE, PS_TYPE_IMAGE_MASK);
         conv->variance = psImageAlloc(SKY_SIZE, SKY_SIZE, PS_TYPE_F32);
-        if (!pmSubtractionMatchPrecalc(NULL, conv, NULL, ro, ro->analysis, 32, 0.0, 0.001,
+        if (!pmSubtractionMatchPrecalc(NULL, conv, NULL, ro, ro->analysis, 32, 0.0, 0.01,
                                        0xFF, 0xF0, 0x0F, 0.1, 1.0)) {
             psErrorStackPrint(stderr, "Error:");
             exit(1);
         }
+#else
+        {
+            psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0, false);
+            convolve(&conv->image, &conv->mask, &conv->variance, &conv->covariance,
+                     ro->image, ro->mask, ro->variance, ro->covariance,
+                     kernel);
+            psFree(kernel);
+        }
+#endif
         psFree(ro);
 
-        psImageCovarianceTransfer(conv->variance, conv->covariance);
+        //        psImageCovarianceTransfer(conv->variance, conv->covariance);
+
+        {
+            psString imageName = NULL, maskName = NULL, varName = NULL, covarName = NULL;
+            psStringAppend(&imageName, "conv.image.%d.fits", i);
+            psStringAppend(&maskName, "conv.mask.%d.fits", i);
+            psStringAppend(&varName, "conv.var.%d.fits", i);
+            psStringAppend(&covarName, "conv.covar.%d.fits", i);
+            writeImage(conv->image, imageName);
+            writeImage(conv->mask, maskName);
+            writeImage(conv->variance, varName);
+            writeImage(conv->covariance->image, covarName);
+            psFree(imageName);
+            psFree(maskName);
+            psFree(varName);
+            psFree(covarName);
+        }
 
         fprintf(stderr, "Conv Image %d: S/N: %f Covar: %f Var: %f\n",
@@ -325,4 +502,5 @@
         phot(conv->image, conv->mask, conv->variance, conv->covariance);
         readouts->data[i] = conv;
+
     }
 
@@ -340,4 +518,6 @@
                 psImageCovarianceFactor(diffCovar),
                 meanVar(diffVariance, diffMask, diffCovar));
+
+        phot(diffImage, diffMask, diffVariance, diffCovar);
 
         writeImage(diffImage, "wwdiff.image.fits");
@@ -444,4 +624,6 @@
                 meanVar(diffVariance, diffMask, diffCovar));
 
+        phot(diffImage, diffMask, diffVariance, diffCovar);
+
         writeImage(diffImage, "ssdiff.image.fits");
         writeImage(diffMask, "ssdiff.mask.fits");
@@ -536,4 +718,6 @@
                 meanVar(diffVariance, diffMask, diffCovar));
 
+        phot(diffImage, diffMask, diffVariance, diffCovar);
+
         writeImage(diffImage, "wsdiff.image.fits");
         writeImage(diffMask, "wsdiff.mask.fits");
@@ -541,6 +725,4 @@
         writeImage(diffCovar->image, "wsdiff.covar.fits");
 
-        phot(diffImage, diffMask, diffVariance, diffCovar);
-
         psFree(diffImage);
         psFree(diffMask);
Index: /branches/czw_branch/20100519/dbconfig/add.md
===================================================================
--- /branches/czw_branch/20100519/dbconfig/add.md	(revision 28303)
+++ /branches/czw_branch/20100519/dbconfig/add.md	(revision 28304)
@@ -12,4 +12,7 @@
     note            STR     255
     image_only      BOOL    f
+    minidvodb	    BOOL    f
+    minidvodb_group STR	    64
+    minidvodb_name  STR     64
 END
 
@@ -18,4 +21,5 @@
     dtime_addstar   F32     0.0
     path_base	    STR	    255
+    dvodb_path      STR	    255
     fault           S16     0       # Key NOT NULL
 END
@@ -24,3 +28,5 @@
     label           STR    64       # Primary Key
 END
-    
+
+
+
Index: /branches/czw_branch/20100519/dbconfig/changes.txt
===================================================================
--- /branches/czw_branch/20100519/dbconfig/changes.txt	(revision 28303)
+++ /branches/czw_branch/20100519/dbconfig/changes.txt	(revision 28304)
@@ -1712,4 +1712,47 @@
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
+CREATE TABLE pstampWebRequest (
+        num BIGINT AUTO_INCREMENT,
+        PRIMARY KEY(num)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
+-- Version 1.1.68 addition of minidvodb tables and changes to addTables 
+
+-- this modifies addTables
+
+ALTER TABLE addRun ADD COLUMN minidvodb tinyint NOT NULL AFTER image_only;
+ALTER TABLE addRun ADD COLUMN minidvodb_group varchar(64) AFTER minidvodb;
+ALTER TABLE addRun ADD COLUMN minidvodb_name varchar(64) AFTER minidvodb_group;
+
+ALTER TABLE addProcessedExp ADD COLUMN dvodb_path varchar(255) AFTER path_base;
+
+
+-- this adds the new tables 
+
+
+CREATE TABLE minidvodbRun (
+minidvodb_id BIGINT AUTO_INCREMENT,
+                    minidvodb_name VARCHAR(64),
+              minidvodb_group VARCHAR(64) NOT NULL,
+      minidvodb_path VARCHAR(255) NOT NULL,
+      mergedvodb_path VARCHAR(255) NOT NULL,
+       state VARCHAR(64) NOT NULL,
+       creation_date TIMESTAMP,
+       PRIMARY KEY(minidvodb_id), KEY(minidvodb_name), INDEX(minidvodb_id)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
+
+
+CREATE TABLE minidvodbProcessed (
+      minidvodb_id BIGINT,
+      merge_order BIGINT,
+dtime_resort FLOAT,
+dtime_relphot FLOAT,
+dtime_merge FLOAT,
+epoch TIMESTAMP,
+mergedvodb_path VARCHAR(255) NOT NULL,
+fault SMALLINT NOT NULL,
+       KEY(minidvodb_id), CONSTRAINT UNIQUE(minidvodb_id), FOREIGN KEY(minidvodb_id) REFERENCES minidvodbRun (minidvodb_id)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
 
 -- Version 1.1.69
@@ -1733,10 +1776,10 @@
 
 CREATE TABLE stackSummary (
-    stack_id     BIGINT,
+    sass_id     BIGINT,
     projection_cell VARCHAR(64) NOT NULL,
     path_base   VARCHAR(255) NOT NULL,
     PRIMARY KEY(stack_id),
     KEY(projection_cell),
-    FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id)
+    FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id)
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
@@ -1760,2 +1803,3 @@
     FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id)
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
+
Index: /branches/czw_branch/20100519/dbconfig/ipp.m4
===================================================================
--- /branches/czw_branch/20100519/dbconfig/ipp.m4	(revision 28303)
+++ /branches/czw_branch/20100519/dbconfig/ipp.m4	(revision 28304)
@@ -24,4 +24,5 @@
 include(label.md)
 include(magic.md)
+include(minidvodb.md)
 include(calibration.md)
 include(flatcorr.md)
Index: /branches/czw_branch/20100519/dbconfig/minidvodb.md
===================================================================
--- /branches/czw_branch/20100519/dbconfig/minidvodb.md	(revision 28304)
+++ /branches/czw_branch/20100519/dbconfig/minidvodb.md	(revision 28304)
@@ -0,0 +1,20 @@
+minidvodbRun METADATA
+    minidvodb_id    S64    0	     
+    minidvodb_name  STR    64
+    minidvodb_group STR    64
+    minidvodb_path  STR    255
+    mergedvodb_path STR    255
+    state           STR    64
+    creation_date   UTC    0001-01-01T00:00:00Z
+END 
+
+minidvodbProcessed METADATA
+    minidvodb_id    S64    0
+    merge_order     S64    0
+    dtime_resort    F32    0.0
+    dtime_relphot   F32    0.0
+    dtime_merge     F32    0.0
+    epoch           UTC    0001-01-01T00:00:00Z
+    mergedvodb_path STR    255
+    fault	    S16	   0
+END
Index: /branches/czw_branch/20100519/dbconfig/pstamp.md
===================================================================
--- /branches/czw_branch/20100519/dbconfig/pstamp.md	(revision 28303)
+++ /branches/czw_branch/20100519/dbconfig/pstamp.md	(revision 28304)
@@ -59,2 +59,6 @@
     fault       S16         0
 END
+
+pstampWebRequest METADATA
+    num         S64         0    # Primary Key AUTO_INCREMENT
+END
Index: /branches/czw_branch/20100519/dbconfig/stack.md
===================================================================
--- /branches/czw_branch/20100519/dbconfig/stack.md	(revision 28303)
+++ /branches/czw_branch/20100519/dbconfig/stack.md	(revision 28304)
@@ -55,5 +55,5 @@
 
 stackSummary METADATA
-    stack_id	   S64      0       # Primary Key fkey(stack_id) ref stackRun(stack_id)
+    sass_id	   S64      0       # Primary Key fkey(sass_id) ref stackAssociation(sass_id)
     projection_cell  STR	    32	    # Primary Key
     path_base 	   STR	    255
Index: /branches/czw_branch/20100519/ippMonitor/Makefile.in
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/Makefile.in	(revision 28303)
+++ /branches/czw_branch/20100519/ippMonitor/Makefile.in	(revision 28304)
@@ -14,7 +14,7 @@
 PROGRAMS = \
 $(DESTBIN)/skyplot.dvo \
-$(DESTBIN)/getLabels.pl \
-$(DESTBIN)/checkServer.pl \
-$(DESTBIN)/getServerStatus.pl
+$(DESTBIN)/czartool_getLabels.pl \
+$(DESTBIN)/czartool_checkServer.pl \
+$(DESTBIN)/czartool_getServerStatus.pl
 
 RAWSRC = \
@@ -47,5 +47,7 @@
 $(DESTWWW)/skyplot.php \
 $(DESTWWW)/getimage.php \
-$(DESTWWW)/czartool.php \
+$(DESTWWW)/ipp.czartool.dat \
+$(DESTWWW)/czartool_labels.php \
+$(DESTWWW)/czartool_servers.php \
 
 
@@ -140,4 +142,9 @@
 $(DESTWWW)/stackProcessedSkyfile_Images.php \
 $(DESTWWW)/stackFailedSkyfile.php \
+$(DESTWWW)/staticskyRun.php \
+$(DESTWWW)/staticskySummary.php \
+$(DESTWWW)/staticskyInputSkyfile.php \
+$(DESTWWW)/staticskyProcessedSkyfile.php \
+$(DESTWWW)/staticskyFailedSkyfile.php \
 $(DESTWWW)/magicRun.php \
 $(DESTWWW)/magicSummary.php \
Index: /branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d	(revision 28304)
@@ -0,0 +1,26 @@
+TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TITLE Static Sky Processed 
+FILE  staticskyFailedSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+WHERE staticskyInput.sky_id = staticskyResult.sky_id
+WHERE staticskyResult.fault != 0
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
+FIELD staticskyResult.dtime_phot,   7, %.2f,   t(phot)
+FIELD staticskyResult.dtime_script, 7, %.2f,   t(script)
+FIELD staticskyResult.sources,      7, %d,     n(sources)
+FIELD staticskyResult.fault,        7, %d,     fault
+FIELD staticskyResult.quality,      7, %d,     quality
Index: /branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d	(revision 28304)
@@ -0,0 +1,19 @@
+TABLE staticskyInput, staticskyRun, stackRun
+TITLE Static Sky Input Exposures
+FILE  staticskyInputSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
Index: /branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 28304)
@@ -0,0 +1,25 @@
+TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TITLE Static Sky Processed 
+FILE  staticskyProcessedSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+WHERE staticskyInput.sky_id = staticskyResult.sky_id
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
+FIELD staticskyResult.dtime_phot,   7, %.2f,   t(phot)
+FIELD staticskyResult.dtime_script, 7, %.2f,   t(script)
+FIELD staticskyResult.sources,      7, %d,     n(sources)
+FIELD staticskyResult.fault,        7, %d,     fault
+FIELD staticskyResult.quality,      7, %d,     quality
Index: /branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d	(revision 28304)
@@ -0,0 +1,15 @@
+TABLE staticskyRun
+TITLE staticskyRun
+FILE  staticskyRun.php
+MENU  ipp.stack.dat
+
+#        field          size  format  name           show     link to         extras
+FIELD    sky_id,	 5,   %s,     Sky ID
+# FIELD    skycell_id,	 5,   %s,     Skycell ID
+FIELD    label,	 	 5,   %s,     Label
+FIELD    data_group, 	 5,   %s,     Data grp
+FIELD    dist_group,	 5,   %s,     Dist grp
+FIELD    state,		 5,   %s,     State
+
+#FIELD    registered,	 5,   %s,     time registered
+#FIELD    workdir,	10,   %s,     workdir
Index: /branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d	(revision 28304)
@@ -0,0 +1,16 @@
+TABLE staticskyRun
+TITLE Static Sky Summary
+FILE  staticskySummary.php
+MENU  ipp.stack.dat
+
+#     field           size  format  name         show    link to         extras
+FIELD label,    	 15, %s,    label
+FIELD data_group,        10, %s,    data_group
+FIELD workdir,    	 7, %s,     workdir
+FIELD state,    	 7, %s,     state
+FIELD count(state) as n, 7, %d,     count
+
+MODE  summary
+GROUP state
+GROUP label
+GROUP workdir
Index: anches/czw_branch/20100519/ippMonitor/raw/czartool.php
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/czartool.php	(revision 28303)
+++ 	(revision )
@@ -1,315 +1,0 @@
-<?php
-include 'ipp.php';
-include 'site.php';
-
-$ID = checkID ();
-
-// require an explicit project
-if (! $ID['proj']) { projectform ($ID); }
-
-$db = dbconnect($ID['proj']);
-
-if ($ID['menu']) {$myMenu = $ID['menu'];} 
-else {$myMenu = "ipp.imfiles.dat";}
-
-menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
-
-$pass = $ID['pass'];
-$proj = $ID['proj'];
-$menu = $ID['menu'];
-
-$userSelection = $_GET[label];
-
-if ($userSelection == "") {$userSelection = $_POST['state'];}
-if ($userSelection == "") {$userSelection = "new";}
-
-$debug = 0;
-
-$PATH = getenv("PATH");
-putenv("PATH=$BINDIR:$PATH");
-
-$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
-putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
-
-exec("getLabels.pl -s stdscience", $stdsLabels, $status);
-exec("getLabels.pl -s distribution", $distLabels, $status);
-
-if ($debug) {
-    echo "prog returned $status, and output:<br>";
-    for ($i = 0; $i < count($distLabels); $i++) { 
-        echo "$distLabels[$i]<br>";
-    }           
-}
-
-$states=array("full","new","drop","wait");
-$stages=array("chip","cam","fake","warp","stack","diff","magic","destreak","dist");
-$servers=array("addstar", "cleanup", "detrend", "distribution", "pstamp", "publishing", "registration", "replication", "stdscience", "summitcopy");
-$separator = "-----";
-// set up the form
-echo "<form action=\"czartool.php\" method=\"POST\">\n";
-echo "<select name=state >\n";
-echo "<option value=\"none\">Select one...</option>\n";
-echo "<option value=\"none\">$separator</option>\n";
-foreach ($states as &$state) {echo "<option value=\"$state\">'$state' for all labels</option>\n";}
-echo "<option value=\"none\">$separator</option>\n";
-echo "<option value=\"servers\">Check all pantasks servers</option>\n";
-foreach ($servers as &$server) {echo "<option value=\"$server\">Status for '$server' server</option>\n";}
-echo "<option value=\"none\">$separator</option>\n";
-foreach ($stdsLabels as &$label) {echo "<option value=\"$label\">$label</option>\n";}
-
-echo "</select>\n";
-echo "<input type=submit value=Go>\n";
-
-echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
-echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
-echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
-echo "</form>\n";
-
-
-$stateChosen = 0;
-foreach ($states as &$state) {
-
-    if ($userSelection == $state) {
-        showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $state); 
-        $stateChosen=1;
-        break;
-    }
-}
-
-$serverChosen = 0;
-foreach ($servers as &$server) {
-
-    if ($userSelection == $server) {
-        showServerStatus($server); 
-        $serverChosen=1;
-        break;
-    }
-}
-if (!$stateChosen && !$serverChosen) {
-
-    if ($userSelection == "servers") {showAllServerStatus($servers); }// TODO
-    elseif ($userSelection == $separator) {}
-    else { showOneLabel($pass, $proj, $db, $userSelection, $stages, $states);}
-
-}
-menu_end();
-
-###########################################################################
-#
-# Shows the status of the provided pantasks server 
-#
-###########################################################################
-function showServerStatus($server) {
-
-    echo "<p> Status for $server server </p>";
-
-    $results=array();
-    exec("getServerStatus.pl -s $server", $results, $status);
-
-    foreach ($results as &$line) {
-        echo "<pre>\n";
-        echo "$line\n";
-        echo "</pre>\n";
-
-    }
-
-}
-
-###########################################################################
-#
-# Checks the status of all the pantasks servers 
-#
-###########################################################################
-function showAllServerStatus($servers) {
-
-    echo "<p> Status for all pantasks servers </p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "Server");
-    write_header_cell($class, "Alive?");
-    write_header_cell($class, "Scheduler running?");
-    echo "</tr>\n";
-
-    foreach ($servers as &$server) {
-
-        $results=array();
-        exec("checkServer.pl -s $server", $results, $status);
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', "", $server);
-        write_table_cell($class, '%s', "", $results[0]);
-        write_table_cell($class, '%s', "", $results[1]);
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-
-###########################################################################
-#
-# Checks one label and prints results in a table
-#
-###########################################################################
-function showOneLabel($pass, $proj, $db, $label, $stages, $states) {
-
-    echo "<p> Current status for label '$label' (any faults are shown in parentheses) </p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "state");
-    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
-    echo "</tr>\n";
-
-    // write rows
-    foreach ($states as &$state) {
-
-        $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $state;
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', $link, $state);
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"chipRun", $state, "chip"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"camRun", $state, "cam"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"fakeRun", $state, "fake"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"warpRun", $state, "warp"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"stackRun", $state, "stack"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"diffRun", $state, "diff"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"magicRun", $state, "magic"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"magicDSRun", $state, "magicDS"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"distRun", $state, "dist"));
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-###########################################################################
-#
-# Creates table for all labels showing all stages for given 'state'
-#
-###########################################################################
-function showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $selectedState) {
-
-    echo "<p> Current stdscience labels for '$selectedState' (any faults are shown in parentheses)</p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "label");
-    write_header_cell($class, "distributing?");
-    //    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
-    //    echo "<th class=\"$class\"><a href=\"czartool.php\">label</th>\n";
-
-    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
-    //foreach ($stages as &$stage) {
-
-    //  $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stage;
-    // echo "<th class=\"$class\"><a href=\"$link\">$stage</th>\n";
-    // }
-
-    echo "</tr>\n";
-
-    // write rows
-    foreach ($stdsLabels as &$stdsLabel) {
-
-        $distributing = false;
-        foreach ($distLabels as &$distLabel) {
-
-            if ($stdsLabel == $distLabel) { $distributing = true; break;}
-        }
-
-
-        // create link to label summary page for each label
-        $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', $link, $stdsLabel);
-        write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"chipRun", $selectedState, "chip"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"camRun", $selectedState, "cam"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"fakeRun", $selectedState, "fake"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"warpRun", $selectedState, "warp"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"stackRun", $selectedState, "stack"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"diffRun", $selectedState, "diff"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"magicRun", $selectedState, "magic"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"magicDSRun", $selectedState, "magicDS"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"distRun", $selectedState, "dist"));
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-###########################################################################
-#
-# Returns state and fault-count (if new) as a string
-#
-###########################################################################
-function getStateAndFaults($db, $label, $table, $state, $stage) {
-
-    $new = checkLabel($db, $label, $table, $state, $stage);
-
-    if ($state != "new") {return $new;}
-
-    $faults = countFaults($db, $label,$table,$stage);
-
-    if ($faults < 1) {return $new;}
-
-    return $new."(".$faults.")";
-}
-
-###########################################################################
-#
-# Returns count of exposures with this state for this label
-#
-###########################################################################
-function checkLabel($db, $label, $table, $state, $stage) {
-
-    $sql = "SELECT COUNT(state) FROM $table WHERE label LIKE '$label' AND state = '$state'";
-    if ($debug) {echo "$sql<br>";}
-
-    $qry = $db->query($sql);
-    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
-    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
-    return $row[0];
-}
-
-###########################################################################
-#
-# Returns count of faults for this stage and label
-#
-###########################################################################
-function countFaults($db, $label, $table, $stage) {
-
-    $joinTable = 0;
-    $id = $stage."_id";
-
-    if ($stage == "chip") {$joinTable="chipProcessedImfile";}
-    elseif ($stage == "cam") {$joinTable="camProcessedExp";}
-    elseif ($stage == "fake") {$joinTable="fakeProcessedImfile";}
-    elseif ($stage == "warp") {$joinTable="warpSkyfile";}
-    elseif ($stage == "stack") {$joinTable="stackSumSkyfile";}
-    elseif ($stage == "diff") {$joinTable="diffSkyfile";}
-    elseif ($stage == "magic") {$joinTable="magicNodeResult";}
-    elseif ($stage == "magicDS") {$id = "magic_ds_id"; $joinTable="magicDSFile";}
-    elseif ($stage == "dist") {$joinTable="distComponent";}
-    else {return -1;}
-
-    $faultCol =  $joinTable.".fault";
-
-    $sql = "SELECT COUNT(DISTINCT $id) FROM $table JOIN $joinTable USING ($id) WHERE label LIKE '$label' AND $faultCol != 0 AND $table.state = 'new'";
-    if ($debug) {echo "$sql<br>";}
-
-    $qry = $db->query($sql);
-    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
-    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
-    return $row[0];
-}
-?>
-
Index: /branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php	(revision 28304)
@@ -0,0 +1,307 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID ();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+$db = dbconnect($ID['proj']);
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czartool.dat";}
+
+menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+$userSelection = $_GET[selection];
+
+if ($userSelection == "") {$userSelection = $_POST['state'];}
+if ($userSelection == "") {$userSelection = "new";}
+
+$debug = 0;
+
+$PATH = getenv("PATH");
+putenv("PATH=$BINDIR:$PATH");
+
+$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
+putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
+
+exec("czartool_getLabels.pl -s stdscience", $stdsLabels, $status);
+exec("czartool_getLabels.pl -s distribution", $distLabels, $status);
+
+if ($debug) {
+    echo "prog returned $status, and output:<br>";
+    for ($i = 0; $i < count($distLabels); $i++) {
+        echo "$distLabels[$i]<br>";
+    }
+}
+
+$states=array("full","new","drop","wait");
+$stages=array("chip","cam","fake","warp","stack","diff","magic","destreak","dist");
+
+// set up the form
+echo "<form action=\"czartool_labels.php\" method=\"POST\">\n";
+
+echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
+echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
+echo "</form>\n";
+$stateChosen = 0;
+foreach ($states as &$state) {
+
+    if ($userSelection == $state) {
+        showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $state);
+        $stateChosen=1;
+        break;
+    }
+}
+
+if (!$stateChosen) showOneLabel($pass, $proj, $db, $userSelection, $stages, $states);
+
+menu_end();
+
+
+###########################################################################
+#
+# Checks one label and prints results in a table
+#
+###########################################################################
+function showOneLabel($pass, $proj, $db, $label, $stages, $states) {
+
+    echo "<p> Current status for label '$label' (any faults are shown in parentheses) </p>";
+
+    // set up table columns
+    $class = "list";
+    echo "<table class=$class>\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "state");
+    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
+    echo "</tr>\n";
+
+    // write rows
+    foreach ($states as &$state) {
+
+        $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&selection=" . $state;
+        $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj;
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $state);
+
+        $str = "";
+        $anyFaults = false; 
+        $link = "chipProcessedImfile_failure.php?menu=ipp.science.dat&pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $label,"chipRun", $state, "chip", $str, $anyFaults);
+        write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
+
+        $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $label,"camRun", $state, "cam", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"fakeRun", $state, "fake", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"warpRun", $state, "warp", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+        
+        $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"stackRun", $state, "stack", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"diffRun", $state, "diff", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"magicRun", $state, "magic", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"magicDSRun", $state, "magicDS", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+       
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"distRun", $state, "dist", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+
+    echo "<p> - Click on a state to see all labels for that state <br>";
+    echo "- Click on a fault to find logfile </p>";
+}
+
+###########################################################################
+#
+# Creates table for all labels showing all stages for given 'state'
+#
+###########################################################################
+function showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $selectedState) {
+
+    echo "<p> Current stdscience labels for '$selectedState' (any faults are shown in parentheses)</p>";
+
+    // set up table columns
+    $class = "list";
+    //echo "<table class=$class BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"5\">\n";
+    echo "<table class=$class >\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "label");
+    write_header_cell($class, "distributing?");
+    //    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
+    //    echo "<th class=\"$class\"><a href=\"czartool.php\">label</th>\n";
+
+    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
+    //foreach ($stages as &$stage) {
+
+    //  $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stage;
+    // echo "<th class=\"$class\"><a href=\"$link\">$stage</th>\n";
+    // }
+
+    echo "</tr>\n";
+
+    // write rows
+    foreach ($stdsLabels as &$stdsLabel) {
+
+        $distributing = false;
+        foreach ($distLabels as &$distLabel) {
+
+            if ($stdsLabel == $distLabel) { $distributing = true; break;}
+        }
+
+
+        // create link to label summary page for each label
+        $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&selection=" . $stdsLabel;
+        $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj;
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $stdsLabel);
+        write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");
+
+        $str = "";
+        $anyFaults = false; 
+
+        $link = "chipProcessedImfile_failure.php?menu=ipp.science.dat&pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $stdsLabel,"chipRun", $selectedState, "chip", $str, $anyFaults);
+        write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
+
+        $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $stdsLabel,"camRun", $selectedState, "cam", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"fakeRun", $selectedState, "fake", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"warpRun", $selectedState, "warp", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+        
+        $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"stackRun", $selectedState, "stack", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"diffRun", $selectedState, "diff", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"magicRun", $selectedState, "magic", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"magicDSRun", $selectedState, "magicDS", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+       
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"distRun", $selectedState, "dist", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+
+    echo "<p> - Click on a label to see all states for that label (full, new, drop etc)<br>";
+    echo "- Click on a fault to find logfile </p>";
+}
+
+###########################################################################
+#
+# Returns state and fault-count (if new) as a string
+#
+###########################################################################
+function getStateAndFaults($db, $label, $table, $state, $stage, &$str, &$anyFaults) {
+
+    $anyFaults = false;
+
+    $str = checkLabel($db, $label, $table, $state, $stage);
+
+    if ($state == "new") {
+
+        $faults = countFaults($db, $label,$table,$stage);
+
+        if ($faults > 0) {
+
+            $str = $str."(".$faults.")";
+            $anyFaults = true;
+        }
+    }
+}
+
+###########################################################################
+#
+# Returns count of exposures with this state for this label
+#
+###########################################################################
+function checkLabel($db, $label, $table, $state, $stage) {
+
+    $sql = "SELECT COUNT(state) FROM $table WHERE label LIKE '$label' AND state = '$state'";
+    if ($debug) {echo "$sql<br>";}
+
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
+    return $row[0];
+}
+
+###########################################################################
+#
+# Returns count of faults for this stage and label
+#
+###########################################################################
+function countFaults($db, $label, $table, $stage) {
+
+    $joinTable = 0;
+    $id = $stage."_id";
+
+    if ($stage == "chip") {$joinTable="chipProcessedImfile";}
+    elseif ($stage == "cam") {$joinTable="camProcessedExp";}
+    elseif ($stage == "fake") {$joinTable="fakeProcessedImfile";}
+    elseif ($stage == "warp") {$joinTable="warpSkyfile";}
+    elseif ($stage == "stack") {$joinTable="stackSumSkyfile";}
+    elseif ($stage == "diff") {$joinTable="diffSkyfile";}
+    elseif ($stage == "magic") {$joinTable="magicNodeResult";}
+    elseif ($stage == "magicDS") {$id = "magic_ds_id"; $joinTable="magicDSFile";}
+    elseif ($stage == "dist") {$joinTable="distComponent";}
+    else {return -1;}
+
+    $faultCol =  $joinTable.".fault";
+
+    $sql = "SELECT COUNT(DISTINCT $id) FROM $table JOIN $joinTable USING ($id) WHERE label LIKE '$label' AND $faultCol != 0 AND $table.state = 'new'";
+    if ($debug) {echo "$sql<br>";}
+
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
+    return $row[0];
+}
+?>
+
Index: /branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php	(revision 28304)
@@ -0,0 +1,125 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID ();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+$db = dbconnect($ID['proj']);
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czartool.dat";}
+
+menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+$userSelection = $_GET[server];
+
+if ($userSelection == "") {$userSelection = $_POST['state'];}
+if ($userSelection == "") {$userSelection = "new";}
+
+$debug = 0;
+
+$PATH = getenv("PATH");
+putenv("PATH=$BINDIR:$PATH");
+
+$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
+putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
+
+$servers=array(
+        "addstar", 
+        "cleanup", 
+        "detrend", 
+        "distribution", 
+        "pstamp", 
+        "update", 
+        "publishing", 
+        "registration", 
+        "replication", 
+        "stdscience", 
+        "summitcopy");
+
+// set up the form
+echo "<form action=\"czartool_servers.php\" method=\"POST\">\n";
+echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
+echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
+echo "</form>\n";
+
+
+$serverChosen = 0;
+foreach ($servers as &$server) {
+
+    if ($userSelection == $server) {
+        showServerStatus($server);
+        $serverChosen=1;
+        break;
+    }
+}
+if (!$serverChosen) showAllServerStatus($pass, $proj,$servers);
+
+menu_end();
+
+###########################################################################
+#
+# Shows the status of the provided pantasks server 
+#
+###########################################################################
+function showServerStatus($server) {
+
+    echo "<p> Status for $server server </p>";
+
+    $results=array();
+    exec("czartool_getServerStatus.pl -s $server", $results, $status);
+
+    foreach ($results as &$line) {
+        echo "<pre>\n";
+        echo "$line\n";
+        echo "</pre>\n";
+
+    }
+
+}
+
+###########################################################################
+#
+# Checks the status of all the pantasks servers 
+#
+###########################################################################
+function showAllServerStatus($pass, $proj, $servers) {
+
+    echo "<p> Status for all pantasks servers </p>";
+
+    // set up table columns
+    $class = "list";
+    echo "<table class=$class>\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "Server");
+    write_header_cell($class, "Alive?");
+    write_header_cell($class, "Scheduler running?");
+    echo "</tr>\n";
+
+    foreach ($servers as &$server) {
+
+        $link = "czartool_servers.php?pass=" . $pass . "&proj=" . $proj . "&server=" . $server;
+
+        $results=array();
+        exec("czartool_checkServer.pl -s $server", $results, $status);
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $server);
+        write_table_cell($class, '%s', "", $results[0]);
+        write_table_cell($class, '%s', "", $results[1]);
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+    echo "<p> Click on a server to see its current status </p>";
+
+}
+
Index: /branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat	(revision 28304)
@@ -0,0 +1,5 @@
+input     | ipp.imfiles.dat 
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect 	 | link    | Check labels             	  | czartool_labels.php  
+menulink  | menuselect 	 | link    | Check servers             	  | czartool_servers.php                         
Index: /branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat	(revision 28303)
+++ /branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat	(revision 28304)
@@ -21,4 +21,4 @@
 menutop   | menutop      | link    | simple plot - chip           | simplePlot.php
 menutop   | menutop      | link    | simple plot - cam            | simplePlotcam.php
-menutop   | menutop      | link    | czartool                     | czartool.php
+menutop   | menutop      | link    | czartool                     | czartool_labels.php
 
Index: /branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat	(revision 28303)
+++ /branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat	(revision 28304)
@@ -27,2 +27,9 @@
 menulink  | menuselect   | link    | Magic Failed Nodes           | magicFailedNodes.php
 menulink  | menuselect   | link    | Magic Failed Masks           | magicFailedMasks.php
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect   | link    | Static Sky Summary           | staticskySummary.php
+menulink  | menuselect   | link    | Static Sky Run               | staticskyRun.php
+menulink  | menuselect   | link    | Static Sky Input Skyfile     | staticskyInputSkyfile.php
+menulink  | menuselect   | link    | Static Sky Processed Skyfile | staticskyProcessedSkyfile.php
+menulink  | menuselect   | link    | Static Sky Failed Skyfile    | staticskyFailedSkyfile.php
Index: anches/czw_branch/20100519/ippMonitor/scripts/checkServer.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/checkServer.pl	(revision 28303)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $foundStatus = 0;
-my $isRunning = 0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
-    if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
-    if ($line =~ m/Task Staus/) {last;}
-
-}
-
-($foundStatus) ? print "yes\n" : print "no\n";
-($isRunning) ? print "yes\n" : print "no\n";
-
Index: /branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl	(revision 28304)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $foundStatus = 0;
+my $isRunning = 0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
+    if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
+    if ($line =~ m/Task Staus/) {last;}
+
+}
+
+($foundStatus) ? print "yes\n" : print "no\n";
+($isRunning) ? print "yes\n" : print "no\n";
+
Index: /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl	(revision 28304)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $passedHeader=0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/pantasks:\s+(.*)/) {
+  
+        # HACK to get around 'dummy' label in stdscience
+        if ($1 !~ m/.*dummy.*/) {print "$1\n"};
+        $passedHeader=1; 
+        next;
+    }
+
+    if ($passedHeader){print "$line\n";}
+}
Index: /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl	(revision 28304)
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $passedHeader=0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
+    if ($passedHeader){print "$line<br>";}
+}
Index: anches/czw_branch/20100519/ippMonitor/scripts/getLabels.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/getLabels.pl	(revision 28303)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $passedHeader=0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/pantasks:\s+(.*)/) {
-  
-        # HACK to get around 'dummy' label in stdscience
-        if ($1 !~ m/.*dummy.*/) {print "$1\n"};
-        $passedHeader=1; 
-        next;
-    }
-
-    if ($passedHeader){print "$line\n";}
-}
Index: anches/czw_branch/20100519/ippMonitor/scripts/getServerStatus.pl
===================================================================
--- /branches/czw_branch/20100519/ippMonitor/scripts/getServerStatus.pl	(revision 28303)
+++ 	(revision )
@@ -1,18 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $passedHeader=0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
-    if ($passedHeader){print "$line<br>";}
-}
Index: /branches/czw_branch/20100519/ippScripts/Build.PL
===================================================================
--- /branches/czw_branch/20100519/ippScripts/Build.PL	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/Build.PL	(revision 28304)
@@ -62,4 +62,6 @@
         scripts/magic_destreak_cleanup.pl
         scripts/magic_destreak_defineruns.pl
+        scripts/minidvodb_createdb.pl
+        scripts/minidvodb_merge.pl
         scripts/ippdb.pl
         scripts/ipp_cleanup.pl
@@ -107,4 +109,5 @@
         scripts/bundle_detrends.pl
         scripts/ipp_cluster_load_monitor.pl
+        scripts/skycell_jpeg.pl
     )],
     dist_abstract => 'Scripts for running the Pan-STARRS IPP',
Index: /branches/czw_branch/20100519/ippScripts/MANIFEST
===================================================================
--- /branches/czw_branch/20100519/ippScripts/MANIFEST	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/MANIFEST	(revision 28304)
@@ -42,3 +42,4 @@
 scripts/bundle_detrends.pl
 scripts/ipp_cluster_load_monitor.pl
+scripts/skycell_jpeg.pl
 t/00_distribution.t
Index: /branches/czw_branch/20100519/ippScripts/scripts/addstar_run.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/addstar_run.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/addstar_run.pl	(revision 28304)
@@ -37,5 +37,5 @@
 }
 
-my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $image_only, $verbose, $no_update,
+my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
      $no_op, $redirect, $save_temps);
 GetOptions(
@@ -48,4 +48,7 @@
     'reduction=s'       => \$reduction, # Reduction class
     'dvodb|w=s'         => \$dvodb,  # output DVO database
+    'minidvodb_name|w=s'=> \$minidvodb_name,  # miniDVO database name
+    'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group
+    'minidvodb'         => \$minidvodb,  # use minidvodb?
     'image-only'        => \$image_only,   # Print to stdout
     'verbose'           => \$verbose,   # Print to stdout
@@ -58,5 +61,5 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-          -msg => "Required options: --exp_tag --add_id --camera --outroot",
+          -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot",
           -exitval => 3,
           ) unless
@@ -65,6 +68,9 @@
     defined $outroot and
     defined $camroot and
+    defined $dvodb and
     defined $camera;
-
+if ($minidvodb && !defined($minidvodb_group)) {
+		my_die( "missing minidvodb_group", $add_id, 3 );
+	    }
 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 
@@ -98,11 +104,45 @@
 if (defined $dvodb) {
     $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO
-    $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal );
-}
+    $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR);
+}
+
+
+
 
 my $dtime_addstar = 0;
 
+if (defined $dvodbReal) {
+	if ($minidvodb) {
+	    
+	    if (!defined($minidvodb_name)) {
+		#take the active one, if it's not defined on the command line
+		#reverts would have this already set, for example.
+		my $command = "addtool -listminidvodbrun ";
+		$command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group;
+		$command .= " -state 'active' -limit 1";
+		$command .= " -dbname $dbname" if defined $dbname;
+		print $command;
+		my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+		    run(command => $command, verbose => $verbose);
+		&my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success;
+		my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
+		    &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR);
+
+		my $components = parse_md_list($metadata) or
+		    &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR);
+		my $comp = $$components[0];
+		$minidvodb_name = $comp->{minidvodb_name};
+	
+		if (!defined($minidvodb_name)) {
+		    &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR);
+		} 
+		
+	    }
+	    # tack on the minidvodb part to the db.
+	    $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/';
+	    
+	}
 unless ($no_op) {
-    if (defined $dvodbReal) {
+   	    print $dvodbReal;
 
         ## addstar can either save the full set of detections, or just
@@ -142,6 +182,8 @@
 $fpaCommand .= " -path_base $outroot";
 $fpaCommand .= " -dtime_addstar $dtime_addstar";
+$fpaCommand .= " -dvodb_path $dvodbReal" if defined $dvodbReal;
+$fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
 $fpaCommand .= " -dbname $dbname" if defined $dbname;
-
+print $fpaCommand;
 # Add the result into the database
 unless ($no_update) {
@@ -171,6 +213,8 @@
         $command .= " -addprocessedexp";
         $command .= " -fault $exit_code";
+	$command .= " -dvodb_path $dvodbReal" if defined $dvodbReal;
         $command .= " -path_base $outroot" if defined $outroot;
         $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400));
+	$fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
         $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
Index: /branches/czw_branch/20100519/ippScripts/scripts/automate_stacks.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/automate_stacks.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/automate_stacks.pl	(revision 28304)
@@ -20,4 +20,5 @@
 my $stacktool= can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
+my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
 my $mkBTpcontrol = can_run('make_burntool_pcontrol.pl') or (warn "Can't find make_burntool_pcontrol.pl" and $missing_tools = 1);
@@ -59,4 +60,5 @@
 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips);
 my ( $check_stacks, $queue_stacks, $check_diffs, $queue_diffs, $clean_old);
+my ( $check_detrends, $queue_detrends);
 
 GetOptions(
@@ -81,4 +83,6 @@
     'check_stacks'         => \$check_stacks,
     'queue_stacks'         => \$queue_stacks,
+    'check_detrends'          => \$check_detrends,
+    'queue_detrends'          => \$queue_detrends,
     'check_diffs'          => \$check_diffs,
     'queue_diffs'          => \$queue_diffs,
@@ -105,4 +109,6 @@
            --check_stacks         Confirm that stacks can be built.
            --queue_stacks         Issue stacktool commands to queue stacks.
+           --check_detrends       Confirm that detrend verify runs can be built.
+           --queue_detrends       Issue dettool commands to queue detrend verify runs.
            --check_diffs          Confirm that diffs can be done.
            --queue_diffs          Issue difftool commands to queue diffs.
@@ -115,6 +121,6 @@
           ) unless
     defined $check_registration or defined $define_burntool or defined $queue_burntool or
-    defined $queue_chips or defined $queue_stacks or
-    defined $check_chips or defined $check_stacks or
+    defined $queue_chips or defined $queue_stacks or $queue_detrends or
+    defined $check_chips or defined $check_stacks or $check_detrends or
     defined $test_mode or defined $clean_old or defined $check_mode;
 
@@ -128,4 +134,11 @@
 my %stackable_list = ();
 my %reduction_class = ();
+my @detrend_list = ();
+my %dettype_list = ();
+my %exptype_list = ();
+my %refID_list = ();
+my %refIter_list = ();
+my %detfilter_list = ();
+my %detmax_list = ();
 my %clean_commands = ();
 my %clean_retention = ();
@@ -158,7 +171,4 @@
 	}
     }
-#    if (${ $entry }{name} eq 'RETENTION_TIME') {
-#        $retention_time = ${ $entry }{value};
-#    }
     elsif (${ $entry }{name} eq 'FILTERS') {
         push @filter_list, ${ $entry }{value};
@@ -195,8 +205,33 @@
         }
     }
-}
-
-
-
+    elsif (${ $entry }{name} eq 'DETRENDS') {
+	my @detrend_data = @{ ${ $entry }{value} };
+	my $this_detrend = '';
+	foreach my $dentry (@detrend_data) {
+	    if (${ $dentry }{name} eq 'NAME') {
+		$this_detrend = ${ $dentry }{value};
+		push @detrend_list, $this_detrend;
+	    }
+	    elsif (${ $dentry }{name} eq 'DETTYPE') {
+		$dettype_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	    elsif (${ $dentry }{name} eq 'EXPTYPE') {
+		$exptype_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	    elsif (${ $dentry }{name} eq 'REF_ID') {
+		$refID_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	    elsif (${ $dentry }{name} eq 'REF_ITER') {
+		$refIter_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	    elsif (${ $dentry }{name} eq 'FILTER') {
+		$detfilter_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	    elsif (${ $dentry }{name} eq 'MAX') {
+		$detmax_list{$this_detrend} = ${ $dentry }{value};
+	    }
+	}
+    }		
+}
 
 unless(defined($date)) {
@@ -256,4 +291,16 @@
     return_metadata($date);
     unless (defined($test_mode) || defined($check_mode)) { exit(0); }
+}
+if (defined($check_detrends) || defined($test_mode)) {
+    $metadata_out{nsState} = 'CHECKDETRENDS';
+    &execute_detrends($date,"pretend");
+    return_metadata($date);
+    unless (defined($test_mode) || defined($check_mode)) { exit(0); }
+}
+if (defined($queue_detrends)) {
+    $metadata_out{nsState} = 'QUEUEDETRENDS';
+    &execute_detrends($date,"pretend");
+    return_metadata($date);
+    exit(0);
 }
 if (defined($define_burntool) || defined($test_mode)) {
@@ -498,5 +545,5 @@
 
     my $cmd = "$chiptool";
-    $cmd .= ' -simple -dbname gpc1 -definebyquery -set_end_stage warp ';
+    $cmd .= " -simple -dbname $dbname -definebyquery -set_end_stage warp ";
     $cmd .= " -set_label $label ";
     $cmd .= " -set_workdir $workdir -set_dist_group $dist_group ";
@@ -566,4 +613,6 @@
 }
 
+
+
 sub chip_queue {
     my $date = shift;
@@ -612,4 +661,101 @@
 
 #
+# Detrend verification
+################################################################################
+
+sub construct_dettool_cmd {
+    my $date = shift;
+    my $target = shift;
+
+    my ($label,$workdir,$filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN) = get_dettool_parameters($date,$target);
+    
+    my $select = "-select_dateobs_begin ${date}T00:00:00 -select_dateobs_end ${date}T23:59:59 ";
+    $date =~ s/-//g;
+
+    my $cmd = "$dettool";
+    $cmd .= " -pretend ";
+    $cmd .= " -simple -dbname $dbname -definebyquery -det_type $det_type ";
+    $cmd .= " -mode verify -ref_det_id $ref_det_id -ref_iter $ref_iter ";
+    $cmd .= " $select ";
+    $cmd .= " -inst $camera ";
+    $cmd .= " -select_exp_type $exp_type ";
+    $cmd .= " -select_filter $filter " if defined($filter);
+    $cmd .= " -workdir $workdir ";
+    $cmd .= " -label $label ";
+    if ($maxN > 0) {
+	$cmd .= " -random_subset -random_limit $maxN ";
+    }
+    if ($debug == 1) {
+	$cmd .= ' -pretend ';
+    }
+    print STDERR "$cmd\n";
+    return($cmd);
+}    
+
+sub verify_uniqueness_detverify {
+    my $date = shift;
+    my $target = shift;
+
+    my ($label,$workdir,$filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN) = get_dettool_parameters($date,$target);
+    
+    my $db = init_gpc_db();
+    my $sth = "SELECT * FROM detRun WHERE workdir = '$workdir' AND ref_det_id = $ref_det_id AND ref_iter = $ref_iter";
+    my $data_ref = $db->selectall_arrayref( $sth );
+
+    return($#{ $data_ref } + 1);
+}
+
+sub pre_detrend_queue {
+    my $date = shift;
+    my $target = shift;
+    
+    my $command = construct_dettool_cmd($date,$target) . ' -pretend ';
+    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	run ( command => $command, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to perform dettool: $error_code", 0,0, $date, $PS_EXIT_SYS_ERROR);
+    }
+    
+    my @input_exposures = split /\n/, (join '', @$stdout_buf);
+    return($#input_exposures + 1);
+}
+
+sub detrend_queue {
+    my $date = shift;
+    my $target = shift;
+    
+    my $command = construct_dettool_cmd($date,$target);
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	run ( command => $command, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to perform chiptool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR);
+    }
+    $metadata_out{nsState} = 'DETREND_QUEUED';
+    return(0);
+}
+
+sub execute_detrends {
+    my $date = shift;
+    my $pretend = shift;
+    my $exposures = 0;
+    foreach my $target (@detrend_list) {
+	my ($Nexposures) = pre_detrend_queue($date,$target);
+	if ($Nexposures == 0) {
+	    print STDERR "execute_detrends: Target $target on $date had no exposures.\n";
+	    next;
+	}
+	$exposures++;
+	unless(defined($pretend)) {
+	    detrend_queue($date,$target);
+	}
+    }
+    if ($exposures == 0) {
+	$metadata_out{nsState} = 'DETREND_DROP';
+    }
+}
+
+#
 # Stacking
 ################################################################################
@@ -627,5 +773,5 @@
     my $cmd = "$stacktool";
 #    $cmd .= ' -pretend -simple -dbname gpc1 -definebyquery -min_new 4 ';  # Probably silly, but I want to be safe and not overwrite
-    $cmd .= ' -simple -dbname gpc1 -definebyquery ';
+    $cmd .= " -simple -dbname $dbname -definebyquery ";
     $cmd .= " -set_label $label -select_label $label ";
     $cmd .= " -set_workdir $workdir -set_dist_group $dist_group ";
@@ -779,5 +925,5 @@
     my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($cleaning_date,$target);
     my $args = $command;
-    $args .= " -dbname gpc1 -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group ";
+    $args .= " -dbname $dbname -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label $label -data_group $data_group ";
     if ($debug == 1) {
         $args .= ' -pretend ';
@@ -826,5 +972,5 @@
 
     my $label = "${target}.nightlyscience";
-    my $workdir = "neb://\@HOST\@.0/gpc1/${target}.nt/${workdir_date}";
+    my $workdir = "neb://\@HOST\@.0/${dbname}/${target}.nt/${workdir_date}";
     my $obs_mode = $obsmode_list{$target};
     my $object   = $object_list{$target};
@@ -837,4 +983,30 @@
 }
 
+sub get_dettool_parameters {
+    my $date = shift;
+    my $target = shift;
+    my $workdir_date = $date; $workdir_date =~ s%-%/%g;
+    my $trunc_date = $date; $trunc_date =~ s/-//g;
+
+    my $exp_type = $exptype_list{$target};
+    my $det_type = $dettype_list{$target};
+    my $ref_det_id = $refID_list{$target};
+    my $ref_iter = $refIter_list{$target};
+    my $det_filter = $detfilter_list{$target};
+    my $internal_filter;
+    if (defined($det_filter)) {
+	$internal_filter = $det_filter; $internal_filter =~ s/\..*//;
+	$internal_filter = '.' . $internal_filter;
+    }
+    else {
+	$internal_filter = '';
+    }
+    my $maxN = $detmax_list{$target};    
+    
+    my $lc_type = lc($exp_type);
+    my $label = "${lc_type}${internal_filter}.$trunc_date";
+    my $workdir = 'neb://@HOST@.0/' . $dbname . "/detverify.nt/${workdir_date}/${lc_type}${internal_filter}";
+    return($label,$workdir,$det_filter,$exp_type,$det_type,$ref_det_id,$ref_iter,$maxN);
+}
 
 sub init_gpc_db {
Index: /branches/czw_branch/20100519/ippScripts/scripts/diff_skycell.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/diff_skycell.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/diff_skycell.pl	(revision 28304)
@@ -197,4 +197,5 @@
 my $recipe_ppSub = $ipprc->reduction($reduction, 'DIFF_PPSUB'); # Recipe to use for ppSub
 my $recipe_psphot  = $ipprc->reduction($reduction, 'DIFF_PSPHOT'); # Recipe to use for psphot
+my $recipe_ppstats = 'DIFFSTATS';
 unless ($recipe_ppSub and $recipe_psphot) {
     &my_die("Couldn't find selected reduction for DIFF_PPSUB and DIFF_PSPHOT: $reduction\n", $diff_id, $skycell_id, $PS_EXIT_CONFIG_ERROR);
@@ -257,4 +258,6 @@
     $traceDest .= '.update';
     $outputStats .= '.update';
+
+    $recipe_ppstats = 'WARPSTATS';
 }
 
@@ -292,5 +295,5 @@
     $command .= " -recipe PPSUB $recipe_ppSub";
     $command .= " -recipe PSPHOT $recipe_psphot";
-    $command .= " -recipe PPSTATS DIFFSTATS";
+    $command .= " -recipe PPSTATS $recipe_ppstats";
     $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE";
     $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF";
Index: /branches/czw_branch/20100519/ippScripts/scripts/lossy_compress_imfile.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/lossy_compress_imfile.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/lossy_compress_imfile.pl	(revision 28304)
@@ -61,7 +61,7 @@
     defined $state;
 
-my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $PS_EXIT_CONFIG_ERROR );
+my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_CONFIG_ERROR );
 if (defined($logfile)) {
-    $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $PS_EXIT_SYS_ERROR );
+    $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_SYS_ERROR );
 }
 
@@ -87,5 +87,5 @@
 if ($state eq 'goto_compressed') {
     # Find the actual filename for this run:
-    &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
+    &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR)
         unless ($ipprc->file_exists($uri));
     my $uriReal = $ipprc->file_resolve( $uri );
@@ -93,5 +93,5 @@
     # Create a compressed version:
     my $compUri = $uri . ".fz";
-    &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
+    &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR)
         if ($ipprc->file_exists($compUri));
     my $compReal= $ipprc->file_resolve( $compUri, 'create');
@@ -109,5 +109,5 @@
         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         &my_die("Unable to uncompress file: $uri -> $compUri: $error_code",
-                $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
+                $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR);
     }
     my $compress_command = "$fpack -h -s 8 -S $tempReal >  $compReal";
@@ -118,10 +118,10 @@
         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         &my_die("Unable to compress file: $uri -> $compUri: $error_code",
-                $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
+                $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR);
     }
     my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state compressed";
     $database_command .= " -dbname $dbname" if defined $dbname;
 
-    &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$PS_EXIT_SYS_ERROR)
+    &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$state, $PS_EXIT_SYS_ERROR)
         unless ($ipprc->file_exists($compUri));
 
@@ -135,5 +135,5 @@
             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
             &my_die("Unable to update database file: $uri -> $compUri: $error_code",
-                    $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
+                    $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR);
         }
     }
@@ -149,5 +149,5 @@
 if ($state eq 'goto_lossy') {
     # Confirm we have both files
-    &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
+    &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR)
         unless($ipprc->file_exists($uri));
     my $uriReal = $ipprc->file_resolve( $uri );
@@ -156,5 +156,5 @@
     unless($ipprc->file_exists($compUri)) {
         &my_die("Couldn't find compressed version of the file: $compUri\n",
-                $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
+                $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR);
 
         # If that die is removed, this will compress things as well.
@@ -185,5 +185,5 @@
         $neb->swap($uri,$compUri) or
             &my_die("Nebulous swap failed between $uri and $compUri",
-                    $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
+                    $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR);
     }
     # Update database
@@ -204,7 +204,7 @@
             $neb->swap($uri,$compUri) or
                 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri",
-                        $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
+                        $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR);
             &my_die("Unable to update database file: $uri -> $compUri: $error_code",
-                    $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
+                    $exp_id,$exp_name,$class_id,$uri, $state,$PS_EXIT_SYS_ERROR);
         }
         # remove original version
@@ -224,6 +224,16 @@
     my $class_id = shift; # Class identifier
     my $uri = shift; # uri for the file
+    my $state = shift;
     my $exit_code = shift; # Exit code
     # outputImage and path_base are globals
+    my $fail_state = $state;
+    $fail_state =~ s/goto_/error_/;
+    my $error_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state $fail_state ";
+    $error_command .= " -dbname $dbname" if defined $dbname;
+    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
+	run(command => $error_command, verbose => $verbose);
+    unless($success) {
+	warn("Failed at setting the error state too.");
+    }
 
     $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
Index: /branches/czw_branch/20100519/ippScripts/scripts/magic_process.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/magic_process.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/magic_process.pl	(revision 28304)
@@ -151,5 +151,5 @@
 
             my $kernel = $ipprc->filename("PPSUB.OUTPUT.KERNELS", $diff_base); # Name of kernel file
-            &my_die("Unable to find kernel file", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel);
+            &my_die("Unable to find kernel file $kernel", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel);
 
             my ($image, $mask);   # Image and mask
@@ -191,5 +191,5 @@
 
             {
-                &my_die("Unable to find image and mask", $magic_id, $node, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image) and $ipprc->file_exists($mask);
+                &my_die("Unable to find image and mask: $image $mask", $magic_id, $node, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image) and $ipprc->file_exists($mask);
 
                 my $command = "$ppSubConvolve $tempPath -image $image -mask $mask -kernel $kernel";
@@ -204,5 +204,5 @@
                 $template = $ipprc->filename("PPSUB.INPUT.CONV", $tempPath) or &my_die("Unable to determine filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR);
                 $template = $ipprc->file_resolve($template) or &my_die("Unable to resolve filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to find created template", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template);
+                &my_die("Unable to find created template: $template", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template);
             }
         }
Index: /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_createdb.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_createdb.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_createdb.pl	(revision 28304)
@@ -0,0 +1,255 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+use Carp;
+use DateTime;
+
+use DateTime::Format::Strptime;
+use DateTime::Duration;
+## report the program and machine
+use Sys::Hostname;
+my $host = hostname();
+my $date = `date`;
+print "\n\n";
+print "Starting script $0 on $host at $date\n\n";
+
+
+my $mjd_start = DateTime->now->mjd;   # MJD of starting script
+
+use vars qw( $VERSION );
+$VERSION = '0.01';
+
+use IPC::Cmd 0.36 qw( can_run run );
+use PS::IPP::Metadata::Config;
+use PS::IPP::Metadata::List qw( parse_md_list );
+use PS::IPP::Config 1.01 qw( :standard );
+use File::Temp qw( tempfile );
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+# Look for programs we need
+my $missing_tools;
+my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1);
+my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
+if ($missing_tools) {
+    warn("Can't find required tools.");
+    exit($PS_EXIT_CONFIG_ERROR);
+}
+
+my (  $outroot, $dbname, $dvodb,$minidvodb_interval, $minidvodb_group, $camera,  $verbose, $no_update,
+     $no_op, $redirect, $save_temps);
+GetOptions(    
+    'camera|c=s'        => \$camera, # Camera
+    'dbname|d=s'        => \$dbname, # Database name
+    'minidvodb_group|w=s'       => \$minidvodb_group, # minidvodb_group.
+    'outroot|w=s'       => \$outroot, # output file base name
+    'dvodb|w=s'         => \$dvodb,  # output DVO database
+    'interval|w=s'      => \$minidvodb_interval, #interval between creation of minidvodbs (default = 1day)
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update, # Update the database?
+    'no-op'             => \$no_op, # Don't do any operations?
+    'redirect-output'   => \$redirect,
+    'save-temps'        => \$save_temps, # Save temporary files?
+    ) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+          -msg => "Required options: --camera  --dvodb --minidvodb_group  --outroot",
+          -exitval => 3,
+          ) unless
+    defined $minidvodb_group and
+    defined $camera and 
+    defined $outroot and
+    defined $dvodb;
+
+my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $minidvodb_group   , $PS_EXIT_CONFIG_ERROR ); # IPP configuration
+
+my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $minidvodb_group, $PS_EXIT_CONFIG_ERROR);
+
+if ($redirect) {
+    $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $minidvodb_group, $PS_EXIT_SYS_ERROR );
+    print "\n\n";
+    print "Starting script $0 on $host\n\n";
+    print "COMMAND IS: @ARGV\n\n";
+}
+
+
+# Recipes to use based on reduction class
+
+# XXX This is now not used: do we still need it?
+
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
+
+# Output products
+$ipprc->outroot_prepare($outroot);
+
+# the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
+ my $create_new = 0;
+# convert supplied DVO database name to UNIX filename
+my $dvodbReal;
+if (defined $dvodb) {
+    $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO
+    $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal );
+} else {
+    warn("dvodb undefined:\n");
+    exit(4);
+}
+
+if (!defined $minidvodb_interval) {
+    $minidvodb_interval = 1;
+}
+
+
+unless ($no_op) {
+    
+  
+
+#see if there is already one in new state
+    my $fpaCommand1 = "$addtool -listminidvodbrun";
+    $fpaCommand1 .= " -minidvodb_group '$minidvodb_group'";
+    $fpaCommand1 .= " -state 'new'";
+    $fpaCommand1 .= " -dbname $dbname" if defined $dbname;
+
+    
+unless ($no_update) {
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $fpaCommand1, verbose => $verbose);
+    
+
+
+   unless ($success) {
+       $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+       warn("Unable to list minidvodb database: $error_code\n");
+       exit($error_code);
+    }
+   
+    if (scalar(@{$stdout_buf})) {
+	$error_code = 3;
+	    warn("Unwilling to create minidvodb, one already exists in new state: $error_code\n");
+        exit($error_code);
+    }
+
+    my $creation_date;
+    my $addRun_count;
+    my $minidvodb_name;
+#find the active one's date, and find out if it has more than 1 addRun in it   
+    
+    my $fpaCommand2 = "$addtool -listminidvodbrun";
+    $fpaCommand2 .= " -minidvodb_group '$minidvodb_group'";
+    $fpaCommand2 .= " -state 'active'";
+    $fpaCommand2 .= " -limit 1";
+     $fpaCommand2 .= " -dbname $dbname" if defined $dbname;
+
+#print $fpaCommand2;
+
+    
+    my ( $success2, $error_code2, $full_buf2, $stdout_buf2, $stderr_buf2 ) =
+	run(command => $fpaCommand2, verbose => $verbose);
+    &my_die( "Unable to get listminidvodbrun",$minidvodb_group, $PS_EXIT_SYS_ERROR) unless $success2;
+  # if it didn't list something in active state (what?) then we definitely need to create a new one
+    if (defined(@$stdout_buf2)) {
+  my  $metadata2 = $mdcParser->parse(join "", @$stdout_buf2) or
+	&my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    
+  my   $components2 = parse_md_list($metadata2) or
+	&my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+  my   $comp2 = $$components2[0];
+    $minidvodb_name = $comp2->{minidvodb_name};
+    $creation_date  = $comp2->{creation_date};
+    if (!defined($minidvodb_name)) {
+	&my_die("Unable to parse minidvodb_name", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    } 
+    if (!defined($creation_date)) {
+	&my_die("Unable to parse creation_date", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    } 
+    } else { 
+	$create_new = 1; #this is to force it to make a new one
+	    }
+
+    #find the number of add_ids that have been proccessed
+    my $fpaCommand3 = "$addtool -checkminidvodbrunaddrun";
+    $fpaCommand3 .= " -minidvodb_group '$minidvodb_group'";
+    $fpaCommand3 .= " -state 'active'";
+    $fpaCommand3 .= " -minidvodb_name '$minidvodb_name'" if defined $minidvodb_name;
+    $fpaCommand3 .= " -limit 1";
+    $fpaCommand3 .= " -dbname $dbname" if defined $dbname;
+
+   
+my ( $success3, $error_code3, $full_buf3, $stdout_buf3, $stderr_buf3 ) =
+	run(command => $fpaCommand3, verbose => $verbose);
+    &my_die( "Unable to get checkminidvodbunaddrun", $minidvodb_group, $PS_EXIT_SYS_ERROR) unless $success3;
+   
+    if (defined(@$stdout_buf3)) {  #checkminidvodb returns nothing IF there have been no addruns added to the db yet
+    my  $metadata3 = $mdcParser->parse(join "", @$stdout_buf3) or
+	&my_die("Unable to parse metadata config", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+    
+    my  $components3 = parse_md_list($metadata3) or
+	&my_die("Unable to parse metadata list", $minidvodb_group, $PS_EXIT_PROG_ERROR);
+   my  $comp = $$components3[0];
+    $addRun_count = $comp->{addRun_count};
+	} 
+    if (!defined($addRun_count)) {
+	 ## there's nothing to parse if there's nothing
+        $addRun_count = 0;
+    } 
+    
+
+    if ($addRun_count > 30000) {
+	#it's too big, create_new 
+        $create_new = 1;
+   }
+    if ($create_new == 0) {
+	my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M:%S', time_zone => "HST" );
+	my $creation_dt = $parser->parse_datetime( $creation_date )->mjd;
+	if ($mjd_start- $creation_dt > $minidvodb_interval && $addRun_count > 0 ) {
+	    #db is old and has stuff in it, want to create_new 
+	    $create_new = 1;
+	}
+    }
+    
+    
+}
+#create the minidvodb entry (well, the command for it)
+    my $fpaCommand = "$addtool -addminidvodbrun";
+    $fpaCommand .= " -set_minidvodb_group $minidvodb_group";
+    $fpaCommand .= " -set_mergedvodb_path $dvodbReal";
+    $fpaCommand .= " -dbname $dbname" if defined $dbname;
+    
+    unless ($no_update or !$create_new) {
+
+
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $fpaCommand, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    warn("Unable to add result to database: $error_code\n");
+	    exit($error_code);
+	}
+    } else {
+	print "skipping command: $fpaCommand\n";
+    }
+}
+
+sub my_die
+{#complain if it doesn't work
+    my $msg = shift; # Warning message on die
+    my $minidvodb_group = shift; # Camtool identifier
+    my $exit_code = shift; # Exit code to add
+    
+    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
+    
+    carp($msg);
+    
+    exit $exit_code;
+}
+
+END {
+    my $status = $?;
+    system("sync") == 0
+        or die "failed to execute sync: $!" ;
+    $? = $status;
+}
+
+__END__
Index: /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_merge.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_merge.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippScripts/scripts/minidvodb_merge.pl	(revision 28304)
@@ -0,0 +1,254 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+use Carp;
+ 
+## report the program and machine
+use Sys::Hostname;
+my $host = hostname();
+print "\n\n";
+print "Starting script $0 on $host\n\n";
+
+use DateTime;
+my $mjd_start = DateTime->now->mjd;   # MJD of starting script
+my $dtime_resort;
+my $dtime_relphot;
+my $dtime_merge;
+
+use vars qw( $VERSION );
+$VERSION = '0.01';
+
+use IPC::Cmd 0.36 qw( can_run run );
+use PS::IPP::Metadata::Config;
+use PS::IPP::Metadata::List qw( parse_md_list );
+use PS::IPP::Config 1.01 qw( :standard );
+use File::Temp qw( tempfile );
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+# Look for programs we need
+my $missing_tools;
+my $dvomerge = can_run('dvomerge') or (warn "Can't find dvomerge" and $missing_tools = 1);
+my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1);
+my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
+my $relphot = can_run('relphot') or (warn "Can't find relphot" and $missing_tools = 1);
+my $relastro = can_run('relastro') or (warn "Can't find relastro" and $missing_tools = 1);
+if ($missing_tools) {
+    warn("Can't find required tools.");
+    exit($PS_EXIT_CONFIG_ERROR);
+}
+
+my ( $mergedvodb, $minidvodb, $minidvodb_id, $minidvodb_group, $camera, $dbname,$verbose, $logfile, $no_op, $redirect, $save_temps);
+GetOptions(
+    'mergedvodb|w=s'         => \$mergedvodb,  # output DVO database
+    'minidvodb|w=s'     => \$minidvodb, #minidvodb database
+    'minidvodb_id|w=s'  => \$minidvodb_id, #minidvodb_id
+ 'minidvodb_group|w=s'  => \$minidvodb_group, #minidvodb_id
+    'camera|c=s'        => \$camera, # Camera
+    'dbname|d=s'        => \$dbname, # Database name
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-op'             => \$no_op, # Don't do any operations?
+    'logfile=s'         => \$logfile,
+    'save-temps'        => \$save_temps, # Save temporary files?
+    ) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+          -msg => "Required options: --mergedvodb --minidvodb --minidvodb_id -- minidvodb_group --camera",
+          -exitval => 3,
+          ) unless
+    defined $mergedvodb and
+    defined $minidvodb and
+    defined $minidvodb_id and
+    defined $minidvodb_group and
+    defined $camera;
+
+my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $mergedvodb, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
+
+if ($logfile) {
+    $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $mergedvodb, $PS_EXIT_SYS_ERROR );
+    print "\n\n";
+    print "Starting script $0 on $host\n\n";
+    print "COMMAND IS: @ARGV\n\n";
+}
+
+# convert supplied DVO database name to UNIX filename
+my $mergedvodbReal;
+if (defined $mergedvodb) {
+    $mergedvodbReal = $ipprc->dvo_catdir( $mergedvodb ); # catdir for DVO
+    $mergedvodbReal = $ipprc->convert_filename_absolute( $mergedvodbReal );
+}
+
+my $dtime_addstar = 0;
+#my $dtime_relphot = 0;
+
+unless ($no_op) {
+    if (defined $mergedvodbReal) {
+        {
+            my $command  = "$addstar -resort";
+            $command .= " -D CAMERA $camera";
+            $command .= " -D CATDIR $minidvodb";
+
+            my $mjd_addstar_start = DateTime->now->mjd;   # MJD of starting script
+	    print "\n$command\n";
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $verbose);
+            unless ($success) {
+                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                &my_die("Unable to perform addstar: $error_code", $mergedvodb, $error_code);
+            }
+            $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start);  $dtime_resort = $dtime_addstar;
+            # MJD of starting script
+	    $dtime_resort = $dtime_addstar;
+            print "addstar -resort time $dtime_addstar\n";
+        }
+
+        {
+            # relphot only takes lower case gpc1
+            my $relphot_camera = lc($camera);
+            my $command  = "$relphot -averages -update";
+            $command .= " -D CAMERA $relphot_camera";
+            $command .= " -D CATDIR $minidvodb";
+	    print "$command\n";
+            my $mjd_relphot_start = DateTime->now->mjd;   # MJD of starting script
+
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $verbose);
+            unless ($success) {
+                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                &my_die("Unable to perform relphot: $error_code", $mergedvodb, $error_code);
+            }
+            $dtime_relphot = 86400.0*(DateTime->now->mjd - $mjd_relphot_start);   # MJD of starting script
+            print "relphot time $dtime_relphot\n";
+        }
+
+        my $this_is_the_first;
+        {
+
+            my $mdcParser = PS::IPP::Metadata::Config->new;
+
+            my $command = "$addtool -listminidvodbrun -state merged -minidvodb_group " . $minidvodb_group;
+            $command .= " -dbname $dbname" if defined $dbname;
+
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                    run(command => $command, verbose => $verbose);
+            &my_die( "Unable to get list of minidvodbruns", $minidvodb_id, $PS_EXIT_SYS_ERROR) unless $success;
+            if (scalar @$stdout_buf == 0 ) { #it lists nothing if it is the first
+                $this_is_the_first =1;
+		print "listing nothing\n";
+            } else {
+                my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
+                    &my_die("Unable to parse metadata config", $minidvodb_id, $PS_EXIT_PROG_ERROR);
+                #this fails if there is nothing listed. I checked.
+                my $components = parse_md_list($metadata) or
+                    &my_die("Unable to parse metadata list", $minidvodb_id, $PS_EXIT_PROG_ERROR);
+                my $comp = $$components[0];
+                my  $minidvodb_name = $comp->{minidvodb_name};
+
+                if (!defined($minidvodb_name)) {
+                    &my_die("Unable to parse minidvodb_name", $minidvodb_id, $PS_EXIT_PROG_ERROR);
+                } #but just to make sure, have it grab a minidvodb_name, to make sure it's not junk.
+		print "found at least 1 minidvodbrun in merged state\n";
+                $this_is_the_first = 0;
+            }
+        }
+	print "$this_is_the_first $mergedvodb/Image.dat\n";
+	
+	 
+	if (-e "$mergedvodb/Image.dat") {
+	    if ($this_is_the_first == 1) {
+		&my_die("refusing to merge, this is the first, but files already exist in dir", $minidvodb_id, 4);
+	    }
+	    $this_is_the_first =0;
+	}
+	
+	print "$this_is_the_first $mergedvodb/Image.dat\n";
+        {
+            my $merge_command;
+	    my $mjd_merge_start = DateTime->now->mjd;   # MJD of starting script
+            if ($this_is_the_first) {
+		
+		$merge_command = "cp -rp $minidvodb/* $mergedvodb";
+	    } else {
+                $merge_command = "$dvomerge $minidvodb into $mergedvodb";
+	    }
+	    
+	    print "\n$merge_command\n";
+	    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+		run(command => $merge_command, verbose => $verbose);
+	    unless ($success) {
+		    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+		    &my_die("Unable to merge: $error_code", $mergedvodb, $error_code);
+	    }
+		
+	    $dtime_merge = 86400.0*(DateTime->now->mjd - $mjd_merge_start);   # MJD of starting script
+	    print "merge time $dtime_merge\n";
+#	}
+	}
+
+	{
+            my $command = "addtool -minidvodb_id $minidvodb_id";
+            $command .= " -addminidvodbprocessed";
+            $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal;
+            $command .= " -minidvodb_group $minidvodb_group";
+            $command .= " -dtime_relphot $dtime_relphot"  if defined $dtime_relphot;
+            $command .= " -dtime_resort $dtime_resort" if defined $dtime_resort;
+            $command .= " -dtime_merge $dtime_merge" if defined $dtime_merge;
+            $command .= " -dbname $dbname" if defined $dbname;
+            #print $command;
+
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $verbose);
+            unless ($success) {
+                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                &my_die("Unable to add to minidvodbprocessed: $error_code", $mergedvodb, $error_code);
+            }
+        }
+
+    } else {
+        &my_die("dvodb: $mergedvodb not found", $mergedvodb, $PS_EXIT_UNKNOWN_ERROR);
+    }
+} else {
+    print "skipping processing for $mergedvodbReal\n";
+}
+
+exit 0;
+
+
+sub my_die
+{
+    my $msg = shift; # Warning message on die
+    my $minidbvodb_id = shift;
+    my $exit_code = shift; # Exit code to add
+
+    print STDERR "$msg $mergedvodb\n";
+
+if (defined $minidvodb_id ) {
+
+    my $command = "addtool -minidvodb_id $minidvodb_id";
+    $command .= " -addminidvodbprocessed";
+        $command .= " -fault $exit_code";
+        $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal;
+        $command .= " -minidvodb_group $minidvodb_group";
+        $command .= " -dtime_relphot $dtime_relphot" if defined $dtime_relphot;
+        $command .= " -dtime_resort $dtime_resort" if defined $dtime_resort;
+        $command .= " -dtime_merge $dtime_merge" if defined $dtime_merge;
+        $command .= " -dbname $dbname" if defined $dbname;
+
+
+
+    #print $command;
+    system ($command);
+    }
+
+
+
+
+    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
+
+    exit $exit_code;
+}
+
+__END__
Index: /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28304)
@@ -38,5 +38,5 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2) if @ARGV;
 pod2usage(
-    -msg => "Required options: --stage --stage_id --outroot\nHelpful options: --camera --dbname",
+    -msg => "Required options: --stage --stage_id --path_base\nHelpful options: --camera --dbname",
     -exitval => 3,
     ) unless
@@ -125,5 +125,5 @@
 	}
 	# Update database:
-	$command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -outroot $outroot";
+	$command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -path_base $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
@@ -136,4 +136,17 @@
 	}
     }
+    if (scalar (keys %tangents) == 0) {
+	my $projection_cell = 'NULL';
+	$command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -path_base $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update diff summary: $error_code", $stage_id, $error_code);
+	}
+    }	
 } #end warp stage
 if ($stage eq 'diff') {
@@ -165,5 +178,5 @@
 	my $state      = $imfile->{data_state};
 	my $projection_cell = $skycell_id;
-	if ($quality == 8007 or $state ne 'full') {
+	if ($quality == 8007 or $quality = 1010 or $state ne 'full') {
 	    next;
 	}
@@ -209,5 +222,5 @@
 	}
 	# Update database:
-	$command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -outroot $outroot";
+	$command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -path_base $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
@@ -220,8 +233,21 @@
 	}
     }
+    if (scalar (keys %tangents) == 0) {
+	my $projection_cell = 'NULL';
+	$command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -path_base $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update diff summary: $error_code", $stage_id, $error_code);
+	}
+    }	
 } #end diff stage
 if ($stage eq 'stack') {
     my $imfiles;
-    my $command = "$stacktool -stackskyfile -stack_id $stage_id";
+    my $command = "$stacktool -sassskyfile -sass_id $stage_id";
     if (defined($dbname)) {
 	$command .= " -dbname $dbname";
@@ -248,6 +274,7 @@
 	my $quality    = $imfile->{quality};
 	my $state      = $imfile->{data_state};
+	my $fault      = $imfile->{fault};
 	my $projection_cell = $skycell_id;
-	if ($quality == 8007 or $state ne 'full') {
+	if ($quality == 8007 or $state ne 'full' or $fault != 0) {
 	    next;
 	}
@@ -293,5 +320,5 @@
 	}
 	# Update database:
-	$command = "$stacktool -addsummary -stack_id $stage_id -projection_cell $projection_cell -outroot $outroot";
+	$command = "$stacktool -addsummary -sass_id $stage_id -projection_cell $projection_cell -path_base $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
@@ -304,4 +331,18 @@
 	}
     }
+    if (scalar (keys %tangents) == 0) {
+	my $projection_cell = 'NULL';
+	$command = "$stacktool -addsummary -stack_id $stage_id -projection_cell $projection_cell -path_base $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update diff summary: $error_code", $stage_id, $error_code);
+	}
+    }	
+
 } #end stack stage
 
Index: /branches/czw_branch/20100519/ippScripts/scripts/stack_skycell.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/stack_skycell.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/stack_skycell.pl	(revision 28304)
@@ -149,4 +149,8 @@
 my $recipe_ppSub = $ipprc->reduction($reduction, 'STACK_PPSUB'); # Recipe to use for ppSub
 my $recipe_psphot  = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot
+my $recipe_ppstats = 'STACKSTATS';
+if ($run_state eq 'update') {
+    $recipe_ppstats = 'WARPSTATS';
+}
 unless ($recipe_ppStack and $recipe_ppSub and $recipe_psphot) {
     &my_die("Couldn't find selected reduction for STACK_PPSTACK, STACK_PPSUB and STACK_PSPHOT: $reduction\n", $stack_id, $PS_EXIT_CONFIG_ERROR);
@@ -232,5 +236,5 @@
     $command .= " -recipe PPSUB $recipe_ppSub";
     $command .= " -recipe PSPHOT $recipe_psphot";
-    $command .= " -recipe PPSTATS STACKSTATS" if $do_stats;;
+    $command .= " -recipe PPSTATS $recipe_ppstats" if $do_stats;;
     $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE";
     $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF";
Index: /branches/czw_branch/20100519/ippScripts/scripts/staticsky.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/staticsky.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippScripts/scripts/staticsky.pl	(revision 28304)
@@ -38,5 +38,9 @@
 }
 
-my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect, $save_temps);
+# XXX test:
+print "run staticsky.pl @ARGV\n";
+# exit 0;
+
+my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps);
 GetOptions(
     'sky_id=s'          => \$sky_id, # Diff identifier
@@ -44,5 +48,4 @@
     'dbname|d=s'        => \$dbname, # Database name
     'threads=s'         => \$threads,   # Number of threads to use
-    'run-state=s'       => \$run_state,   # state for run: 'new' or 'update'
     'outroot=s'         => \$outroot, # Output root name
     'reduction=s'       => \$reduction, # Reduction class
@@ -56,5 +59,5 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --sky_id --outroot --camera (--run_state)",
+    -msg => "Required options: --sky_id --outroot --camera",
     -exitval => 3,
           ) unless 
@@ -62,10 +65,8 @@
     defined $outroot and
     defined $camera;
-#   and defined $run_state;
 
 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $sky_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 
 my $logDest = $ipprc->filename("LOG.EXP", $outroot);
-# $logDest .= ".update" if $run_state eq "update";
 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect;
 
@@ -85,5 +86,5 @@
     unless ($success) {
         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-        &my_die("Unable to perform difftool -inputskyfile: $error_code", $sky_id, $error_code);
+        &my_die("Unable to perform staticskytool -inputs: $error_code", $sky_id, $error_code);
     }
 
@@ -152,7 +153,7 @@
 print "recipe_psphot: $recipe_psphot\n";
 
-my $cmdflags;
-
-# Perform subtraction
+# my $cmdflags;
+
+# Perform stack photometry analysis
 {
     my $command = "$psphotStack $outroot";
@@ -167,10 +168,9 @@
 
     unless ($no_op) {
-        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-            run(command => $command, verbose => $verbose);
-        unless ($success) {
-            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-            &my_die("Unable to perform ppSub: $error_code", $sky_id, $error_code);
-        }
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code);
+	}
 
         # my $outputStatsReal = $ipprc->file_resolve($outputStats);
@@ -190,6 +190,7 @@
         # chomp $cmdflags;
 
-        my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
-
+        # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
+
+	my $quality = 0;
         if (!$quality) {
 
@@ -197,8 +198,8 @@
 	    # we have one set of output files per input file set
 	    for (my $i = 0; $i < @$files; $i++) {
-		my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot);
-		my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot);
-		my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot);
-		my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot);
+		my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
+		my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
+		my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
+		my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
 
 		&my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
@@ -211,9 +212,4 @@
 	    #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
 	    #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
-
-	    # if ($run_state eq 'update') {
-	    # 	$traceDest .= '.update';
-	    # 	$outputStats .= '.update';
-	    # }
 
 	    my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
@@ -235,13 +231,9 @@
     {
         my $command = "$staticskytool -sky_id $sky_id";
-        # if ($run_state eq 'new') {
 	$command .= " -addresult -path_base $outroot";
 	$command .= " -num_inputs $nInputs";
-	$command .= " $cmdflags";
+	# $command .= " $cmdflags";
 	$command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
 	$command .= " -hostname $host" if defined $host;
-        # } else {
-        #     $command .= " -tofullskyfile";
-        # }
         $command .= " -dbname $dbname" if defined $dbname;
 
@@ -250,8 +242,7 @@
         unless ($success) {
             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-            my $err_message = $run_state eq "update" ?
-                "Unable to perform difftool -adddiffskyfile" :
-                "Unable to perform difftool -tofullskyfile";
-            &my_die("$err_message: $error_code", $sky_id, $error_code);
+            my $err_message = "Unable to perform staticskytool -addresult";
+	    warn($err_message);
+	    exit $error_code;
         }
     }
@@ -270,13 +261,9 @@
     if (defined $sky_id and not $no_update) {
         my $command = "$staticskytool -sky_id $sky_id -fault $exit_code";
-        if ($run_state eq 'new') {
-            $command .= " -adddiffskyfile";
-            $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
-            $command .= " -hostname $host" if defined $host;
-            $command .= " -path_base $outroot" if defined $outroot;
-            $command .= " -dbname $dbname" if defined $dbname;
-        } else {
-            $command .= " -updatediffskyfile";
-        }
+	$command .= " -addresult";
+	$command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
+	$command .= " -hostname $host" if defined $host;
+	$command .= " -path_base $outroot" if defined $outroot;
+	$command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
     }
Index: /branches/czw_branch/20100519/ippTasks/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ippTasks/Makefile.am	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/Makefile.am	(revision 28304)
@@ -20,4 +20,5 @@
 	diff.pro \
 	stack.pro \
+	staticsky.pro \
 	summit.copy.pro \
 	survey.pro \
@@ -31,4 +32,5 @@
 	dqstats.pro \
 	science.cleanup.pro \
+	minidvodb.pro \
 	nightly_stacks.pro \
 	lossy_compress.pro
Index: /branches/czw_branch/20100519/ippTasks/addstar.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/addstar.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/addstar.pro	(revision 28304)
@@ -45,7 +45,9 @@
 end
 
+
 # this variable will cycle through the known database names
 $addstar_DB = 0
 $addstar_revert_DB = 0
+
 
 # select images ready for addstar analysis
@@ -64,5 +66,5 @@
 
   task.exec
-    if ($LABEL:n == 0) break
+   # if ($LABEL:n == 0) break
     $run = addtool -pendingexp
     if ($DB:n == 0)
@@ -134,4 +136,7 @@
     book getword addPendingExp $pageName reduction -var REDUCTION
     book getword addPendingExp $pageName dvodb  -var DVODB
+    book getword addPendingExp $pageName minidvodb  -var MINIDVODB
+    book getword addPendingExp $pageName minidvodb_name  -var MINIDVODB_NAME
+    book getword addPendingExp $pageName minidvodb_group  -var MINIDVODB_GROUP
     book getword addPendingExp $pageName image_only -var IMAGE_ONLY
     book getword addPendingExp $pageName dbname -var DBNAME
@@ -164,4 +169,11 @@
       $run = $run --image-only
     end
+    if ("$MINIDVODB" == "T")
+    $run = $run --minidvodb
+    $run = $run --minidvodb_group $MINIDVODB_GROUP
+	if (("$MINIDVODB_NAME" != "NULL") && ("$MINIDVODB_NAME" != "(null)"))
+           $run = $run --minidvodb_name $MINIDVODB_NAME #have addstar_run.pl grab the 'active' name if it is NULL
+	end
+    end 
     
     add_standard_args run
Index: /branches/czw_branch/20100519/ippTasks/diff.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/diff.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/diff.pro	(revision 28304)
@@ -11,4 +11,5 @@
 book init diffSkyfile
 #book init diffCleanup
+book init diffPendingSummary
 
 ### Database lists
@@ -16,4 +17,5 @@
 $diffAdvance_DB = 0
 $diff_revert_DB = 0
+$diffSummary_DB = 0
 #$diffCleanup_DB = 0
 
@@ -27,4 +29,5 @@
 macro diff.reset
   book init diffSkyfile
+  book init diffPendingSummary
 #  book init diffCleanup
 end
@@ -573,5 +576,4 @@
     book getword warpPendingSummary $pageName tess_id -var TESS_DIR
     book getword diffPendingSummary $pageName diff_mode -var DIFF_MODE
-    book getword diffPendingSummary $pageName exp_tag -var EXP_TAG
     book getword diffPendingSummary $pageName state -var RUN_STATE
 
@@ -598,6 +600,6 @@
     basename $TESS_DIR -var TESS_ID
 
-    sprintf outroot "%s/%s/%s/%s.%s.%sdif.%s.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $DIFF_TAG $DIFF_ID
-        ## generate outroot specific to this exposure
+    ## generate outroot specific to this exposure
+    sprintf outroot "%s/%s/%s/%s.%s.%sdif.%s.summary" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $DIFF_TAG $DIFF_ID
 
 
Index: /branches/czw_branch/20100519/ippTasks/lossy_compress.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/lossy_compress.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/lossy_compress.pro	(revision 28304)
@@ -149,9 +149,9 @@
 
 	# specify choice of remote host
-	set.host.for.camera $CAMERA $TMP_CLASS_ID
+	set.host.for.camera $CAMERA $CLASS_ID
 
 	# set logfile name
 	if ("$WORKDIR" == "NULL") 
-	    sprintf logfile "compress_log/%s.%d.lossycomp.%s.log" $EXP_NAME $EXP_ID $CLASS_ID
+	    sprintf logfile "compress_log/%s.%d.lossycomp.%s.log" $EXP_NAME $EXP_ID $TMP_CLASS_ID
 	else 
 	    sprintf logfile "%s/%s/%s.lossycomp.%s.log" $WORKDIR $EXP_TAG $EXP_TAG $TMP_CLASS_ID
@@ -275,9 +275,9 @@
 
 	# specify choice of remote host
-	set.host.for.camera $CAMERA $TMP_CLASS_ID
+	set.host.for.camera $CAMERA $CLASS_ID
 
 	# set logfile name
 	if ("$WORKDIR" == "NULL") 
-	    sprintf logfile "compress_log/%s.%d.lossycomp.%s.log" $EXP_NAME $EXP_ID $CLASS_ID
+	    sprintf logfile "compress_log/%s.%d.lossycomp.%s.log" $EXP_NAME $EXP_ID $TMP_CLASS_ID
 	else 
 	    sprintf logfile "%s/%s/%s.lossycomp.%s.log" $WORKDIR $EXP_TAG $EXP_TAG $TMP_CLASS_ID
Index: /branches/czw_branch/20100519/ippTasks/minidvodb.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/minidvodb.pro	(revision 28304)
+++ /branches/czw_branch/20100519/ippTasks/minidvodb.pro	(revision 28304)
@@ -0,0 +1,732 @@
+## addstar.pro : globals and support macros : -*- sh -*-
+## this file contains the tasks for running the addstar analysis stage
+## these tasks use the book addPendingExp
+
+# test for required global variables
+check.globals
+
+
+#There is a book for each task, because I don't use labels. 
+
+if (not($?haveBooks))
+ book create MINIDVODB
+ book create MINIDVODB_MERGE
+ book create MINIDVODB_CREATE
+ book create MINIDVODB_ACTIVE   
+ $haveBooks = TRUE
+end
+
+$MINIDVODB_DB = 0
+
+$MINIDVODB_WAIT_DB = 0
+$MINIDVODB_MERGE_DB = 0
+$MINIDVODB_CREATE_DB = 0
+$MINIDVODB_ACTIVE_DB = 0
+
+book init minidvodbWaitlist
+book init minidvodbMergelist
+book init minidvodbCreatelist
+book init minidvodbActivelist
+
+macro minidvodb.create.status
+  book listbook minidvodbCreatelist
+end
+
+macro minidvodb.create.reset
+  book init minidvodbCreatelist
+end
+
+macro minidvodb.active.status
+  book listbook minidvodbActivelist
+end
+
+macro minidvodb.active.reset
+  book init minidvodbActivelist
+end
+
+
+macro minidvodb.wait.status
+  book listbook minidvodbWaitlist
+end
+
+macro minidvodb.wait.reset
+  book init minidvodbWaitlist
+end
+
+macro minidvodb.merge.status
+  book listbook minidvodbMergelist
+end
+
+macro minidvodb.merge.reset
+  book init minidvodbMergelist
+end
+
+#this is the create task, there is no load, it just runs
+macro minidvodb.create.on
+    task minidvodb.create
+    active true
+  end
+end
+macro minidvodb.create.off
+   task minidvodb.create
+    active false
+  end
+end
+##these are the tasks that flip from new -> active
+macro minidvodb.active.on
+  task minidvodb.active.load
+    active true
+  end
+  task minidvodb.active.run
+    active true
+  end  
+end
+macro minidvodb.active.off
+  task minidvodb.active.load
+    active false
+  end
+  task minidvodb.active.run
+    active false
+  end  
+end
+
+##these are the tasks that check to see if addRun processing is finished
+##for a minidvodb in state wait
+macro minidvodb.wait.on
+  task minidvodb.wait.load
+    active true
+  end
+  task minidvodb.wait.run
+    active true
+  end  
+end
+macro minidvodb.wait.off
+  task minidvodb.wait.load
+    active false
+  end
+  task minidvodb.wait.run
+    active false
+  end  
+end
+
+##these merge the dbs
+
+macro minidvodb.merge.on
+  task minidvodb.merge.load
+    active true
+  end
+  task minidvodb.merge.run
+    active true
+  end  
+end
+macro minidvodb.merge.off
+  task minidvodb.merge.load
+    active false
+  end
+  task minidvodb.merge.run
+    active false
+  end  
+end
+
+## you get no choice - you add all of them in at the same time. you can always turn off the tasks you don't want to run.
+macro add.minidvodb
+  if ($0 != 5)
+    echo "USAGE: add.minidvodb (minidvodb_group) (dvodb) (interval days) (camera)"
+    break
+  end
+
+  #wait - shoudl be renamed MINIDVODB_WAIT
+  book newpage MINIDVODB $1
+  book setword MINIDVODB $1 MINIDVODB_GROUP $1
+  book setword MINIDVODB $1 DVODB $2
+  book setword MINIDVODB $1 STATE PENDING
+  #merge  
+  book newpage MINIDVODB_MERGE $1
+  book setword MINIDVODB_MERGE $1 MINIDVODB_GROUP $1
+  book setword MINIDVODB_MERGE $1 DVODB $2
+  book setword MINIDVODB_MERGE $1 STATE PENDING
+  #active  
+  book newpage MINIDVODB_ACTIVE $1
+  book setword MINIDVODB_ACTIVE $1 MINIDVODB_GROUP $1
+  book setword MINIDVODB_ACTIVE $1 DVODB $2
+  book setword MINIDVODB_ACTIVE $1 STATE PENDING
+
+  #create  note that camera should be GPC1 for it to work. I couldn't figure out how to easily get this out.
+  book newpage MINIDVODB_CREATE $1
+  book setword MINIDVODB_CREATE $1 MINIDVODB_GROUP $1
+  book setword MINIDVODB_CREATE $1 DVODB $2
+  book setword MINIDVODB_CREATE $1 DVODB_DAYS $3
+  book setword MINIDVODB_CREATE $1 CAMERA $4  
+  book setword MINIDVODB_CREATE $1 STATE PENDING  
+end
+
+macro del.minidvodb
+  if ($0 != 2)
+    echo "USAGE: del.minidvodb (minidvodb)"
+    break
+  end
+  book delpage MINIDVODB $1
+  book delpage MINIDVODB_MERGE $1
+  book delpage MINIDVODB_CREATE $1  
+  book delpage MINIDVODB_ACTIVE $1
+end
+
+macro show.minidvodb
+  if ($0 != 1)
+    echo "USAGE: show.minidvodb"
+    break
+  end
+  echo "minidvodb wait"
+  book listbook MINIDVODB
+  echo "minidvodb merge"
+  book listbook MINIDVODB_MERGE
+  echo "minidvodb create"
+  book listbook MINIDVODB_CREATE 
+  echo "minidvodb_active"
+  book listbook MINIDVODB_ACTIVE
+end
+
+
+
+
+
+
+
+
+task           minidvodb.wait.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/minidvodb.wait.load.log
+
+  task.exec
+    book npages MINIDVODB -var N
+    if ($N == 0)
+#      echo "No labels for processing"
+      break
+    endif
+
+    book getpage MINIDVODB 0 -var minidvodb_group -key STATE NEW
+    if ("$minidvodb_group" == "NULL")
+      # All labels have been done --- reset
+#      echo "Resetting labels"
+      for i 0 $N
+        book getpage MINIDVODB $i -var minidvodb_group
+        book setword MINIDVODB $minidvodb_group STATE NEW
+      end
+      book getpage MINIDVODB 0 -var minidvodb_group -key STATE NEW
+
+      # Select different database
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+#using check as opposed to list because it sees if it is done with the addRun state yet.  
+    book setword MINIDVODB $minidvodb_group STATE DONE
+    $run = addtool -checkminidvodbrunaddrun -state waiting
+    $run = $run -minidvodb_group $minidvodb_group
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run -dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    add_poll_args run
+   
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout minidvodbWaitlist -key minidvodb_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook minidvodbWaitlist
+    end
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup minidvodbWaitlist
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+
+
+
+task           minidvodb.wait.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 60
+
+  task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    book npages minidvodbWaitlist -var N
+    if ($N == 0) break
+   
+    # look for new images in minidvodbWaitlist (pantaskState == INIT)
+    book getpage minidvodbWaitlist 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword minidvodbWaitlist $pageName pantaskState RUN
+    book getword minidvodbWaitlist $pageName minidvodb_id -var MINIDVODB_ID
+    book getword minidvodbWaitlist $pageName state -var STATE
+    stdout $LOGDIR/minidvodb.wait.run.log
+    stderr $LOGDIR/minidvodb.wait.run.log
+    
+    $run = addtool -updateminidvodbrun -minidvodb_id $MINIDVODB_ID -set_state to_be_merged  
+    
+   
+if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run -dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec 0.05
+    command $run
+  end
+  # default exit status
+    task.exit    default
+    process_exit minidvodbWaitlist $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    echo "hostname: $JOB_HOSTNAME"
+    process_exit minidvodbWaitlist $options:0 $EXIT_CRASH_ERR
+  end
+
+  # operation timed out?
+    task.exit    timeout
+	showcommand timeout
+    book setword minidvodbWaitlist $options:0 pantaskState TIMEOUT
+  end
+end
+
+
+
+task           minidvodb.merge.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/minidvodb.merge.load.log
+
+  task.exec
+    book npages MINIDVODB_MERGE -var N
+    if ($N == 0)
+#      echo "No labels for processing"
+      break
+    endif
+
+    book getpage MINIDVODB_MERGE 0 -var minidvodb_group -key STATE NEW
+    if ("$minidvodb_group" == "NULL")
+      # All labels have been done --- reset
+#      echo "Resetting labels"
+      for i 0 $N
+        book getpage MINIDVODB_MERGE $i -var minidvodb_group
+        book setword MINIDVODB_MERGE $minidvodb_group STATE NEW
+      end
+      book getpage MINIDVODB_MERGE 0 -var minidvodb_group -key STATE NEW
+
+      # Select different database
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    #finds the minidvodbs in a state of 'to_be_merged' 
+    book setword MINIDVODB_MERGE $minidvodb_group STATE DONE
+    $run = addtool -listminidvodbrun -state to_be_merged -limit 1
+    $run = $run -minidvodb_group $minidvodb_group
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run -dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    add_poll_args run
+   
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout minidvodbMergelist -key minidvodb_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook minidvodbMergelist
+    end
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup minidvodbMergelist
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+
+
+
+task           minidvodb.merge.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 20000
+  
+  #we only want one running at a time
+
+  host         local
+  npending     1
+
+  task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    book npages minidvodbMergelist -var N
+    if ($N == 0) break
+    
+    # look for new images in minidvodbWaitlist (pantaskState == INIT)
+    book getpage minidvodbMergelist 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword minidvodbMergelist $pageName pantaskState RUN
+    book getword minidvodbMergelist $pageName minidvodb_id -var MINIDVODB_ID
+    book getword minidvodbMergelist $pageName minidvodb_group -var MINIDVODB_GROUP
+    book getword minidvodbMergelist $pageName mergedvodb_path -var MERGEDVODB_PATH
+    book getword minidvodbMergelist $pageName minidvodb_path -var MINIDVODB_PATH
+    book getword minidvodbMergelist $pageName state -var STATE
+    stdout $LOGDIR/minidvodb.merge.run.log
+    stderr $LOGDIR/minidvodb.merge.run.log
+
+    $run = minidvodb_merge.pl --camera GPC1 --mergedvodb $MERGEDVODB_PATH --minidvodb $MINIDVODB_PATH --minidvodb_group $MINIDVODB_GROUP --minidvodb_id $MINIDVODB_ID
+    
+  if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run --dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+  # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec 0.05
+    command $run
+  end
+  # default exit status
+    task.exit    default
+    process_exit minidvodbMergelist $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+  
+    echo "hostname: $JOB_HOSTNAME"
+
+    # Set a fault code in the database
+    
+    process_exit minidvodbMergelist $options:0 $EXIT_CRASH_ERR
+  end
+
+  # operation timed out?
+    task.exit    timeout
+	showcommand timeout
+    book setword minidvodbMergelist $options:0 pantaskState TIMEOUT
+  end
+end
+
+
+#this is the complicated script - it creates the minidvodbRuns
+#since none may exist by default, I decided not to have a load.task
+#it calls a perl script, which creates a new one if:
+#there is none in an active state (true if there is none at all)
+#the current one is older than the dvodb_age
+#there are none in new (we have a task that moves it to 'active')
+#the current active one has > 30000 add_ids in it
+
+#also confusing: it succeeds if it doesn't create it (if it doesn't want to create one)
+#and it succeeds if it creates one. (otherwise there would be a lot of false failures,
+# like in replication)
+#it fails if it has problems with one of the addtool commands in the script.
+
+task           minidvodb.create
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 240
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/minidvodb.create.log
+
+  task.exec
+    
+ periods      -poll 60
+#wait a bit before trying again
+
+    book npages MINIDVODB_CREATE -var N
+    if ($N == 0)
+#      echo "No labels for processing"
+      break
+    endif
+
+    book getpage MINIDVODB_CREATE 0 -var minidvodb_group -key STATE NEW
+    if ("$minidvodb_group" == "NULL")
+      # All labels have been done --- reset
+#      echo "Resetting labels"
+      for i 0 $N
+        book getpage MINIDVODB_CREATE $i -var minidvodb_group
+        book setword MINIDVODB_CREATE $minidvodb_group STATE NEW
+      end
+       book getpage MINIDVODB_CREATE 0 -var minidvodb_group -key STATE NEW
+      # Select different database
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+     
+    book setword MINIDVODB_CREATE $minidvodb_group STATE DONE
+    book getword MINIDVODB_CREATE $minidvodb_group DVODB -var dvodb 
+    book getword MINIDVODB_CREATE $minidvodb_group DVODB_DAYS -var dvodb_days
+    book getword MINIDVODB_CREATE $minidvodb_group CAMERA -var camera
+    $run = minidvodb_createdb.pl --camera $camera --outroot $dvodb --dvodb $dvodb --minidvodb_group $minidvodb_group --interval $dvodb_days
+ 
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run --dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    command $run
+  end
+
+  # success
+  task.exit    0
+     if ($VERBOSE > 2)
+      showcommand 
+     end
+   end
+
+  # locked list
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+
+
+task           minidvodb.active.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/minidvodb.active.load.log
+
+  task.exec
+    book npages MINIDVODB_ACTIVE -var N
+    if ($N == 0)
+#      echo "No labels for processing"
+      break
+    endif
+
+    book getpage MINIDVODB_ACTIVE 0 -var minidvodb_group -key STATE NEW
+    if ("$minidvodb_group" == "NULL")
+      # All labels have been done --- reset
+#      echo "Resetting labels"
+      for i 0 $N
+        book getpage MINIDVODB_ACTIVE $i -var minidvodb_group
+        book setword MINIDVODB_ACTIVE $minidvodb_group STATE NEW
+      end
+      book getpage MINIDVODB_ACTIVE 0 -var minidvodb_group -key STATE NEW
+      
+      # Select different database
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    book setword MINIDVODB_ACTIVE $minidvodb_group STATE DONE
+    
+    $run = addtool -listminidvodbrun -state new
+    $run = $run -minidvodb_group $minidvodb_group
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run -dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+    add_poll_args run
+   
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout minidvodbActivelist -key minidvodb_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook minidvodbActivelist
+    end
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup minidvodbActivelist
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+
+
+
+task           minidvodb.active.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 60
+
+  task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    book npages minidvodbActivelist -var N
+    if ($N == 0) break
+   
+    # look for new images in minidvodbActivelist (pantaskState == INIT)
+    book getpage minidvodbActivelist 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword minidvodbActivelist $pageName pantaskState RUN
+    book getword minidvodbActivelist $pageName minidvodb_group -var MINIDVODB_GROUP
+    stdout $LOGDIR/minidvodb.active.run.log
+    stderr $LOGDIR/minidvodb.active.run.log
+
+    $run = addtool -flipminidvodbrun -minidvodb_group $MINIDVODB_GROUP
+    
+   
+if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$MINIDVODB_DB
+      $run = $run -dbname $DB:$MINIDVODB_DB
+      $MINIDVODB_DB ++
+      if ($MINIDVODB_DB >= $DB:n) set MINIDVODB_DB = 0
+    end
+# save the pageName for future reference below
+    options $pageName
+
+
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec 0.05
+    command $run
+  end
+# default exit status
+    task.exit    default
+    process_exit minidvodbActivelist $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    #showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    # Set a fault code in the database
+    
+    process_exit minidvodbActivelist $options:0 $EXIT_CRASH_ERR
+  end
+
+  # operation timed out?
+    task.exit    timeout
+	showcommand timeout
+    book setword minidvodbActivelist $options:0 pantaskState TIMEOUT
+  end
+end
+
Index: /branches/czw_branch/20100519/ippTasks/nightly_stacks.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/nightly_stacks.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/nightly_stacks.pro	(revision 28304)
@@ -5,4 +5,5 @@
 macro nightly.stacks.on
     ns.initday.on
+    ns.detrends.off
     ns.registration.on
     ns.burntool.on
@@ -13,4 +14,5 @@
 macro nightly.stacks.off
     ns.initday.off
+    ns.detrends.off
     ns.registration.off
     ns.burntool.off
@@ -21,4 +23,5 @@
 macro ns.on
     ns.initday.on
+    ns.detrends.off
     ns.registration.on
     ns.burntool.on
@@ -29,4 +32,5 @@
 macro ns.off
     ns.initday.off
+    ns.detrends.off
     ns.registration.off
     ns.burntool.off
@@ -41,4 +45,10 @@
 end
 
+macro ns.detrends.on
+  task ns.detrends.load
+    active true
+  end
+end
+
 macro ns.registration.on
   task ns.registration.load
@@ -76,4 +86,10 @@
 macro ns.initday.off
   task ns.initday.load
+    active false
+  end
+end
+
+macro ns.detrends.off
+  task ns.detrends.load
     active false
   end
@@ -186,4 +202,39 @@
   #operation times out?
   task.exit    timeout
+    showcommand timeout
+  end
+end
+
+#
+# Queue off any possible detrend verification runs
+#
+task              ns.detrends.load
+  host            local
+  periods         -poll $LOADPOLL
+  periods         -exec $LOADEXEC
+  periods         -timeout 30
+  trange          23:00:00 24:00:00 -nmax 1
+  npending        1
+
+  task.exec
+    stdout $LOGDIR/ns.detrends.log
+    stdout $LOGDIR/ns.detrends.log
+    $today = `date +%Y-%m-%d`
+
+    command automate_stacks.pl --queue_detrends --date $today
+  end
+  
+  task.exit       0
+    # nothign to do here
+  end
+  # locked list
+  task.exit       default
+    showcommand failure
+  end
+  task.exit       crash
+    showcommand crash
+  end
+  # operation times out
+  task.exit       timeout
     showcommand timeout
   end
Index: /branches/czw_branch/20100519/ippTasks/stack.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/stack.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/stack.pro	(revision 28304)
@@ -349,4 +349,7 @@
 # end
 
+
+
+
 task stack.revert
   host         local
Index: /branches/czw_branch/20100519/ippTasks/staticsky.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/staticsky.pro	(revision 28304)
+++ /branches/czw_branch/20100519/ippTasks/staticsky.pro	(revision 28304)
@@ -0,0 +1,253 @@
+## staticsky.pro : tasks for staticsky photometry analysis : -*- sh -*-
+
+## This file contains panTasks definitions for performing the
+## staticsky photometry analysis.  After a staticsky entry (with
+## associated sky_id) is defined, psphotStack is performed (via script
+## staticsky.pl) (tasks in staticskyResult).
+
+# test for required global variables
+check.globals
+
+### Initialise the books containing the tasks to do
+book init staticskyResult
+
+### Database lists
+$staticsky_DB = 0
+$staticsky_revert_DB = 0
+
+### Check status of staticsky tasks
+macro staticsky.status
+  book listbook staticskyResult
+end
+
+### Reset staticsky tasks
+macro staticsky.reset
+  book init staticskyResult
+end
+
+### Turn staticsky tasks on
+macro staticsky.on
+  task staticsky.load
+    active true
+  end
+  task staticsky.run
+    active true
+  end
+  task staticsky.revert
+    active false
+  end
+end
+
+### Turn staticsky tasks off
+macro staticsky.off
+  task staticsky.load
+    active false
+  end
+  task staticsky.run
+    active false
+  end
+  task staticsky.revert
+    active false
+  end
+end
+
+macro staticsky.revert.on
+  task staticsky.revert
+    active true
+  end
+end
+
+macro staticsky.revert.off
+  task staticsky.revert
+    active false
+  end
+end
+
+### Load tasks for staticsky
+### Tasks are loaded into staticskyResult.
+task	       staticsky.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/staticsky.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = staticskytool -todo
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$staticsky_DB
+      $run = $run -dbname $DB:$staticsky_DB -limit 40
+      $staticsky_DB ++
+      if ($staticsky_DB >= $DB:n) set staticsky_DB = 0
+    end
+    add_poll_args run
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout staticskyResult -key sky_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook staticskyResult
+    end
+
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup staticskyResult
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+### Run tasks for the staticsky analysis
+### Tasks are taken from staticskyResult.
+task	       staticsky.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 10800
+
+  task.exec
+    book npages staticskyResult -var N
+    if ($N == 0) break
+    if ($NETWORK == 0) break
+    if ($BURNTOOLING == 1) break
+
+    # look for new entries in staticskyResult (pantaskState == INIT)
+    book getpage staticskyResult 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword staticskyResult $pageName pantaskState RUN
+    book getword staticskyResult $pageName sky_id -var SKY_ID
+    book getword staticskyResult $pageName tess_id -var TESS_DIR
+    book getword staticskyResult $pageName skycell_id -var SKYCELL_ID
+    book getword staticskyResult $pageName workdir -var WORKDIR_TEMPLATE
+    book getword staticskyResult $pageName path_base -var PATH_BASE
+    book getword staticskyResult $pageName reduction -var REDUCTION
+    book getword staticskyResult $pageName dbname -var DBNAME
+    book getword staticskyResult $pageName state -var RUN_STATE
+
+    # move this above when we get camera into the db correctly:
+    # book getword staticskyResult $pageName camera -var CAMERA
+    $CAMERA = GPC1
+
+    # set the host and workdir based on the skycell hash
+    set.host.for.skycell $SKYCELL_ID
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    basename $TESS_DIR -var TESS_ID
+    if ("$PATH_BASE" == "NULL")
+        sprintf outroot "%s/%s/%s/%s.%s.stk.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $SKY_ID
+    else
+        $outroot = $PATH_BASE
+    end
+
+    stdout $LOGDIR/staticsky.log
+    stderr $LOGDIR/staticsky.log
+
+    $run = staticsky.pl --threads @MAX_THREADS@ --sky_id $SKY_ID --outroot $outroot --redirect-output --camera $CAMERA
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
+    end
+    add_standard_args run
+
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    command $run
+  end
+
+  # default exit status
+  task.exit    default
+    process_exit staticskyResult $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    book setword staticskyResult $options:0 pantaskState CRASH
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword staticskyResult $options:0 pantaskState TIMEOUT
+  end
+end
+
+task staticsky.revert
+  host         local
+
+  periods      -poll 60.0
+  periods      -exec 1800.0
+  periods      -timeout 120.0
+  npending     1
+  active false
+  
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    # Only revert failures with fault=2 (SYS_ERROR), which tend to be
+    # temporary filesystem problems.  Every other fault type is
+    # interesting and should be kept for debugging (and so it doesn't
+    # continue to occur).
+    $run = staticskytool -revertsumskyfile -fault 2
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$staticsky_revert_DB
+      $run = $run -dbname $DB:$staticsky_revert_DB
+      $staticsky_revert_DB ++
+      if ($staticsky_revert_DB >= $DB:n) set staticsky_revert_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
Index: /branches/czw_branch/20100519/ippTasks/survey.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/survey.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/survey.pro	(revision 28304)
@@ -207,10 +207,11 @@
 
 macro survey.add.addstar
-  if ($0 != 3)
-    echo "USAGE: survey.add.addstar (label) (dvodb)"
+  if ($0 != 4)
+    echo "USAGE: survey.add.addstar (label) (dvodb) (minidvodb_group)"
     break
   end
   book newpage SURVEY_ADDSTAR $1
   book setword SURVEY_ADDSTAR $1 DVODB $2
+  book setword SURVEY_ADDSTAR $1 MINIDVODB_GROUP $3
   book setword SURVEY_ADDSTAR $1 STATE PENDING
 end
@@ -638,4 +639,5 @@
     book setword SURVEY_ADDSTAR $label STATE DONE
     book getword SURVEY_ADDSTAR $label DVODB -var dvodb
+    book getword SURVEY_ADDSTAR $label MINIDVODB_GROUP -var minidvodb_group
   
  #   $run = addtool -definebyquery -destreaked -label $label -set_dvodb $dbodb
@@ -648,5 +650,5 @@
     end
     
-    $run = $run -definebyquery -destreaked -label $label -set_dvodb $dvodb
+    $run = $run -definebyquery -destreaked -label $label -set_dvodb $dvodb -set_minidvodb_group $minidvodb_group -set_minidvodb -set_label $minidvodb_group
     echo $run
     command $run
Index: /branches/czw_branch/20100519/ippTasks/warp.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/warp.pro	(revision 28303)
+++ /branches/czw_branch/20100519/ippTasks/warp.pro	(revision 28304)
@@ -13,4 +13,5 @@
 book init warpPendingSkyCell
 book init warpPendingCleanup
+book init warpPendingSummary
 
 ### Database lists
@@ -19,4 +20,5 @@
 $warp_revert_overlap_DB = 0
 $warp_revert_warped_DB = 0
+$warpSummary_DB = 0
 
 ### Check status of warping tasks
@@ -30,4 +32,5 @@
   book init warpInputExp
   book init warpPendingSkyCell
+  book init warpPendingSummary
 end
 
Index: anches/czw_branch/20100519/ippToPsps/config/currentJobId.txt
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/config/currentJobId.txt	(revision 28303)
+++ 	(revision )
@@ -1,1 +1,0 @@
-5580
Index: /branches/czw_branch/20100519/ippToPsps/config/init/data.xml
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/config/init/data.xml	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/config/init/data.xml	(revision 28304)
@@ -101463,5 +101463,61 @@
   <row stackTypeID="9" description="stack type 9" />
   <row stackTypeID="10" description="stack type 10" />
-  </table>
+ </table>
+
+ <table name="ImageFlags">
+   <row name="NEW" value="0" description="no relphot / relastro attempted" />
+   <row name="NOCAL" value="1" description="used within relphot to mean 'don't apply fit'" />
+   <row name="POOR" value="2" description="relphot says image is bad" />
+   <row name="SKIP" value="4" description="external information image is bad" />
+   <row name="FEW" value="8" description="currently too few measurements for good value" />
+ </table>
+
+ <table name="DetectionFlags">
+   <row name="DEFAULT" value="0" description="Initial value: resets all bits" />
+   <row name="PSFMODEL" value="1" description="Source fitted with a psf model (linear or non-linear)" />
+   <row name="EXTMODEL" value="2" description="Source fitted with an extended-source model" />
+   <row name="FITTED" value="4" description="Source fitted with non-linear model (PSF or EXT; good or bad)" />
+   <row name="FITFAIL" value="8" description="Fit (non-linear) failed (non-converge, off-edge, run to zero)" />
+   <row name="POORFIT" value="16" description="Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)" />
+   <row name="PAIR" value="32" description="Source fitted with a double psf" />
+   <row name="PSFSTAR" value="64" description="Source used to define PSF model" />
+   <row name="SATSTAR" value="128" description="Source model peak is above saturation" />
+   <row name="BLEND" value="256" description="Source is a blend with other sourcers" />
+   <row name="EXTERNALPOS" value="512" description="Source based on supplied input position" />
+   <row name="BADPSF" value="1024" description="Failed to get good estimate of object's PSF" />
+   <row name="DEFECT" value="2048" description="Source is thought to be a defect" />
+   <row name="SATURATED" value="4096" description="Source is thought to be saturated pixels (bleed trail)" />
+   <row name="CR_LIMIT" value="8192" description="Source has crNsigma above limit" />
+   <row name="EXT_LIMIT" value="16384" description="Source has extNsigma above limit" />
+   <row name="MOMENTS_FAILURE" value="32768" description="could not measure the moments" />
+   <row name="SKY_FAILURE" value="65536" description="could not measure the local sky" />
+   <row name="SKYVAR_FAILURE" value="131072" description="could not measure the local sky variance" />
+   <row name="MOMENTS_SN" value="262144" description="moments not measured due to low S/N" />
+   <row name="BIG_RADIUS" value="1048576" description="poor moments for small radius, try large radius" />
+   <row name="AP_MAGS" value="2097152" description="source has an aperture magnitude" />
+   <row name="BLEND_FIT" value="4194304" description="source was fitted as a blend" />
+   <row name="EXTENDED_FIT" value="8388608" description="full extended fit was used" />
+   <row name="EXTENDED_STATS" value="16777216" description="extended aperture stats calculated" />
+   <row name="LINEAR_FIT" value="33554432" description="source fitted with the linear fit" />
+   <row name="NONLINEAR_FIT" value="67108864" description="source fitted with the non-linear fit" />
+   <row name="RADIAL_FLUX" value="134217728" description="radial flux measurements calculated" />
+   <row name="SIZE_SKIPPED" value="268435456" description="size could not be determined" />
+   <row name="ON_SPIKE" value="536870912" description="peak lands on diffraction spike" />
+   <row name="ON_GHOST" value="1073741824" description="peak lands on ghost or glint" />
+   <row name="OFF_CHIP" value="2147483648" description="peak lands off edge of chip" />
+   <row name="NOCAL" value="4294967296" description="detection ignored for this analysis (photcode, time range) -- internal only" />
+   <row name="POOR_PHOTOM" value="8589934592" description="detection is photometry outlier" />
+   <row name="SKIP_PHOTOM" value="17179869184" description="detection was ignored for photometry measurement" />
+   <row name="MEAS_AREA" value="34359738368" description="detection near image edge" />
+   <row name="POOR_ASTROM" value="68719476736" description="detection is astrometry outlier" />
+   <row name="SKIP_ASTROM" value="137438953472" description="detection was ignored for astrometry measurement" />
+   <row name="USED_OBJ" value="274877906944" description="detection was used during opdate objects" />
+   <row name="USED_CHIP" value="549755813888" description="detection was used during update chips" />
+   <row name="BLEND_MEAS" value="1099511627776" description="detection is within radius of multiple objects" />
+   <row name="BLEND_OBJ" value="2199023255552" description="multiple detections within radius of object" />
+   <row name="BLEND_MEAS_X" value="17592186044416" description="detection is within radius of multiple objects across catalogs" />
+   <row name="ARTIFACT" value="35184372088832" description="detection is thought to be non-astronomical" />
+ </table>
+
 
   <table name="PhotoCal">
Index: /branches/czw_branch/20100519/ippToPsps/config/init/tables.xml
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/config/init/tables.xml	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/config/init/tables.xml	(revision 28304)
@@ -112,3 +112,13 @@
     <column name="description" type="TSTRING" default=" " comment="survey description"></column>
   </table>
+  <table name="ImageFlags">
+    <column name="name" type="TSTRING" default=" " comment="Name of flag"></column>
+    <column name="value" type="TLONGLONG" default="0" comment="Flag value"></column>
+    <column name="description" type="TSTRING" default=" " comment="Description of the flag"></column>
+  </table>
+  <table name="DetectionFlags">
+    <column name="name" type="TSTRING" default=" " comment="Name of flag"></column>
+    <column name="value" type="TLONGLONG" default="0" comment="Flag value"></column>
+    <column name="description" type="TSTRING" default=" " comment="Description of the flag"></column>
+  </table>
 </tableDescriptions>
Index: /branches/czw_branch/20100519/ippToPsps/scripts/createDb.pl
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/scripts/createDb.pl	(revision 28304)
+++ /branches/czw_branch/20100519/ippToPsps/scripts/createDb.pl	(revision 28304)
@@ -0,0 +1,105 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use DBI;
+use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+
+my $dbname = 'ippToPsps';
+my $dbserver = 'ippdb01';
+my $dbuser = 'ipp';
+my $dbpass = 'ipp';
+GetOptions( 'dbname|d=s' => \$dbname);
+
+# connect to database
+my $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
+        "mysql_socket=" . DB_SOCKET(),
+        ${dbuser},${dbpass},
+        { RaiseError => 1, AutoCommit => 1}
+        ) or die "Unable to connect to database $DBI::errstr\n";
+
+print "\n*******************************************************************************\n*\n";
+
+print "* Connected to '$dbname' on 'dbserver'\n";
+
+if (!doesTableExist("revision")) {
+    createRevision_1();
+}
+
+
+$db->disconnect();
+print "* Disconnected from '$dbname' on 'dbserver'\n";
+print "*\n*******************************************************************************\n\n";
+
+#######################################################################################
+# 
+# Create revision 1 of the database 
+#
+#######################################################################################
+sub createRevision_1 {
+
+    print "* Creating revision 1 of '$dbname'\n";
+
+    my $query = $db->prepare(<<SQL);
+    CREATE TABLE revision (
+
+            revision INT, 
+            created TIMESTAMP DEFAULT NOW(),
+            primary key (revision)
+            );
+SQL
+        $query->execute;
+
+    $query = $db->prepare(<<SQL);
+    INSERT INTO revision (revision) VALUES (1);
+SQL
+        $query->execute;
+
+    $query = $db->prepare(<<SQL);
+
+    CREATE TABLE batches (
+
+            batch_id BIGINT NOT NULL, 
+            exp_id BIGINT NOT NULL, 
+            survey_id VARCHAR(30) DEFAULT "NONE",
+            processed TINYINT DEFAULT 0,
+            on_datastore TINYINT DEFAULT 0,
+            loaded_to_ODM TINYINT DEFAULT 0,
+            merge_worthy TINYINT DEFAULT 0,
+            deleted TINYINT DEFAULT 0,
+            created TIMESTAMP DEFAULT NOW(),
+            primary key (batch_id, exp_id)
+            );
+
+SQL
+    $query->execute;
+
+}
+
+#######################################################################################
+# 
+# Gets current revision of ippToPsps database
+#
+#######################################################################################
+sub doesTableExist {
+    my ($table) = @_;
+
+    my $query = $db->prepare(<<SQL);
+
+    SELECT COUNT(*) 
+        FROM information_schema.tables 
+        WHERE table_schema = '$dbname'  
+        AND table_name = '$table';
+SQL
+
+        $query->execute;
+
+    my $count = $query->fetchrow_array();
+
+    printf( "* Table '$table' %s\n", $count ? "exists" : "does not exist");
+
+    return $count;
+}
+
Index: /branches/czw_branch/20100519/ippToPsps/scripts/ippToPsps_run.pl
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/scripts/ippToPsps_run.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/scripts/ippToPsps_run.pl	(revision 28304)
@@ -12,9 +12,5 @@
 
 # globals
-my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $label, $singleExpId, $no_publish);
-
-# TODO temporary until we use database to store current jobid
-my $jobIdFilePath = "./config/currentJobId.txt";
-my $logFile = "./config/logfile.txt";
+my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force, $initBatch);
 
 # default values for certain globals
@@ -28,5 +24,6 @@
 $singleExpId = undef;
 $datastoreProduct = "PSPS_test";
-
+$force = 0;
+$initBatch = 0;
 
 # get user args
@@ -35,5 +32,5 @@
         'batch|b=s' => \$batchType,
         'dvodb|d=s' => \$dvodb,
-        'label|l=s' => \$label,
+        'survey|s=s' => \$survey,
         'expid|e=s' => \$singleExpId,
         'product|p=s' => \$datastoreProduct,
@@ -43,4 +40,5 @@
         'no-op' => \$no_op,
         'no-update' => \$no_update,
+        'force|f' => \$force,
         ) or pod2usage( 2 );
 
@@ -52,5 +50,5 @@
         "--batch <init|det|diff|stack>\n".
         "--output <path>\n".
-        "--label <label> or --expid <expid>\n" .
+        "--survey <ThreePi|MD01,2 etc|STS|SAS|SweetSpot> or --expid <expid>\n" .
         "--dvodb <path>\n".
         "\n   Optional:\n\n".
@@ -65,5 +63,7 @@
 defined $output and
 defined $dvodb and
-( defined $label or defined $singleExpId );
+(( defined $survey or defined $singleExpId ) or ( $batchType eq "init"));
+
+if ($batchType eq "init") {$initBatch = 1;}
 
 # check we can run programs and get camera config
@@ -73,5 +73,5 @@
 
 # make a temporary file for saving results
-my ($resultsFile, $resultsFileName) = tempfile( "/tmp/results.XXXX", UNLINK => !$save_temps);
+my ($resultsFile, $resultsFileName) = tempfile( "/tmp/ippToPsps_results.XXXX", UNLINK => !$save_temps);
 
 process();
@@ -89,5 +89,5 @@
     if ($distGroup =~ m/^MD([0-1][0-9])$/i) {return "MD$1";}
     if ($distGroup =~ m/^M31$/i) {return "M31";}
-    if ($distGroup =~ m/^sts$/i) {return "STS";}
+    if ($distGroup =~ m/^sts$/i) {return "STS1";}
     if ($distGroup =~ m/^SweetSpot$/i) {return "SSS";}
     if ($distGroup =~ m/^(3PI)|(ThreePi)|(SAS)$/i) {return "3PI";}
@@ -97,59 +97,85 @@
 }
 
+
 #######################################################################################
 # 
-# Finds all exposures for the provided label and generates PSPS FITS data for them
-#
-#######################################################################################
-sub process {
-    my $lastExpId = getLastExpId();
-
-    print "*******************************************************************************\n*\n";
-    print "* Last successfully processed exposure ID was $lastExpId\n";
-
-    # Set up the database
-    my $dbname = 'gpc1';
-    my $dbserver = 'ippdb01';
-    my $dbuser = 'ippuser';
-    my $dbpass = 'ippuser';
+# Connects to a db
+# 
+########################################################################################
+sub connectToDb {
+    my ($dbname,$dbserver,$dbuser,$dbpass) = @_;
+
+
     my $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
             "mysql_socket=" . DB_SOCKET(),
             ${dbuser},${dbpass},
             { RaiseError => 1, AutoCommit => 1}
-            ) or die "Unable to connect to database $DBI::errstr\n";
+            );
+    
+    printf("* Connection to '$dbname' on '$dbserver': %s\n", $db ? "success" : "FAILED ($DBI::errstr)");
+
+    return $db;
+}
+
+
+#######################################################################################
+# 
+# Finds all exposures for the provided TODO and generates PSPS FITS data for them
+#
+#######################################################################################
+sub process {
+
+    print "*******************************************************************************\n*\n";
+
+    my $gpc1Db = connectToDb("gpc1", "ippdb01", "ippuser", "ippuser") or return 0;
+    my $ippToPspsDb = connectToDb("ippToPsps", "ippdb01", "ipp", "ipp") or return 0;
+    my $lastExpId = getLastExpId($ippToPspsDb);
 
     my $query;
-    if (!$singleExpId) {
-
-        # query to retrieve all exposures with the provided label
-        $query = $db->prepare(<<SQL);
-
-        SELECT DISTINCT rawExp.exp_id, camRun.dist_group
-            FROM camRun, chipRun, rawExp
-            WHERE camRun.chip_id = chipRun.chip_id
-            AND chipRun.exp_id = rawExp.exp_id
-            AND camRun.label LIKE '%$label%'
-            AND rawExp.exp_id > $lastExpId
-            ORDER BY rawExp.exp_id ASC
+    if ($initBatch) {
+    
+        $query = $gpc1Db->prepare(<<SQL);
+
+        SELECT 0, 'NULL', 'ThreePi';
 SQL
+    }
+    elsif ($singleExpId) {
+
+        $query = $gpc1Db->prepare(<<SQL);
+
+        SELECT DISTINCT rawExp.exp_id,  rawExp.exp_name, dist_group 
+            FROM rawExp, chipRun 
+            WHERE chipRun.exp_id = rawExp.exp_id 
+            AND rawExp.exp_id = $singleExpId
+SQL
+    }
+    else {
+
+        $query = $gpc1Db->prepare(<<SQL);
+
+        SELECT rawExp.exp_id, rawExp.exp_name, camRun.dist_group 
+            FROM camRun, chipRun, rawExp 
+            WHERE camRun.state = 'full' 
+            AND camRun.chip_id = chipRun.chip_id 
+            AND chipRun.exp_id = rawExp.exp_id 
+            AND camRun.dist_group = '$survey'   
+            GROUP BY  rawExp.exp_id 
+            ORDER BY rawExp.exp_id ASC;
+SQL
+
+            #AND rawExp.dateobs <= '2010-03-12'
+            #AND rawExp.exp_id > $lastExpId
+            #AND camRun.label LIKE '%$label%'
             #AND rawExp.exp_id > 136561
             #AND camRun.dist_group LIKE 'sas'
             #AND rawExp.decl >= '-0.157079633' AND rawExp.decl <= '0.157079633' Jims Dec range
     }
-    else {
-
-        $query = $db->prepare(<<SQL);
-
-        SELECT DISTINCT rawExp.exp_id, dist_group FROM rawExp, chipRun WHERE chipRun.exp_id = rawExp.exp_id AND rawExp.exp_id = $singleExpId
-SQL
-    }
 
     my $batchId = 0;
     my $batchesPerJob = 1;
     my $anyBatches = 0;
+    my $published = 0;
 
     $query->execute;
-
-    open (LOGFILE, ">> $logFile");
 
     my $jobId = -1;
@@ -157,14 +183,18 @@
     # loop round exposures
     while (my @row = $query->fetchrow_array()) {
-        my ($expId, $distGroup) = @row;
-
-        $jobId = getNewJobId();
-
-        print "* Exposure ID = $expId with dist group = '$distGroup' as job ID $jobId\n";
+        my ($expId, $expName, $distGroup) = @row;
+
+        if (!$initBatch && isExposureAlreadyProcessed($ippToPspsDb, $expId)) {
+                
+                if ($force) {print "* Forcing....\n";} 
+                else {next};
+        }
 
         my $surveyType = getSurveyTypeFromDistGroup($distGroup);
-
         if (!$surveyType) {next;}
-        print "* Using survey type of $surveyType\n";
+
+        $jobId = getNewBatchId($ippToPspsDb, $expId, $surveyType);
+
+        # TODO quit here if no sensible job ID
 
         # generate batch and job paths from job and batch IDs
@@ -173,13 +203,11 @@
         my $batchDir = sprintf("B%03d", $batchId);
         my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir);
-
-        print "* Preparing exposure $expId as job '$job'...\n";
-
-        # make directories
         mkdir($jobOutputPath, 0777);
         mkdir($batchOutputPath, 0777);
 
+        print "* Preparing exposure $expId as job '$job'...\n";
+
         # run IppToPsps program
-        if (runIppToPsps($db, $expId, $batchOutputPath, $batchType)) {
+        if (runIppToPsps($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType)) {
 
             # write batch manifest and tar and zip up
@@ -198,13 +226,13 @@
             elsif ($anyBatches) {
 
+                $published = 0;
                 if (writeJobManifest($output, $job, $surveyType)) {
 
-                    if (!$no_publish && !publishToDatastore($output, $job)) { 
-
+                    if (!$no_publish && publishToDatastore($output, $job)) { 
+                        $published = 1;
                     }
                 }
 
-                # write to the log
-                print LOGFILE "$jobId $expId\n";
+                updateDb($ippToPspsDb, $jobId, $expId, 1, $published);
 
                 $batchId = 0;
@@ -214,19 +242,14 @@
 
                 print "* No batches to publish\n";
-                print LOGFILE "$jobId $expId ERROR\n";
             }
         }
-        else {
-            print LOGFILE "$jobId $expId ERROR\n";
-        }
-
-        if ($batchType eq "init" ) {print "* Wrote initialisation batch\n"; last;}
-
+
+        if ($initBatch) {print "* Wrote initialisation batch\n";}
 
         print "*\n*******************************************************************************\n\n";
     }
 
-    $db->disconnect();
-    close (LOGFILE);
+    $gpc1Db->disconnect();
+    $ippToPspsDb->disconnect();
 
     return 1;
@@ -239,33 +262,104 @@
 ########################################################################################
 sub getLastExpId {
-
-    my $lastExpId = `tail $logFile -n 1 | awk '{print \$2}'`;
-    chomp($lastExpId);
-    return $lastExpId;
-}
-
-#######################################################################################
-#
-# Gets the current jobId (ini file for now - will be Db eventually TODO) 
+    my ($db) = @_;
+
+    my $query = $db->prepare(<<SQL);
+
+    SELECT exp_id 
+        FROM batches 
+        WHERE processed = 1
+        ORDER BY exp_id 
+        DESC LIMIT 1;
+SQL
+
+    $query->execute;
+
+    my $expId = $query->fetchrow_array();
+
+    print "* Last successfully processed exposure ID was $expId\n";
+
+    return $expId; 
+}
+
+#######################################################################################
+#
+# Updates an existing database record 
 #
 ########################################################################################
-sub getNewJobId {
-
-    my $jobId = -1;
-
-    open (MYFILE, $jobIdFilePath);
-    while (<MYFILE>) {
-        chomp;
-        $jobId = $_;
-    }
-    close (MYFILE);
-
-    $jobId++;
-
-    open (MYFILE, "> $jobIdFilePath");
-    print MYFILE "$jobId";
-    close (MYFILE);
-
-    return $jobId;
+sub updateDb {
+    my ($db, $batchId, $expId, $processed, $published) = @_;
+
+    my $query = $db->prepare(<<SQL);
+
+    UPDATE batches 
+        SET processed = $processed, on_datastore = $published 
+        WHERE batch_id = $batchId 
+        AND exp_id = $expId;
+SQL
+
+    $query->execute; # TODO check response of these
+}
+
+#######################################################################################
+#
+# Checks whether we have successfully processed this exposure 
+#
+########################################################################################
+sub isExposureAlreadyProcessed {
+    my ($db, $expId) = @_;
+
+    my $query = $db->prepare(<<SQL);
+
+SELECT COUNT(*) 
+    FROM batches 
+    WHERE exp_id = $expId 
+    AND processed = 1;
+
+SQL
+
+    $query->execute;
+
+    my $processed = $query->fetchrow_array();
+
+    if ($processed) {print "* Exposure ID '$expId' has already been processed\n";}
+
+    return $processed;
+}
+
+#######################################################################################
+#
+# Generates a new record in the database with a new jobId 
+#
+########################################################################################
+sub getNewBatchId {
+    my ($db, $expId,$surveyType) = @_;
+
+    my $query = $db->prepare(<<SQL);
+
+    SELECT batch_id 
+        FROM batches 
+        ORDER BY batch_id 
+        DESC LIMIT 1;
+SQL
+
+    $query->execute;
+
+    my $batchId = $query->fetchrow_array();
+
+    $batchId++;
+
+    $query = $db->prepare(<<SQL);
+    INSERT INTO batches
+        (batch_id, exp_id, survey_id)
+        VALUES
+        ($batchId, $expId, '$surveyType');
+
+SQL
+
+    $query->execute;
+
+    print "* New batch '$batchId' for exposure ID = $expId and survey = '$surveyType'\n";
+
+    return $batchId;
 }
 
@@ -276,17 +370,16 @@
 #######################################################################################
 sub runIppToPsps {
-    my ($db, $expId, $batchOutputPath, $batchType) = @_;
+    my ($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType) = @_;
 
     my $success = 0;
 
-    # before anything else, we can publish the init batch
     if ($batchType =~ /init/) {
         $success = produceInit($batchOutputPath);
     }
     elsif ($batchType =~ /det/) {
-        $success = produceDetections($db, $expId, $batchOutputPath);
+        $success = produceDetections($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath);
     }
     elsif ($batchType =~ /diff/) {
-        $success = produceDiffs($db, $expId, $batchOutputPath);
+        $success = produceDiffs($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath);
     }
 
@@ -532,5 +625,5 @@
     my $fullJobPath = "$path/$job";
 
-    my ($tempFile, $tempName) = tempfile( "/tmp/dsregList.XXXX", UNLINK => !$save_temps);
+    my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_dsregList.XXXX", UNLINK => !$save_temps);
 
     # loop through all batch files in this job directory
@@ -582,5 +675,5 @@
     my ($outputPath) = @_;
 
-    my $success = runProgram( "NULL", $outputPath, 0, $batchType);
+    my $success = runProgram("NULL", $outputPath, 0, "NULL", "NULL", $batchType);
     return $success;
 }
@@ -591,5 +684,5 @@
 #######################################################################################
 sub produceDetections {
-    my ($db,$expId,$outputPath) = @_;
+    my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_;
 
     # query to retrieve nebulous key of camera smf file for this exposure
@@ -602,5 +695,6 @@
         "JOIN chipRun USING(chip_id) ".
         "JOIN rawExp USING (exp_id) ".
-        "WHERE rawExp.exp_id = $expId AND camRun.magicked";
+        "WHERE rawExp.exp_id = $expId AND camRun.magicked ".
+        "ORDER BY camRun.cam_id DESC LIMIT 1";  # make sure we get most recently processed
 
     if ($verbose) { print"* $query\n";}
@@ -608,5 +702,5 @@
 
     # execute query and check results
-    my $results = $db->selectall_arrayref( $query );
+    my $results = $gpc1Db->selectall_arrayref( $query );
     my $size = @$results;
     if ($size < 1) {print "* No smf files found for this exposure\n"; return 0;}
@@ -622,9 +716,9 @@
 
         # now write the path to this file out to temp file
-        my ($tempFile, $tempName) = tempfile( "/tmp/inputFileList.XXXX", UNLINK => !$save_temps);
+        my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_inputFileList.XXXX", UNLINK => !$save_temps);
         print $tempFile $realFile . "\n";
         close $tempFile;
 
-        $success = runProgram($tempName, $outputPath, $expId, $batchType);
+        $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType);
         return $success;
     }
@@ -637,5 +731,5 @@
 #######################################################################################
 sub produceDiffs {
-    my ($db,$expId,$outputPath) = @_;
+    my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_;
 
     my $query = 
@@ -653,5 +747,5 @@
 
     # execute query and check results
-    my $results = $db->selectall_arrayref( $query );
+    my $results = $gpc1Db->selectall_arrayref( $query );
     my $size = @$results;
     if ($size < 1) {print "* No cmf files found for this exposure\n"; return 0;}
@@ -675,5 +769,5 @@
     }
 
-    my $ret = runProgram($tempName, $outputPath, $expId, $batchType);
+    my $ret = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType);
 
     close $tempFile;
@@ -688,5 +782,5 @@
 #######################################################################################
 sub runProgram {
-    my ($input, $output, $expid, $batchType) = @_;
+    my ($input, $output, $expid, $expName, $surveyType, $batchType) = @_;
 
     # build command
@@ -697,4 +791,6 @@
     $command .= " -config config"; # TODO
     $command .= " -expid $expid";
+    $command .= " -expname $expName";
+    $command .= " -survey $surveyType";
     $command .= " -batch $batchType";
     $command .= " -results $resultsFileName";
Index: /branches/czw_branch/20100519/ippToPsps/scripts/pspsSchema2xml.pl
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/scripts/pspsSchema2xml.pl	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/scripts/pspsSchema2xml.pl	(revision 28304)
@@ -122,4 +122,6 @@
     parseTable("Region");
     parseTable("StackType");
+    parseTable("ImageFlags");
+    parseTable("DetectionFlags");
 }
 
Index: /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.c
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.c	(revision 28304)
@@ -93,5 +93,4 @@
     if (this->numOfInputFiles < 1) return false;
 
-
     this->inputFiles = (char**)calloc(this->numOfInputFiles, sizeof(char*));
     for(uint32_t i=0; i<this->numOfInputFiles; i++)
@@ -144,4 +143,6 @@
     psMetadata *arguments = psMetadataAlloc();
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-expid", 0, "Exposure ID", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-expname", 0, "Exposure name", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-survey", 0, "Survey type", NULL);
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-input", 0, "Path to FITS inout", NULL);
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-output", 0, "Path to FITS output", NULL);
@@ -161,4 +162,6 @@
         if (tmp) this->expId = atoi(tmp);
         //free(tmp); tmp = NULL;
+        this->expName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-expname"));
+        this->surveyType = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-survey"));
         this->fitsInPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-input"));
         this->resultsPath = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-results"));
@@ -176,4 +179,6 @@
 
         if (
+                (this->batchType != BATCH_INIT && !this->expName) || 
+                (this->batchType != BATCH_INIT && !this->surveyType) || 
                 (this->batchType != BATCH_INIT && !this->fitsInPath) || 
                 (this->batchType != BATCH_INIT && !this->resultsPath) || 
@@ -237,4 +242,6 @@
 
     this->expId = -1;
+    this->expName = NULL;
+    this->surveyType = NULL;
     this->fitsInPath = NULL;
     this->resultsPath = NULL;
Index: /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.h
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/src/ippToPsps.h	(revision 28304)
@@ -21,4 +21,6 @@
 
     uint32_t expId;            // the exposure ID to be used
+    psString expName;          // the exposure name
+    psString surveyType;       // the survey type, eg 3PI, MD01, STS, SSS
     uint8_t batchType;         // PSPS batch type
     psString fitsInPath;       // path to FITS input
Index: /branches/czw_branch/20100519/ippToPsps/src/ippToPspsBatchDetection.c
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/src/ippToPspsBatchDetection.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/src/ippToPspsBatchDetection.c	(revision 28304)
@@ -63,10 +63,12 @@
     // FrameMeta values
     fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->expId, &status);
-
-    int8_t surveyID = 0; // TODO
+    fits_write_col(this->fitsOut, TSTRING, FRAMEMETA_FRAMENAME, 1, 1, 1, &this->expName, &status);
+
+    int8_t surveyID = -1;
+    if (!ippToPspsConfig_getSurveyId(this->config, this->surveyType, &surveyID)) {return PS_EXIT_DATA_ERROR;}
     fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &surveyID, &status);
 
     int8_t filterID = -1;
-    ippToPspsConfig_getFilterId(this->config, filterType, &filterID);
+    if (!ippToPspsConfig_getFilterId(this->config, filterType, &filterID)) {return PS_EXIT_DATA_ERROR;}
     fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_FILTERID, 1, 1, 1, &filterID, &status);
 
@@ -199,5 +201,7 @@
             skylist = dvoSkyListByExternID(this->dvoConfig, sourceId, imageId, &pImage);
             if (skylist == NULL) {
-                psError(PS_ERR_IO, false, "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping\n", sourceId, imageId, ccdNumber);
+                psError(PS_ERR_IO, false, 
+                        "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping\n", 
+                        sourceId, imageId, ccdNumber);
                 continue;
             }
@@ -386,4 +390,6 @@
     psLogMsg("ippToPsps", PS_LOG_INFO, "Data written for a total of %d chips/OTAs", nOta);
 
+    if (nOta < 1) return PS_EXIT_DATA_ERROR;
+
     return PS_EXIT_SUCCESS;
 }
Index: /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.c	(revision 28304)
@@ -325,4 +325,18 @@
 
     return ret;
+}
+
+// gets survey ID from survey name
+bool ippToPspsConfig_getSurveyId(IppToPspsConfig* this, const char* surveyType, int8_t* surveyId) {
+
+    char buffer[10];
+    if (!ippToPspsConfig_getInitValue(this, "Survey", "name", surveyType, "surveyID", buffer)) {
+
+        *surveyId = -1;
+        return false;
+    }
+
+    *surveyId = atoi(buffer);
+    return true;
 }
 
Index: /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.h
===================================================================
--- /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippToPsps/src/ippToPspsConfig.h	(revision 28304)
@@ -59,4 +59,5 @@
 // getters
 bool ippToPspsConfig_getFilterId(IppToPspsConfig* this, const char* filterType, int8_t* filterId);
+bool ippToPspsConfig_getSurveyId(IppToPspsConfig* this, const char* surveyType, int8_t* surveyId);
 
 #endif // IPPTOPSPSCONFIG_H
Index: /branches/czw_branch/20100519/ippTools/share/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/Makefile.am	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/Makefile.am	(revision 28304)
@@ -4,12 +4,17 @@
 
 dist_pkgdata_DATA = \
+     addtool_checkminidvodbaddrun.sql \
      addtool_donecleanup.sql \
      addtool_find_cam_id.sql \
      addtool_find_pendingexp.sql \
+     addtool_find_pendingmergeprocess.sql \
      addtool_find_processedexp.sql \
+     addtool_find_minidvodbprocessed.sql \
+     addtool_find_minidvodbrun.sql \
      addtool_pendingcleanupexp.sql \
      addtool_pendingcleanuprun.sql \
      addtool_queue_cam_id.sql \
-     addtool_reset_faulted_runs.sql \
+     addtool_queue_minidvodbrun.sql \
+     addtool_revertminidvodbprocessed.sql \
      addtool_revertprocessedexp.sql \
      camtool_donecleanup.sql \
@@ -21,5 +26,4 @@
      camtool_pendingcleanuprun.sql \
      camtool_queue_chip_id.sql \
-     camtool_reset_faulted_runs.sql \
      camtool_revertprocessedexp.sql \
      camtool_export_run.sql \
@@ -275,4 +279,5 @@
      regtool_updatebyquery.sql \
      regtool_updatebyqueryimfile.sql \
+     stacktool_associationdefine_select.sql \
      stacktool_definebyquery_insert.sql \
      stacktool_definebyquery_insert_random_part1.sql \
@@ -290,4 +295,5 @@
      stacktool_revertsumskyfile_delete.sql \
      stacktool_sumskyfile.sql \
+     stacktool_sassskyfile.sql \
      stacktool_tosum.sql \
      stacktool_tosummary.sql \
@@ -298,4 +304,5 @@
      staticskytool_todo.sql \
      staticskytool_result.sql \
+     staticskytool_revert.sql \
      warptool_change_skyfile_data_state.sql \
      warptool_change_run_state.sql \
Index: /branches/czw_branch/20100519/ippTools/share/addtool_checkminidvodbaddrun.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_checkminidvodbaddrun.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_checkminidvodbaddrun.sql	(revision 28304)
@@ -0,0 +1,20 @@
+-- this selects the minidvodbs that have complete addRuns
+SELECT minidvodb_id, minidvodb_name, minidvodb_path, mergedvodb_path, state, minidbg 
+AS minidvodb_group, (cnt - cnt2) as not_full, cnt as addRun_count
+FROM minidvodbRun 
+JOIN 
+   (SELECT minidvodb_name, count(state) as cnt2, cnt, minidbg, minidbn 
+   FROM addRun LEFT JOIN 
+       -- this select grabs (and counts) all the addRuns with any state
+       -- and groups them by the name
+       (SELECT minidvodb_group as minidbg, minidvodb_name as minidbn, count(state) 
+        AS cnt 
+        FROM addRun 
+        GROUP BY minidvodb_name ) 
+   AS foo1 ON minidvodb_name = minidbn
+        -- the second select grabs and counts all the addRuns with state
+        -- of 'full'         
+   WHERE addRun.state = 'full' 
+   GROUP BY minidvodb_name ) 
+AS foo2 
+USING(minidvodb_name) 
Index: /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbprocessed.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbprocessed.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbprocessed.sql	(revision 28304)
@@ -0,0 +1,8 @@
+SELECT
+    minidvodbProcessed.*,
+    minidvodbRun.minidvodb_name	
+    minidvodbRun.minidvodb_group
+FROM minidvodbProcessed
+JOIN minidvodbRun
+    USING(minidvodb_id)
+
Index: /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun.sql	(revision 28304)
@@ -0,0 +1,5 @@
+SELECT
+    minidvodbRun.*
+FROM minidvodbRun
+
+
Index: /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun2.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun2.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_find_minidvodbrun2.sql	(revision 28304)
@@ -0,0 +1,23 @@
+-- this selects the minidvodbs that have complete addRuns
+SELECT minidvodb_name, minidvodb_path, mergedvodb_path, state, minidbg 
+AS minidvodb_group 
+FROM minidvodbRun 
+JOIN 
+   (SELECT minidvodb_name, count(state) as cnt2, cnt, minidbg, minidbn 
+   FROM addRun LEFT JOIN 
+       -- this select grabs (and counts) all the addRuns with any state
+       -- and groups them by the name
+       (SELECT minidvodb_group as minidbg, minidvodb_name as minidbn, count(state) 
+        AS cnt 
+        FROM addRun 
+        GROUP BY minidvodb_name ) 
+   AS foo1 ON minidvodb_name = minidbn
+        -- the second select grabs and counts all the addRuns with state
+        -- of 'full'	     
+   WHERE addRun.state = 'full' 
+   GROUP BY minidvodb_name ) 
+AS foo2 
+USING(minidvodb_name) 
+WHERE cnt2 = cnt
+       -- the 3rd select only grabs the columns where the counts are the same
+       -- (same number of 'full' and any state)
Index: /branches/czw_branch/20100519/ippTools/share/addtool_find_pendingmergeprocess.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_find_pendingmergeprocess.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_find_pendingmergeprocess.sql	(revision 28304)
@@ -0,0 +1,5 @@
+SELECT minidvodbRun.* 
+FROM minidvodbRun 
+LEFT JOIN minidvodbProcessed
+USING(minidvodb_id)
+WHERE (minidvodbRun.state = 'to_be_merged' AND minidvodbProcessed.minidvodb_id IS NULL)
Index: /branches/czw_branch/20100519/ippTools/share/addtool_find_processedexp.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_find_processedexp.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_find_processedexp.sql	(revision 28304)
@@ -2,6 +2,8 @@
     addProcessedExp.*,
     addRun.workdir
-FROM addRun
-JOIN camProcessedExp
+FROM addProcessedExp
+JOIN addRun
+    USING(add_id)
+JOIN camRun
     USING(cam_id)
 JOIN chipRun
Index: /branches/czw_branch/20100519/ippTools/share/addtool_queue_cam_id.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_queue_cam_id.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_queue_cam_id.sql	(revision 28304)
@@ -11,5 +11,8 @@
         '%s',           -- dvodb 
         '%s',           -- note
-	%d		-- image_only
+	%d,		-- image_only
+	%d,		-- minidvodb
+	'%s',           -- minidvodb_group 
+ 	'%s'	        -- minidvodb_name
     FROM camRun
     WHERE
Index: /branches/czw_branch/20100519/ippTools/share/addtool_queue_minidvodbrun.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_queue_minidvodbrun.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_queue_minidvodbrun.sql	(revision 28304)
@@ -0,0 +1,12 @@
+-- create rcRun's for all destinations that have filesets that they are interested in available
+INSERT INTO minidvodbRun
+SELECT                  -- rows in this select must match rcRun
+    minidvodb_name,
+    minidvodb_path,
+    mergedvodb_path,
+    'new'
+
+FROM addRun 
+LEFT JOIN minidvodbRun USING(minidvodb_name)
+-- WHERE minidvodbRun.minidvodb_name IS NULL
+  
Index: anches/czw_branch/20100519/ippTools/share/addtool_reset_faulted_runs.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_reset_faulted_runs.sql	(revision 28303)
+++ 	(revision )
@@ -1,8 +1,0 @@
-UPDATE addRun, addProcessedExp, camRun, chipRun, rawExp
-SET addRun.state = 'new'
-WHERE
-    addRun.add_id = addProcessedExp.add_id
-    AND addRun.cam_id = camRun.cam_id
-    AND camRun.chip_id = chipRun.chip_id
-    AND chipRun.exp_id = rawExp.exp_id
-    AND addProcessedExp.fault != 0
Index: /branches/czw_branch/20100519/ippTools/share/addtool_revertminidvodbprocessed.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_revertminidvodbprocessed.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_revertminidvodbprocessed.sql	(revision 28304)
@@ -0,0 +1,7 @@
+DELETE FROM minidvodbProcessed
+USING minidvodbProcessed, minidvodbRun, addRun
+WHERE
+    minidvodbProcessed.minidvodb_id = minidvodbRun.minidvodb_id
+    AND addRun.minidvodb_name = minidvodbRun.minidvodb_name
+    AND minidvodbProcessed.fault != 0
+    AND minidvodbRun.state = 'new'
Index: /branches/czw_branch/20100519/ippTools/share/addtool_revertprocessedexp.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/addtool_revertprocessedexp.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/addtool_revertprocessedexp.sql	(revision 28304)
@@ -7,2 +7,3 @@
     AND chipRun.exp_id = rawExp.exp_id
     AND addProcessedExp.fault != 0
+    AND addRun.state = 'new'
Index: /branches/czw_branch/20100519/ippTools/share/camtool_queue_chip_id.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/camtool_queue_chip_id.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/camtool_queue_chip_id.sql	(revision 28304)
@@ -13,14 +13,19 @@
         '%s',           -- reduction
         '%s',           -- expgroup
-        '%s',           -- dvodb 
+        '%s',           -- dvodb
         '%s',           -- tess_id
         '%s',           -- end_stage
         %lld,           -- magicked
-	'%s',           -- software ver
-	'%s',           -- maskfrac_npix
-	'%s',           --         _static
-	'%s',           --         _dynamic
-	'%s',           --         _magic
-	'%s',           --         _advisory
+        '%s',           -- software ver
+        '%s',           -- maskfrac_ref_npix
+        '%s',           --         _ref_static
+        '%s',           --         _ref_dynamic
+        '%s',           --         _ref_magic
+        '%s',           --         _ref_advisory
+        '%s',           -- maskfrac_max_npix
+        '%s',           --         _max_static
+        '%s',           --         _max_dynamic
+        '%s',           --         _max_magic
+        '%s',           --         _max_advisory
         '%s'            -- note
     FROM chipRun
Index: anches/czw_branch/20100519/ippTools/share/camtool_reset_faulted_runs.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/camtool_reset_faulted_runs.sql	(revision 28303)
+++ 	(revision )
@@ -1,7 +1,0 @@
-UPDATE camRun, camProcessedExp, chipRun, rawExp
-SET camRun.state = 'new'
-WHERE
-    camRun.cam_id = camProcessedExp.cam_id
-    AND camRun.chip_id = chipRun.chip_id
-    AND chipRun.exp_id = rawExp.exp_id
-    AND camProcessedExp.fault != 0
Index: /branches/czw_branch/20100519/ippTools/share/camtool_revertprocessedexp.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/camtool_revertprocessedexp.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/camtool_revertprocessedexp.sql	(revision 28304)
@@ -6,2 +6,3 @@
     AND chipRun.exp_id = rawExp.exp_id
     AND camProcessedExp.fault != 0
+    AND camRun.state = 'new'
Index: /branches/czw_branch/20100519/ippTools/share/pstamptool_getdependent.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/pstamptool_getdependent.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/pstamptool_getdependent.sql	(revision 28304)
@@ -1,5 +1,3 @@
 SELECT DISTINCT pstampDependent.*
 FROM pstampDependent
--- JOIN pstampJob USING(dep_id)
--- JOIN pstampRequest USING(req_id)
 WHERE pstampDependent.state = 'new'
Index: /branches/czw_branch/20100519/ippTools/share/pstamptool_revertdependent.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/pstamptool_revertdependent.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/pstamptool_revertdependent.sql	(revision 28304)
@@ -4,2 +4,3 @@
 SET pstampDependent.fault = 0
 WHERE pstampDependent.state = 'new'
+    AND (pstampDependent.fault > 0)
Index: /branches/czw_branch/20100519/ippTools/share/pxadmin_create_tables.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/pxadmin_create_tables.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/pxadmin_create_tables.sql	(revision 28304)
@@ -1060,13 +1060,4 @@
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
-CREATE TABLE stackSummary (
-    stack_id     BIGINT,
-    projection_cell VARCHAR(64) NOT NULL,
-    path_base   VARCHAR(255) NOT NULL,
-    PRIMARY KEY(stack_id),
-    KEY(projection_cell),
-    FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id)
-) ENGINE=innodb DEFAULT CHARSET=latin1;
-
 CREATE TABLE stackAssociation (
     sass_id      BIGINT AUTO_INCREMENT,
@@ -1087,4 +1078,13 @@
     FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id),
     FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
+CREATE TABLE stackSummary (
+    sass_id     BIGINT,
+    projection_cell VARCHAR(64) NOT NULL,
+    path_base   VARCHAR(255) NOT NULL,
+    PRIMARY KEY(sass_id),
+    KEY(projection_cell),
+    FOREIGN KEY(sass_id) REFERENCES stackAssociation(sass_id)
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
@@ -1448,4 +1448,9 @@
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
+CREATE TABLE pstampWebRequest (
+        num BIGINT AUTO_INCREMENT,
+        PRIMARY KEY(num)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+
 CREATE TABLE distTarget (
     target_id   BIGINT AUTO_INCREMENT,
Index: /branches/czw_branch/20100519/ippTools/share/pxadmin_drop_tables.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/pxadmin_drop_tables.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/pxadmin_drop_tables.sql	(revision 28304)
@@ -41,10 +41,15 @@
 DROP TABLE IF EXISTS warpSkyfile;
 DROP TABLE IF EXISTS warpMask;
+DROP TABLE IF EXISTS warpSummary;
 DROP TABLE IF EXISTS diffRun;
 DROP TABLE IF EXISTS diffInputSkyfile;
 DROP TABLE IF EXISTS diffSkyfile;
+DROP TABLE IF EXISTS diffSummary;
 DROP TABLE IF EXISTS stackRun;
 DROP TABLE IF EXISTS stackInputSkyfile;
 DROP TABLE IF EXISTS stackSumSkyfile;
+DROP TABLE IF EXISTS stackSummary;
+DROP TABLE IF EXISTS stackAssociation;
+DROP TABLE IF EXISTS stackAssociationMap;
 DROP TABLE IF EXISTS magicRun;
 DROP TABLE IF EXISTS magicInputSkyfile;
@@ -85,4 +90,5 @@
 DROP TABLE IF EXISTS staticskyRun;
 DROP TABLE IF EXISTS Label;
+DROP TABLE IF EXISTS pstampWebRequest;
 
 SET FOREIGN_KEY_CHECKS=1
Index: /branches/czw_branch/20100519/ippTools/share/staticskytool_revert.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/staticskytool_revert.sql	(revision 28304)
+++ /branches/czw_branch/20100519/ippTools/share/staticskytool_revert.sql	(revision 28304)
@@ -0,0 +1,5 @@
+DELETE FROM staticskyResult
+USING staticskyResult, staticskyRun
+WHERE staticskyRun.sky_id = staticskyResult.sky_id
+    AND staticskyRun.state = 'new'
+    AND staticskyResult.fault != 0
Index: /branches/czw_branch/20100519/ippTools/share/staticskytool_todo.sql
===================================================================
--- /branches/czw_branch/20100519/ippTools/share/staticskytool_todo.sql	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/share/staticskytool_todo.sql	(revision 28304)
@@ -4,5 +4,7 @@
     staticskyRun.reduction,
     staticskyRun.label,
-    staticskyRun.state
+    staticskyRun.state,
+    stackRun.tess_id,
+    stackRun.skycell_id
 FROM staticskyRun
 JOIN staticskyInput USING (sky_id)
Index: /branches/czw_branch/20100519/ippTools/src/addtool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/addtool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/addtool.c	(revision 28304)
@@ -40,4 +40,15 @@
 static bool maskedMode(pxConfig *config);
 static bool unblockMode(pxConfig *config);
+static bool addminidvodbrunMode(pxConfig *config);
+static bool updateminidvodbrunMode(pxConfig *config);
+static bool listminidvodbrunMode(pxConfig *config);
+static bool flipminidvodbrunMode(pxConfig *config);
+static bool checkminidvodbrunaddrunMode(pxConfig *config);
+static bool addminidvodbprocessedMode(pxConfig *config);
+static bool listminidvodbprocessedMode(pxConfig *config);
+static bool revertminidvodbprocessedMode(pxConfig *config);
+static bool updateminidvodbprocessedMode(pxConfig *config);
+
+
 
 # define MODECASE(caseName, func) \
@@ -69,4 +80,14 @@
         MODECASE(ADDTOOL_MODE_MASKED,               maskedMode);
         MODECASE(ADDTOOL_MODE_UNBLOCK,              unblockMode);
+        MODECASE(ADDTOOL_MODE_ADDMINIDVODBRUN,      addminidvodbrunMode);
+        MODECASE(ADDTOOL_MODE_UPDATEMINIDVODBRUN,   updateminidvodbrunMode);
+        MODECASE(ADDTOOL_MODE_LISTMINIDVODBRUN,     listminidvodbrunMode);
+        MODECASE(ADDTOOL_MODE_FLIPMINIDVODBRUN,     flipminidvodbrunMode);
+        MODECASE(ADDTOOL_MODE_CHECKMINIDVODBRUNADDRUN, checkminidvodbrunaddrunMode);
+        MODECASE(ADDTOOL_MODE_ADDMINIDVODBPROCESSED,addminidvodbprocessedMode);
+        MODECASE(ADDTOOL_MODE_LISTMINIDVODBPROCESSED,listminidvodbprocessedMode);
+        MODECASE(ADDTOOL_MODE_REVERTMINIDVODBPROCESSED,revertminidvodbprocessedMode);
+        MODECASE(ADDTOOL_MODE_UPDATEMINIDVODBPROCESSED,updateminidvodbprocessedMode);
+
         default:
             psAbort("invalid option (this should not happen)");
@@ -102,4 +123,5 @@
     PXOPT_COPY_STR(config->args, where,  "-reduction", "camRun.reduction", "==");
 
+
     if (!psListLength(where->list)) {
         psFree(where);
@@ -114,8 +136,13 @@
     PXOPT_LOOKUP_STR(reduction,   config->args, "-set_reduction", false, false);
     PXOPT_LOOKUP_STR(note,        config->args, "-set_note", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", false, false);
     PXOPT_LOOKUP_BOOL(image_only, config->args, "-image_only", false);
+    PXOPT_LOOKUP_BOOL(minidvodb,  config->args, "-set_minidvodb", false);
     PXOPT_LOOKUP_BOOL(destreaked, config->args, "-destreaked", false);
     PXOPT_LOOKUP_BOOL(pretend,    config->args, "-pretend", false);
     PXOPT_LOOKUP_BOOL(simple,     config->args, "-simple", false);
+
+
 
     // find the cam_id of all the exposures that we want to queue up.
@@ -245,8 +272,11 @@
                                dvodb       ? dvodb     : row->dvodb,
                                note        ? note      : NULL,
-                               image_only
+                               image_only,
+                               minidvodb,
+                               minidvodb_group,
+                               minidvodb_name
         )) {
             if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
+                psError(PS_ERR_UNKNOWN, false, "database error sfg");
             }
             psError(PS_ERR_UNKNOWN, false,
@@ -291,5 +321,5 @@
 
     // pxUpdateRun gets parameters from config->args and runs the update query
-    bool result = pxUpdateRun(config, where, &query, "addRun", "add_id", 
+    bool result = pxUpdateRun(config, where, &query, "addRun", "add_id",
         "addProcessedExp", false);
 
@@ -374,4 +404,6 @@
     PXOPT_LOOKUP_STR(path_base,     config->args, "-path_base", false, false);
     PXOPT_LOOKUP_F32(dtime_addstar, config->args, "-dtime_addstar", false, false);
+    PXOPT_LOOKUP_STR(dvodb_path, config->args, "-dvodb_path", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-minidvodb_name", false, false);
     PXOPT_LOOKUP_S16(fault,         config->args, "-fault", false, false);
 
@@ -399,4 +431,5 @@
         return false;
     }
+
     psFree(query);
 
@@ -424,4 +457,5 @@
         dtime_addstar,
         path_base,
+        dvodb_path,
         fault
         );
@@ -437,4 +471,22 @@
         return false;
     }
+
+    //if there is a minidvodb_name, set it in addRun (it's not known until it is processed)
+    if (minidvodb_name) {
+      psString setName = NULL;
+      psStringAppend (&setName, "UPDATE addRun set minidvodb_name = '%s' where add_id = %" PRId64, minidvodb_name, row->add_id);
+      if (!p_psDBRunQuery(config->dbh, setName)) {
+        if (!psDBRollback(config->dbh)) {
+          psError(PS_ERR_UNKNOWN, false, "database error");
+        }
+        psError(PS_ERR_UNKNOWN, false, "database error");
+
+        return false;
+      }
+    }
+
+
+
+
 
     // since there is only one exp per 'new' set addRun.state = 'full'
@@ -522,5 +574,5 @@
 
     if (!p_psDBRunQuery(config->dbh, query)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
+      psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
         return false;
@@ -576,6 +628,10 @@
 
     {
-        psString query = pxDataGet("addtool_reset_faulted_runs.sql");
+        psString query = pxDataGet("addtool_revertprocessedexp.sql");
         if (!query) {
+            // rollback
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
             psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
             psFree(where);
@@ -602,36 +658,4 @@
         psFree(query);
     }
-
-    {
-        psString query = pxDataGet("addtool_revertprocessedexp.sql");
-        if (!query) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
-            psFree(where);
-            return false;
-        }
-
-        // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
-        if (where && psListLength(where->list)) {
-            psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-            psStringAppend(&query, " AND %s", whereClause);
-            psFree(whereClause);
-        }
-
-        if (!p_psDBRunQuery(config->dbh, query)) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PS_ERR_UNKNOWN, false, "database error");
-            psFree(query);
-            psFree(where);
-            return false;
-        }
-        psFree(query);
-    }
     psFree(where);
 
@@ -733,2 +757,813 @@
     return true;
 }
+
+static bool addminidvodbrunMode(pxConfig *config)
+{
+  PS_ASSERT_PTR_NON_NULL(config, NULL);
+
+  // required
+
+  PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", true, false);
+  PXOPT_LOOKUP_STR(mergedvodb_path, config->args, "-set_mergedvodb_path", true, false);
+
+  //optional
+  PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-set_minidvodb_name", false, false);
+  PXOPT_LOOKUP_STR(minidvodb_path, config->args, "-set_minidvodb_path", false, false);
+  PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
+
+  if (!psDBTransaction(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+  psString minidvodbpath = "NULL";
+
+  // I don't know how to get around the complaints of minidvodb_path can't be null. this 'fixes' it, but someone smarter can fix it properly.
+  if (minidvodb_path) {
+    minidvodbpath = minidvodb_path;
+  }
+
+  if (!minidvodbRunInsert(config->dbh,
+            0, // job_id
+            minidvodb_name,
+            minidvodb_group,
+            minidvodbpath,
+            mergedvodb_path,
+            "new",
+            0
+            )) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+  psU64 affected = psDBAffectedRows(config->dbh);
+  if (affected != 1) {
+    psError(PS_ERR_UNKNOWN, false,
+            "should have affected one row but %" PRIu64 " rows were modified",
+            affected);
+    return false;
+  }
+
+  psS64 minidvodb_id = psDBLastInsertID(config->dbh);
+  printf("%" PRId64 "\n", minidvodb_id);
+
+
+  if (!minidvodb_name) {
+    psStringAppend(&minidvodb_name, "%s.%" PRIu64,minidvodb_group,minidvodb_id);
+  }
+
+  if (!minidvodb_path) {
+    psStringAppend(&minidvodb_path,"%s/%s",mergedvodb_path,minidvodb_name);
+  }
+
+  psString query = NULL;
+
+  psStringAppend(&query, "UPDATE minidvodbRun SET minidvodb_path = '%s', minidvodb_name = '%s' where minidvodb_id = %" PRIu64";", minidvodb_path, minidvodb_name, minidvodb_id);
+
+  if (!p_psDBRunQuery(config->dbh, query)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query);
+    return false;
+  }
+
+  if (!psDBCommit(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+  return true;
+}
+
+static bool updateminidvodbrunMode(pxConfig *config) {
+  PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_S64(config->args, where, "-minidvodb_id",     "minidvodb_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-minidvodb_name",     "minidvodb_name", "==");
+    PXOPT_COPY_STR(config->args, where, "-state",     "state", "==");
+    PXOPT_COPY_STR(config->args, where, "-minidvodb_path", "minidvodb_path", "==");
+    PXOPT_COPY_STR(config->args, where, "-mergedvodb_path", "mergedvodb_path", "==");
+    PXOPT_COPY_STR(config->args, where, "-minidvodb_group",     "minidvodb_group", "==");
+
+    PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_path,  config->args, "-set_minidvodb_path", false, false);
+    PXOPT_LOOKUP_STR(state,  config->args, "-set_state", false, false);
+    PXOPT_LOOKUP_STR(mergedvodb_path,  config->args, "-set_mergedvodb_path", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_group,  config->args, "-set_minidvodb_group", false, false);
+
+
+    if (!psListLength(where->list)) {
+      psFree(where);
+      psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+      return false;
+    }
+
+    psString query = psStringCopy("UPDATE minidvodbRun SET ");
+    int cnt = 0;
+    psString comma = ",";
+    if (minidvodb_name) {
+      psStringAppend(&query, " minidvodb_name = '%s'", minidvodb_name);
+      cnt++;
+    }
+
+    if (minidvodb_path) {
+      if (cnt) {
+          psStringAppend(&query, "%s", comma);
+      }
+
+      psStringAppend(&query, " minidvodb_path = '%s'", minidvodb_path);
+      cnt++;
+    }
+
+    if (state) {
+      if (cnt) {
+        psStringAppend(&query, "%s", comma);
+      }
+      psStringAppend(&query, " state = '%s'", state);
+      cnt++;
+    }
+
+    if (mergedvodb_path) {
+      if (cnt) {
+        psStringAppend(&query, "%s", comma);
+      }
+      psStringAppend(&query, " mergedvodb_path = '%s'", mergedvodb_path);
+      cnt++;
+    }
+
+    if (minidvodb_group) {
+      if (cnt) {
+        psStringAppend(&query, "%s", comma);
+      }
+      psStringAppend(&query, " minidvodb_group = '%s'", minidvodb_group);
+      cnt++;
+    }
+
+    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+    psStringAppend(&query, " WHERE %s", whereClause);
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+      psFree(query);
+      return false;
+    }
+
+    psFree(query);
+    psFree(where);
+
+    return true;
+
+}
+
+static bool flipminidvodbrunMode(pxConfig *config) {
+  PS_ASSERT_PTR_NON_NULL(config, false);
+
+  psMetadata *where = psMetadataAlloc();
+  PXOPT_LOOKUP_STR(minidvodb_group,  config->args, "-minidvodb_group",true, false);
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_group",     "minidvodb_group", "==");
+
+//this flips the new - > active
+// and the active - > waiting in one action
+
+
+// the first query looks to find things that are new and where all the fields are filled (ie, ready to be flipped to active)
+
+// start a transaction eraly so it will contain any row level locks
+  if (!psDBTransaction(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+  psString firstquery = psStringCopy("SELECT * from  minidvodbRun where state = 'new' and minidvodb_name is NOT NULL and minidvodb_group IS NOT NULL and minidvodb_path IS NOT NULL and mergedvodb_path IS NOT NULL");
+
+  psString firstwhereClause = psDBGenerateWhereConditionSQL(where, NULL);
+  psStringAppend(&firstquery, " AND %s", firstwhereClause);
+
+
+
+  if (!p_psDBRunQuery(config->dbh, firstquery)) {
+    psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    return false;
+  }
+  psFree(firstquery);
+
+ //we don't care what the stuff is that is found, just that there is stuff. This is a check to see that there is something in the 'new' state, before flipping (so that if there is nothing in new, it won't flip the active to waiting.  the flipminidvo is just to make it easy to flip from new -> active.
+
+  psArray *output = p_psDBFetchResult(config->dbh);
+  if (!output) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+  if (!psArrayLength(output)) {
+    psTrace("addtool", PS_LOG_INFO, "no rows found");
+    psFree(output);
+    return true;
+  }
+
+
+  //ok, there's something, so flip active -> waiting
+
+  psString query = psStringCopy("UPDATE minidvodbRun SET state = 'waiting' WHERE state = 'active' ");
+
+  psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+  psStringAppend(&query, " AND %s", whereClause);
+
+
+  if (!p_psDBRunQuery(config->dbh, query)) {
+    psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    return false;
+  }
+
+
+  //now flip new -> active
+  psString query2 = psStringCopy("UPDATE minidvodbRun SET state = 'active' WHERE state = 'new' AND minidvodb_name is NOT NULL and minidvodb_group IS NOT NULL and minidvodb_path IS NOT NULL and mergedvodb_path IS NOT NULL ");
+  psStringAppend(&query2, " AND minidvodb_group = '%s' limit 1;", minidvodb_group);
+  if (!p_psDBRunQuery(config->dbh, query2)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psFree(query);
+    return false;
+  }
+
+
+  if (!psDBCommit(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psFree(query);
+  return false;
+  }
+ psFree(query2);
+ psFree(where);
+
+ return true;
+
+}
+
+
+static bool checkminidvodbrunaddrunMode(pxConfig *config) {
+  PS_ASSERT_PTR_NON_NULL(config, false);
+  psMetadata *where = psMetadataAlloc();
+
+  //this checks to see if a minidvod_group/name is has completed addRun processing
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_group", "minidvodbRun.minidvodb_group", "==");
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_name", "minidvodbRun.minidvodb_name", "==");
+  PXOPT_COPY_STR(config->args, where, "-state", "minidvodbRun.state", "==");
+
+
+  PXOPT_LOOKUP_U64(limit,      config->args, "-limit", false, false);
+  PXOPT_LOOKUP_BOOL(all_addrun_states, config->args, "-all_addrun_states", false);
+  //this doesn't care what state the addRun is in (useful for counting addRuns)
+  PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+
+  if (!psListLength(where->list)) {
+        psFree(where);
+        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+        return false;
+  }
+
+  psString query = pxDataGet("addtool_checkminidvodbaddrun.sql");
+
+  if (!query) {
+        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+        return false;
+  }
+
+
+  if (psListLength(where->list)) {
+    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, " WHERE %s", whereClause);
+        psFree(whereClause);
+  }
+
+  if (!all_addrun_states) {
+    psStringAppend(&query, " AND (cnt2 = cnt) ");
+  }
+
+  if (limit) {
+    psString limitString = psDBGenerateLimitSQL(limit);
+    psStringAppend(&query, " %s", limitString);
+    psFree(limitString);
+  }
+
+
+  if (!p_psDBRunQuery(config->dbh, query)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query);
+    return false;
+  }
+  psFree(query);
+  psArray *output = p_psDBFetchResult(config->dbh);
+  if (!output) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+  if (!psArrayLength(output)) {
+    psTrace("addtool", PS_LOG_INFO, "no rows found");
+    psFree(output);
+    return true;
+  }
+
+  if (!ippdbPrintMetadatas(stdout, output, "minidvodbRun", !simple)) {
+    psError(PS_ERR_UNKNOWN, false, "failed to print array");
+    psFree(output);
+    return false;
+  }
+
+  psFree(output);
+
+  return true;
+}
+
+
+
+static bool listminidvodbrunMode(pxConfig *config) {
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    psMetadata *where = psMetadataAlloc();
+
+    PXOPT_COPY_STR(config->args, where, "-minidvodb_name", "minidvodbRun.minidvodb_name", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-minidvodb_group", "minidvodbRun.minidvodb_group", "==");
+    PXOPT_COPY_S64(config->args, where, "-minidvodb_id", "minidvodbRun.minidvodb_id", "==");
+
+    PXOPT_COPY_STR(config->args, where, "-state", "minidvodbRun.state", "==");
+    PXOPT_LOOKUP_U64(limit,      config->args, "-limit", false, false);
+    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+
+
+    if (!psListLength(where->list)) {
+      psFree(where);
+      psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+      return false;
+    }
+
+    psString query = pxDataGet("addtool_find_minidvodbrun.sql");
+
+    if (!query) {
+      psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+      return false;
+    }
+
+    if (psListLength(where->list)) {
+      psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+      psStringAppend(&query, " WHERE %s", whereClause);
+      psFree(whereClause);
+    }
+
+    if (limit) {
+      psString limitString = psDBGenerateLimitSQL(limit);
+      psStringAppend(&query, " %s", limitString);
+      psFree(limitString);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+      psFree(query);
+      return false;
+    }
+
+    psFree(query);
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+      return false;
+    }
+    if (!psArrayLength(output)) {
+      psTrace("addtool", PS_LOG_INFO, "no rows found");
+      psFree(output);
+      return true;
+    }
+
+    if (!ippdbPrintMetadatas(stdout, output, "minidvodbRun",  !simple)) {
+      psError(PS_ERR_UNKNOWN, false, "failed to print array");
+      psFree(output);
+      return false;
+    }
+
+    psFree(output);
+
+return true;
+}
+
+static bool addminidvodbprocessedMode(pxConfig *config) {
+
+  PS_ASSERT_PTR_NON_NULL(config, false);
+
+    // required
+  PXOPT_LOOKUP_U64(minidvodb_id, config->args, "-minidvodb_id", true, false);
+  PXOPT_LOOKUP_STR(mergedvodb_path, config->args, "-mergedvodb_path", true, false);
+  PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-minidvodb_group", true, false);
+
+    // optional
+  PXOPT_LOOKUP_U64(merge_order,     config->args, "-merge_order", false, false);
+  PXOPT_LOOKUP_F32(dtime_relphot, config->args, "-dtime_relphot", false, false);
+  PXOPT_LOOKUP_F32(dtime_resort, config->args, "-dtime_resort", false, false);
+  PXOPT_LOOKUP_F32(dtime_merge, config->args, "-dtime_merge", false, false);
+  PXOPT_LOOKUP_TIME(epoch, config->args, "-epoch", false, false);
+  PXOPT_LOOKUP_S16(fault,         config->args, "-fault", false, false);
+    //generate restrictions
+  psMetadata *where = psMetadataAlloc();
+  PXOPT_COPY_S64(config->args, where, "-minidvodb_id",   "minidvodbRun.minidvodb_id",   "==");
+
+
+  if (!psDBTransaction(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+
+  psString query = pxDataGet("addtool_find_pendingmergeprocess.sql");
+  if (!query) {
+    psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+    return false;
+  }
+  // use psDBGenerateWhereSQL because the SQL yields an intermediate table
+  if (psListLength(where->list)) {
+    psString whereClaus = psDBGenerateWhereConditionSQL(where, NULL);
+    psStringAppend(&query, " AND %s", whereClaus);
+    psFree(whereClaus);
+  }
+  psFree(where);
+
+  if (!p_psDBRunQuery(config->dbh, query)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query);
+    return false;
+  }
+  psFree(query);
+
+  psArray *output = p_psDBFetchResult(config->dbh);
+  if (!output) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+  if (!psArrayLength(output)) {
+    psTrace("addtool", PS_LOG_INFO, "no rows found");
+    psFree(output);
+    return true;
+  }
+
+  minidvodbRunRow *pendingRow = minidvodbRunObjectFromMetadata(output->data[0]);
+  psFree(output);
+  minidvodbProcessedRow *row = minidvodbProcessedRowAlloc(
+               pendingRow->minidvodb_id,
+               merge_order,
+               dtime_resort,
+               dtime_relphot,
+               dtime_merge,
+               epoch,
+               mergedvodb_path,
+               fault
+               );
+
+  if (!minidvodbProcessedInsertObject(config->dbh, row)) {
+    // rollback
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(row);
+    psFree(pendingRow);
+    return false;
+  }
+
+
+
+
+  //this finds the # of merged things (for the merge order)
+  psString query3 = NULL;
+  psStringAppend(&query3, "select count(*) from minidvodbRun join minidvodbProcessed using (minidvodb_id) where state = 'merged' and minidvodb_group = '%s';", minidvodb_group);
+
+  if (!p_psDBRunQuery(config->dbh, query3)) {
+    // rollback
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query3);
+    return false;
+  }
+  psArray *output2 = p_psDBFetchResult(config->dbh);
+  if (!output2) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+  if (!psArrayLength(output2)) {
+    psTrace("addtool", PS_LOG_INFO, "no rows found");
+    psFree(output);
+    return true;
+  }
+  bool status;
+  psS64 m_order = psMetadataLookupS64(&status, output2->data[0], "count(*)");
+  if (!status) {
+
+    psAbort("failed to lookup value for count column");
+    return false;
+  }
+  psString final = NULL;
+  psStringAppend(&final, "%" PRIu64, m_order);
+    //return false;
+  psFree(query3);
+  psFree(output2);
+
+
+
+  //update the merge_order
+
+  psString query4 = NULL;
+  psStringAppend(&query4, "update minidvodbProcessed set merge_order = %"PRIu64,m_order);
+  psStringAppend(&query4," where minidvodb_id = %" PRIu64,  minidvodb_id);
+  printf("%s", query4);
+  if (!p_psDBRunQuery(config->dbh, query4)) {
+    // rollback
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query4);
+    return false;
+  }
+  //
+psFree(query4);
+
+
+
+// since there is only one exp per 'new' set mindvodbRun.state = 'merged'
+
+  psString query2 = NULL ;
+  psStringAppend(&query2, "UPDATE minidvodbRun SET state = 'merged' WHERE minidvodb_id = %'" PRIu64, row->minidvodb_id);
+
+  if (!p_psDBRunQuery(config->dbh, query2)) {
+    // rollback
+    if (!psDBRollback(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+    }
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    psFree(query2);
+    return false;
+  }
+
+
+
+
+
+
+
+
+  psFree(row);
+  psFree(pendingRow);
+
+
+
+
+
+  //commit the changes
+  if (!psDBCommit(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+
+  //print the merge_order (why not!)
+  printf("%s", final);
+  psFree(final);
+
+  return true;
+}
+
+
+
+static bool listminidvodbprocessedMode(pxConfig *config) {
+  psMetadata *where = psMetadataAlloc();
+  PXOPT_COPY_S64(config->args, where, "-minidvodb_id", "minidvodbProcessed.minidvodb_id", "==");
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_name", "minidvodbProcessed.minidvodb_name", "==");
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_group", "minidvodbProcessed.minidvodb_group", "==");
+  PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
+  PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+  PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false);
+  if (!psListLength(where->list)) {
+        psFree(where);
+        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+        return false;
+    }
+
+  psString query = pxDataGet("addtool_find_minidvodbprocessed.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+        return false;
+    }
+
+if (psListLength(where->list)) {
+        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, " WHERE %s", whereClause);
+        psFree(whereClause);
+    }
+
+// we either add AND (condition) or WHERE (condition):
+    if (where->list && faulted) {
+        // list only faulted rows
+        psStringAppend(&query, " %s", " AND minidvodbProcessed.fault != 0");
+    }
+    if (where->list && !faulted) {
+        // don't list faulted rows
+        psStringAppend(&query, " %s", " AND minidvodbProcessed.fault = 0");
+    }
+    if (!where->list && faulted) {
+        // list only faulted rows
+        psStringAppend(&query, " %s", " WHERE minidvodbProcessed.fault != 0");
+    }
+    if (!where->list && !faulted) {
+        // don't list faulted rows
+        psStringAppend(&query, " %s", " WHERE minidvodbProcessed.fault = 0");
+    }
+    psFree(where);
+
+    // order by epoch
+    psStringAppend(&query, " ORDER BY minidvodb_id");
+
+    // treat limit == 0 as "no limit"
+    if (limit) {
+        psString limitString = psDBGenerateLimitSQL(limit);
+        psStringAppend(&query, " %s", limitString);
+        psFree(limitString);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+      psError(PS_ERR_UNKNOWN, false, "database error ");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
+        psTrace("addtool", PS_LOG_INFO, "no rows found");
+        psFree(output);
+        return true;
+    }
+
+    // negate simple so the default is true
+    if (!ippdbPrintMetadatas(stdout, output, "minidvodbProcessed", !simple)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print array");
+        psFree(output);
+        return false;
+    }
+
+    psFree(output);
+
+return true;
+}
+
+
+
+static bool revertminidvodbprocessedMode(pxConfig *config) {
+  psMetadata *where = psMetadataAlloc();
+  PS_ASSERT_PTR_NON_NULL(config, false);
+  PXOPT_COPY_S64(config->args, where, "-minidvodb_id", "minidvodbProcessed.minidvodb_id", "==");
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_group", "addRun.minidvodb_group", "==");
+
+  if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
+    psFree(where);
+    psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+    return false;
+  }
+
+  if (!psDBTransaction(config->dbh)) {
+      psError(PS_ERR_UNKNOWN, false, "database error");
+      psFree(where);
+      return false;
+  }
+
+  {
+    psString query = pxDataGet("addtool_revertminidvodbprocessed.sql");
+    if (!query) {
+      // rollback
+      if (!psDBRollback(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+      }
+      psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+      psFree(where);
+      return false;
+    }
+
+    // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
+    if (where && psListLength(where->list)) {
+      psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+      psStringAppend(&query, " AND %s", whereClause);
+      psFree(whereClause);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+      // rollback
+      if (!psDBRollback(config->dbh)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+      }
+      psError(PS_ERR_UNKNOWN, false, "database error");
+      psFree(query);
+      psFree(where);
+            return false;
+    }
+    psFree(query);
+  }
+  psFree(where);
+
+  if (!psDBCommit(config->dbh)) {
+    psError(PS_ERR_UNKNOWN, false, "database error");
+    return false;
+  }
+
+  return true;
+}
+
+
+
+static bool updateminidvodbprocessedMode(pxConfig *config) {
+  PS_ASSERT_PTR_NON_NULL(config, false);
+  psMetadata *where = psMetadataAlloc();
+
+  PXOPT_LOOKUP_U64(minidvodb_id,  config->args, "-minidvodb_id", true, false);
+  PXOPT_LOOKUP_U64(merge_order,  config->args, "-set_merge_order", false, false);
+  PXOPT_LOOKUP_S16(fault,  config->args, "-set_fault", false, false);
+  PXOPT_LOOKUP_F32(dtime_relphot,  config->args, "-set_dtime_relphot", false, false);
+  PXOPT_LOOKUP_F32(dtime_resort,  config->args, "-set_dtime_resort", false, false);
+  PXOPT_LOOKUP_F32(dtime_merge,  config->args, "-set_dtime_merge", false, false);
+
+  PXOPT_COPY_S64(config->args, where, "-minidvodb_id",     "minidvodbProcessed.minidvodb_id", "==");
+  PXOPT_COPY_STR(config->args, where, "-minidvodb_name",     "minidvodbRun.minidvodb_name", "==");
+
+
+  if (!psListLength(where->list)) {
+    psFree(where);
+    psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+    return false;
+  }
+
+  psString query = psStringCopy("UPDATE minidvodbProcessed JOIN minidvodbRun USING (minidvodb_id) SET ");
+  int cnt = 0;
+  psString comma = ",";
+  if (fault) {
+    psStringAppend(&query, " fault = %d", fault);
+  cnt++;
+  }
+
+  if (merge_order) {
+    if (cnt) {
+      psStringAppend(&query, "%s", comma);
+    }
+
+    psStringAppend(&query, " merge_order = %" PRId64, merge_order);
+    cnt++;
+  }
+
+  if (dtime_relphot) {
+    if (cnt) {
+      psStringAppend(&query, "%s", comma);
+    }
+    psStringAppend(&query, " dtime_relphot = %f", dtime_relphot);
+    cnt++;
+  }
+
+  if (dtime_resort) {
+    if (cnt) {
+      psStringAppend(&query, "%s", comma);
+    }
+    psStringAppend(&query, " dtime_resort = %f", dtime_resort);
+    cnt++;
+  }
+
+  if (dtime_merge) {
+    if (cnt) {
+      psStringAppend(&query, "%s", comma);
+    }
+    psStringAppend(&query, " dtime_merge = %f", dtime_merge);
+    cnt++;
+ }
+
+  psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+  psStringAppend(&query, " WHERE %s", whereClause);
+
+  if (!p_psDBRunQuery(config->dbh, query)) {
+   psError(PS_ERR_UNKNOWN, false, "database error");
+   psFree(query);
+   return false;
+  }
+
+  psFree(query);
+  psFree(where);
+
+  return true;
+}
+
+
Index: /branches/czw_branch/20100519/ippTools/src/addtool.h
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/addtool.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/addtool.h	(revision 28304)
@@ -39,5 +39,14 @@
     ADDTOOL_MODE_DONECLEANUP,
     ADDTOOL_MODE_EXPORTRUN,
-    ADDTOOL_MODE_IMPORTRUN
+    ADDTOOL_MODE_IMPORTRUN,
+    ADDTOOL_MODE_ADDMINIDVODBRUN,
+    ADDTOOL_MODE_UPDATEMINIDVODBRUN,
+    ADDTOOL_MODE_LISTMINIDVODBRUN,
+    ADDTOOL_MODE_FLIPMINIDVODBRUN,
+    ADDTOOL_MODE_CHECKMINIDVODBRUNADDRUN,
+    ADDTOOL_MODE_ADDMINIDVODBPROCESSED,
+    ADDTOOL_MODE_LISTMINIDVODBPROCESSED,
+    ADDTOOL_MODE_REVERTMINIDVODBPROCESSED,
+    ADDTOOL_MODE_UPDATEMINIDVODBPROCESSED
 } addtoolMode;
 
Index: /branches/czw_branch/20100519/ippTools/src/addtoolConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/addtoolConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/addtoolConfig.c	(revision 28304)
@@ -63,5 +63,7 @@
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",           0, "do not actually modify the database", false);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple",            0, "use the simple output format", false);
-
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb",            0, "use minidvodb", false);
+    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0,   "define minidvodb_group", NULL);
+    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_name", 0,   "define minidvodb_bname", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_data_group", 0,   "define new data_group", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
@@ -84,4 +86,5 @@
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
+
     // -pendingexp
     psMetadata *pendingexpArgs = psMetadataAlloc();
@@ -98,4 +101,6 @@
     psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-add_id", 0,            "define addtool ID (required)", 0);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base", 0,            "define base output location", NULL);
+     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dvodb_path", 0,            "define base output location", NULL);
+      psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-minidvodb_name", 0,            "define minidvodb_name", NULL);
     psMetadataAddF32(addprocessedexpArgs, PS_LIST_TAIL, "-dtime_addstar", 0, "define elapsed time for DVO insertion (seconds)", NAN);
     psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
@@ -142,4 +147,79 @@
     psMetadataAddStr(unblockArgs, PS_LIST_TAIL, "-label",  0,            "name of a label to unmask (required)", NULL);
 
+    // -addminidvodbruns
+    psMetadata *addminidvodbrunArgs = psMetadataAlloc();
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",        0, "define minidvodb_name", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group",        0, "define minidvodb_group (required)", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",        0, "define path for minidvodb", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_mergedvodb_path",        0, "define path for the merged dvodb (required)", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_state",        0, "define state", NULL);
+
+    // -updateminidvodbruns
+    psMetadata *updateminidvodbrunArgs = psMetadataAlloc();
+    psMetadataAddU64(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id ", 0);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",        0, "search by minidvodb_name (LIKE)", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name (LIKE)", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_path",        0, "search by path for minidvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-mergedvodb_path",        0, "search by path for the merged dvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-state",        0, "search by state", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",        0, "define minidvodb_name", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",        0, "define path for minidvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_mergedvodb_path",        0, "define path for minidvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group",        0, "define path for the merged dvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_state",        0, "define state", NULL);
+    
+    // -listminidvodbrunArgs
+    psMetadata *listminidvodbrunArgs = psMetadataAlloc();
+    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id", 0);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name (LIKE)", NULL);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",     0,    "search by minidvodb.minidvodb_group", NULL);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-state",        0, "search by state", NULL);
+    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-limit",        0, "limit to N items", 0);
+    psMetadataAddBool(listminidvodbrunArgs, PS_LIST_TAIL, "-simple",        0, "simple output", false);
+    
+    //psMetadataAddBool(listminidvodbrunArgs, PS_LIST_TAIL, "-finished_addrun",        0, "limit to minidvodbs with completed addRuns (none in new state)", false);
+    psMetadata *flipminidvodbrunArgs = psMetadataAlloc();
+    psMetadataAddStr(flipminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",     0,    "for the supplied minidvodb_group (required): flip the current 'new' to 'active', the current 'active' to 'waiting'", NULL);
+    
+    psMetadata *checkminidvodbrunaddrunArgs = psMetadataAlloc();
+    psMetadataAddStr(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-minidvodb_group",     0,    "for the supplied minidvodb_group (required): check if the addRun stage is complete (all in addRun.state = full) ", NULL);
+    psMetadataAddStr(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-minidvodb_name",     0,    "for the supplied minidvodb_name: check if the addRun stage is complete (all in addRun.state = full) ", NULL);
+    psMetadataAddStr(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-state",     0,    "limit by minidvodbRun state ", NULL);
+    psMetadataAddU64(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-limit",        0, "limit to N items", 0);
+    psMetadataAddBool(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-simple",        0, "simple output", false);
+    psMetadataAddBool(checkminidvodbrunaddrunArgs, PS_LIST_TAIL, "-all_addrun_states",        0, "list all minidvodbRun.minidvodb_names, not just ones that have complete addRuns", false);
+
+    psMetadata *addminidvodbprocessedArgs = psMetadataAlloc();
+    psMetadataAddU64(addminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_id", 0,    "define minidvodb_id (required)", 0);
+    psMetadataAddU64(addminidvodbprocessedArgs, PS_LIST_TAIL, "-merge_order",    0,    "define merge order", 0);
+    psMetadataAddF32(addminidvodbprocessedArgs, PS_LIST_TAIL, "-dtime_relphot",  0,    "define elapsed time for relphot (seconds)", NAN);
+    psMetadataAddF32(addminidvodbprocessedArgs, PS_LIST_TAIL, "-dtime_resort", 0,    "define elapsed time for resort (seconds)", NAN);
+    psMetadataAddF32(addminidvodbprocessedArgs, PS_LIST_TAIL, "-dtime_merge",    0,    "define elapsed time for DVO merge (seconds)", NAN);
+    psMetadataAddTime(addminidvodbprocessedArgs, PS_LIST_TAIL, "-epoch",         0,    "time merge is finished", NULL);
+    psMetadataAddStr(addminidvodbprocessedArgs, PS_LIST_TAIL, "-mergedvodb_path",0,    "path of merged dvodb", NULL);
+    psMetadataAddStr(addminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_group",0,    "minidvodb_group", NULL);
+    psMetadataAddS16(addminidvodbprocessedArgs, PS_LIST_TAIL, "-fault",          0,    "set fault code", 0);
+
+    psMetadata *listminidvodbprocessedArgs = psMetadataAlloc();
+    psMetadataAddU64(listminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id", 0);
+    psMetadataAddStr(listminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name", NULL);
+    psMetadataAddStr(listminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_group",        0, "search by minidvodb.minidvodb_group", NULL);
+    psMetadataAddU64(listminidvodbprocessedArgs, PS_LIST_TAIL, "-limit",        0, "limit to N items", 0);
+    psMetadataAddBool(listminidvodbprocessedArgs, PS_LIST_TAIL, "-simple",        0, "simple output", false);
+    psMetadataAddBool(listminidvodbprocessedArgs, PS_LIST_TAIL, "-faulted",        0, "limit to faulted state", false);
+
+    psMetadata *revertminidvodbprocessedArgs = psMetadataAlloc();
+    psMetadataAddU64(revertminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id", 0);
+    psMetadataAddStr(revertminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_group",        0, "search by addRun.minidvodb_group", NULL);
+
+    psMetadata *updateminidvodbprocessedArgs = psMetadataAlloc();
+    psMetadataAddU64(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id", 0);
+    psMetadataAddStr(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name", NULL);
+    psMetadataAddS16(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-set_fault",  0,            "set fault code", 0);
+    psMetadataAddU64(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-set_merge_order",    0,    "define merge order", 0);
+    psMetadataAddF32(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-set_dtime_relphot",  0,    "define elapsed time for relphot (seconds)", 0);
+    psMetadataAddF32(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-set_dtime_resort", 0,    "define elapsed time for resort (seconds)", 0);
+    psMetadataAddF32(updateminidvodbprocessedArgs, PS_LIST_TAIL, "-set_dtime_merge",    0,    "define elapsed time for DVO merge (seconds)", 0);
+    
     psMetadata *argSets = psMetadataAlloc();
     psMetadata *modes = psMetadataAlloc();
@@ -154,5 +234,16 @@
     PXOPT_ADD_MODE("-block",                "set a label block",                    ADDTOOL_MODE_BLOCK,         blockArgs);
     PXOPT_ADD_MODE("-masked",               "show blocked labels",                  ADDTOOL_MODE_MASKED,        maskedArgs);
-    PXOPT_ADD_MODE("-unblock",              "remove a label block",                 ADDTOOL_MODE_UNBLOCK,       unblockArgs);
+    PXOPT_ADD_MODE("-addminidvodbrun",      "create minidvodbs ",                   ADDTOOL_MODE_ADDMINIDVODBRUN, addminidvodbrunArgs);
+    PXOPT_ADD_MODE("-updateminidvodbrun",   "change minidvodb properties",          ADDTOOL_MODE_UPDATEMINIDVODBRUN,     updateminidvodbrunArgs);
+    PXOPT_ADD_MODE("-listminidvodbrun",     "list minidvodbs",                      ADDTOOL_MODE_LISTMINIDVODBRUN,       listminidvodbrunArgs);
+    PXOPT_ADD_MODE("-flipminidvodbrun",     "flip minidvodbs",                      ADDTOOL_MODE_FLIPMINIDVODBRUN,       flipminidvodbrunArgs);
+    PXOPT_ADD_MODE("-checkminidvodbrunaddrun", "check minidvodbs to see if addRuns are completed", ADDTOOL_MODE_CHECKMINIDVODBRUNADDRUN,       checkminidvodbrunaddrunArgs);
+    PXOPT_ADD_MODE("-addminidvodbprocessed","add a processed minidvodb",            ADDTOOL_MODE_ADDMINIDVODBPROCESSED,  addminidvodbprocessedArgs);
+    PXOPT_ADD_MODE("-listminidvodbprocessed","list processed minidvodbs",           ADDTOOL_MODE_LISTMINIDVODBPROCESSED, listminidvodbprocessedArgs);
+    PXOPT_ADD_MODE("-revertminidvodbprocessed","revert processed minidvobs",        ADDTOOL_MODE_REVERTMINIDVODBPROCESSED,     revertminidvodbprocessedArgs);
+    PXOPT_ADD_MODE("-updateminidvodbprocessed","change processed minidvodb properties",ADDTOOL_MODE_UPDATEMINIDVODBPROCESSED,  updateminidvodbprocessedArgs);
+ 
+ 
+
 
     if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Index: /branches/czw_branch/20100519/ippTools/src/camtool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/camtool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/camtool.c	(revision 28304)
@@ -503,5 +503,5 @@
 
 /*     psTrace("czw.test",1,"Received versions: pslib %s psmodules %s psphot %s psastro %s ppstats %s ppImage %s streaks %s\n", */
-/* 	    ver_pslib,ver_psmodules,ver_psphot,ver_psastro,ver_ppstats,ver_ppimage,ver_streaks); */
+/*          ver_pslib,ver_psmodules,ver_psphot,ver_psastro,ver_ppstats,ver_ppimage,ver_streaks); */
     psString software_ver = NULL;
     if ((ver_pslib)&&(ver_psmodules)) {
@@ -637,16 +637,16 @@
         path_base,
         fault,
-	software_ver,
-	maskfrac_ref_npix,
-	maskfrac_ref_static,
-	maskfrac_ref_dynamic,
-	maskfrac_ref_magic,
-	maskfrac_ref_advisory,
-	maskfrac_max_npix,
-	maskfrac_max_static,
-	maskfrac_max_dynamic,
-	maskfrac_max_magic,
-	maskfrac_max_advisory,
-	quality
+        software_ver,
+        maskfrac_ref_npix,
+        maskfrac_ref_static,
+        maskfrac_ref_dynamic,
+        maskfrac_ref_magic,
+        maskfrac_ref_advisory,
+        maskfrac_max_npix,
+        maskfrac_max_static,
+        maskfrac_max_dynamic,
+        maskfrac_max_magic,
+        maskfrac_max_advisory,
+        quality
         );
 
@@ -677,8 +677,8 @@
     if (!pxSetRunSoftware(config, "camRun", "cam_id", cam_id, software_ver)) {
       if (!psDBRollback(config->dbh)) {
-	psError(PS_ERR_UNKNOWN, false, "database error");
+        psError(PS_ERR_UNKNOWN, false, "database error");
       }
       psError(PS_ERR_UNKNOWN, false, "failed to set camRun.software_ver for cam_id: %" PRId64,
-	      cam_id);
+              cam_id);
       psFree(output);
       return(false);
@@ -687,15 +687,15 @@
     if (maskfrac_ref_npix) {
       if (!pxCamSetRunMaskfrac(config, "camRun", "cam_id",cam_id,
-			       (float) maskfrac_ref_npix, maskfrac_ref_static,
-			       maskfrac_ref_dynamic, maskfrac_ref_magic, maskfrac_ref_advisory,
-			       (float) maskfrac_max_npix, maskfrac_max_static,
-			       maskfrac_max_dynamic, maskfrac_max_magic, maskfrac_max_advisory)) {
-	if (!psDBRollback(config->dbh)) {
-	  psError(PS_ERR_UNKNOWN, false, "database error");
-	}
-	psError(PS_ERR_UNKNOWN, false, "failed to set camRun.maskstats for cam_id: %" PRId64,
-		cam_id);
-	psFree(output);
-	return(false);
+                               (float) maskfrac_ref_npix, maskfrac_ref_static,
+                               maskfrac_ref_dynamic, maskfrac_ref_magic, maskfrac_ref_advisory,
+                               (float) maskfrac_max_npix, maskfrac_max_static,
+                               maskfrac_max_dynamic, maskfrac_max_magic, maskfrac_max_advisory)) {
+        if (!psDBRollback(config->dbh)) {
+          psError(PS_ERR_UNKNOWN, false, "database error");
+        }
+        psError(PS_ERR_UNKNOWN, false, "failed to set camRun.maskstats for cam_id: %" PRId64,
+                cam_id);
+        psFree(output);
+        return(false);
       }
     }
@@ -709,10 +709,11 @@
         return false;
     }
-    
+
     psFree(row);
 
     // EAM:  NULL for end_stage means go as far as possible
     // Also, we can run fake even if tess_id is not defined
-    if (pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "cam")) {
+    // but stop if quality is non-zero.
+    if ((quality > 0) || (pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "cam"))) {
         psFree(pendingRow);
         if (!psDBCommit(config->dbh)) {
@@ -893,6 +894,10 @@
 
     {
-        psString query = pxDataGet("camtool_reset_faulted_runs.sql");
+        psString query = pxDataGet("camtool_revertprocessedexp.sql");
         if (!query) {
+            // rollback
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
             psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
             psFree(where);
@@ -919,36 +924,4 @@
         psFree(query);
     }
-
-    {
-        psString query = pxDataGet("camtool_revertprocessedexp.sql");
-        if (!query) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
-            psFree(where);
-            return false;
-        }
-
-        // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
-        if (where && psListLength(where->list)) {
-            psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-            psStringAppend(&query, " AND %s", whereClause);
-            psFree(whereClause);
-        }
-
-        if (!p_psDBRunQuery(config->dbh, query)) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PS_ERR_UNKNOWN, false, "database error");
-            psFree(query);
-            psFree(where);
-            return false;
-        }
-        psFree(query);
-    }
     psFree(where);
 
Index: /branches/czw_branch/20100519/ippTools/src/difftool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/difftool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/difftool.c	(revision 28304)
@@ -2290,5 +2290,5 @@
   if (psListLength(where->list)) {
     psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-    psStringAppend(&query, " WHERE %s", whereClause);
+    psStringAppend(&query, " AND %s", whereClause);
     psFree(whereClause);
   } else if (!all && !where2) {
@@ -2301,5 +2301,5 @@
       psStringAppend(&query, " %s", where2);
     } else {
-      psStringAppend(&query, " WHERE 1 %s", where2);
+      psStringAppend(&query, " AND 1 %s", where2);
     }
   }
Index: /branches/czw_branch/20100519/ippTools/src/disttool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/disttool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/disttool.c	(revision 28304)
@@ -148,5 +148,5 @@
     PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
 
-    if (use_alternate) { 
+    if (use_alternate) {
         if (strcmp(stage, "raw")) {
             psError(PXTOOLS_ERR_SYS, true, "alternate inputs only supported for raw stage");
@@ -299,17 +299,17 @@
       query = pxDataGet("disttool_definebyquery_SSdiff.sql");
       if (!query) {
-	psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
-	psFree(where);
-	return(false);
+        psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
+        psFree(where);
+        return(false);
       }
 
       if (label) {
-	psStringAppend(&query, " AND (diffRun.label = '%s') ", label);
+        psStringAppend(&query, " AND (diffRun.label = '%s') ", label);
       }
       if (dist_group) {
-	psStringAppend(&query, " AND (diffRun.dist_group = '%s') ", dist_group);
+        psStringAppend(&query, " AND (diffRun.dist_group = '%s') ", dist_group);
       }
 
-      no_magic = true;    
+      no_magic = true;
     } else {
         psError(PS_ERR_UNKNOWN, true, "unknown value for stage: %s", stage);
@@ -470,5 +470,14 @@
     PXOPT_COPY_STR(config->args, where, "-data_group", "distRun.data_group", "LIKE");
     PXOPT_COPY_STR(config->args, where, "-dist_group", "distTarget.dist_group", "==");
-    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
+    PXOPT_COPY_TIME(config->args, where, "-time_stamp_begin", "distRun.time_stamp", ">=");
+    PXOPT_COPY_TIME(config->args, where, "-time_stamp_end", "distRun.time_stamp", "<=");
+
+    PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false);
+    PXOPT_LOOKUP_BOOL(full, config->args, "-full", false);
+    if (clean && full) {
+        psFree(where);
+        psError(PXTOOLS_ERR_CONFIG, true, "-clean and -full are contradictory parameters");
+        return false;
+    }
 
     if (!psListLength(where->list)) {
@@ -491,4 +500,5 @@
     }
 
+    psString extraWhere = NULL;
     psString query = psStringCopy("UPDATE distRun join distTarget using(target_id, stage) SET distRun.time_stamp = UTC_TIMESTAMP()");
 
@@ -498,4 +508,8 @@
     if (state) {
         psStringAppend(&query, " , distRun.state = '%s'", state);
+        if (!strcmp(state, "goto_cleaned")) {
+            // don't queue for clean up if run has already already cleaned
+            psStringAppend(&extraWhere, " AND (distRun.state != 'cleaned' AND distRun.state != 'goto_cleaned')");
+        }
     }
 
@@ -521,4 +535,13 @@
     psFree(whereClause);
     psFree(where);
+
+    if (extraWhere) {
+        psStringAppend(&query, "%s", extraWhere);
+    }
+    if (clean) {
+        psStringAppend(&query, " AND (distRun.clean)");
+    } else if (full) {
+        psStringAppend(&query, " AND (!distRun.clean)");
+    }
 
     if (!p_psDBRunQuery(config->dbh, query)) {
@@ -1680,5 +1703,5 @@
         return false;
     }
-        
+
 
     PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
Index: /branches/czw_branch/20100519/ippTools/src/disttoolConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/disttoolConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/disttoolConfig.c	(revision 28304)
@@ -79,5 +79,10 @@
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-data_group",     0, "limit updates to data_group", NULL);
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-dist_group",     0, "limit updates to data_group", NULL);
+    psMetadataAddTime(updaterunArgs, PS_LIST_TAIL, "-time_stamp_begin", 0, "limit updates by time_stamp (>=)", NULL); 
+    psMetadataAddTime(updaterunArgs, PS_LIST_TAIL, "-time_stamp_end", 0, "limit updates by time_stamp (<=)", NULL); 
+    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL,"-clean",     0, "limit updates to clean distRuns", false);
+    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL,"-full",      0, "limit updates to not clean distRuns", false);
     psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-fault",      0, "define fault code", 0);
+
     // -revertrun
     psMetadata *revertrunArgs = psMetadataAlloc();
Index: /branches/czw_branch/20100519/ippTools/src/flatcorr.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/flatcorr.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/flatcorr.c	(revision 28304)
@@ -671,5 +671,8 @@
                 row->dvodb,
                 NULL,       // note is not propagated
-                0)) {
+                0,
+		0,  //The minidvodb stuff is off
+		NULL,
+		NULL)) {
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
Index: /branches/czw_branch/20100519/ippTools/src/magictool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/magictool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/magictool.c	(revision 28304)
@@ -1367,4 +1367,5 @@
             (strncmp(state, "new", 4) == 0)
             || (strncmp(state, "full", 5) == 0)
+            || (strncmp(state, "drop", 5) == 0)
             || (strncmp(state, "reg", 4) == 0)
         )
Index: /branches/czw_branch/20100519/ippTools/src/pstamptool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pstamptool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pstamptool.c	(revision 28304)
@@ -30,4 +30,5 @@
 #include "pxdata.h"
 #include "pstamptool.h"
+#include "pstamp.h"
 
 static bool adddatastoreMode(pxConfig *config);
@@ -53,4 +54,5 @@
 static bool updatedependentMode(pxConfig *config);
 static bool revertdependentMode(pxConfig *config);
+static bool getwebrequestnumMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -95,4 +97,5 @@
         MODECASE(PSTAMPTOOL_MODE_UPDATEDEPENDENT, updatedependentMode);
         MODECASE(PSTAMPTOOL_MODE_REVERTDEPENDENT, revertdependentMode);
+        MODECASE(PSTAMPTOOL_MODE_GETWEBREQUESTNUM, getwebrequestnumMode);
         default:
             psAbort("invalid option (this should not happen)");
@@ -939,10 +942,10 @@
     PXOPT_LOOKUP_S16(fault, config->args, "-fault",  false, false);
 
-    // By default only revert faults < 10 which are our "ipp exit codes"
+    // By default only revert faults < PSTAMP_FIRST_ERROR_CODE which are our "ipp exit codes"
     // codes larger than that are the pstamp request interface.
     // Don't fault those unless -fault waa provided
-    psString faultClause = "";
+    psString faultClause = psStringCopy("");
     if (!fault) {
-        faultClause = " \nAND (pstampJob.fault < 10)";
+        psStringAppend(&faultClause, " \nAND (pstampJob.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
     }
 
@@ -961,7 +964,11 @@
 
     if (!p_psDBRunQueryF(config->dbh, query, faultClause)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        return false;
-    }
+        psFree(faultClause);
+        psFree(query);
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+
+    psFree(faultClause);
 
     return true;
@@ -1133,4 +1140,9 @@
             psFree(output);
             return false;
+        }
+        psS32 fault = psMetadataLookupS64(NULL, dep, "fault");
+        if (fault > 0) {
+            fprintf(stderr, "existing dependent has fault %d\n", fault);
+            exit (fault);
         }
         printf("%" PRId64 "\n", dep_id);
@@ -1315,4 +1327,7 @@
         return false;
     }
+
+    PXOPT_LOOKUP_S16(fault,      config->args, "-fault",          false, false);
+
     psString query = pxDataGet("pstamptool_revertdependent.sql");
     if (!query) {
@@ -1326,10 +1341,32 @@
     psFree(where);
 
-    if (!p_psDBRunQuery(config->dbh, query)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(query);
-        return false;
-    }
-
-    return true;
-}
+    if (!fault) {
+        // unless asked to clear a specific fault value, restrict reverts to fault codes
+        // that are less than the minimum fault in the API
+        psStringAppend(&query, " AND (pstampDependent.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+
+    return true;
+}
+
+static bool getwebrequestnumMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    if (!pstampWebRequestInsert(config->dbh, 0 )) {
+        psError(PS_ERR_UNKNOWN, false, "failed to insert pstampWebRequest");
+        return false;
+    }
+
+    psS64 req_id = psDBLastInsertID(config->dbh);
+
+    printf("%" PRId64 "\n", req_id);
+
+    return true;
+}
Index: /branches/czw_branch/20100519/ippTools/src/pstamptool.h
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pstamptool.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pstamptool.h	(revision 28304)
@@ -48,4 +48,5 @@
     PSTAMPTOOL_MODE_UPDATEDEPENDENT,
     PSTAMPTOOL_MODE_REVERTDEPENDENT,
+    PSTAMPTOOL_MODE_GETWEBREQUESTNUM,
 } pstamptoolMode;
 
Index: /branches/czw_branch/20100519/ippTools/src/pstamptoolConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pstamptoolConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pstamptoolConfig.c	(revision 28304)
@@ -235,4 +235,7 @@
     psMetadataAddBool(projectArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
 
+    // -getwebrequestnum
+    psMetadata *getwebrequestnumArgs = psMetadataAlloc();
+
     psMetadata *argSets = psMetadataAlloc();
     psMetadata *modes = psMetadataAlloc();
@@ -264,4 +267,5 @@
     PXOPT_ADD_MODE("-modproject",      "", PSTAMPTOOL_MODE_MODPROJECT, modprojectArgs);
     PXOPT_ADD_MODE("-project",         "", PSTAMPTOOL_MODE_PROJECT,    projectArgs);
+    PXOPT_ADD_MODE("-getwebrequestnum","", PSTAMPTOOL_MODE_GETWEBREQUESTNUM,   getwebrequestnumArgs);
 
     if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Index: /branches/czw_branch/20100519/ippTools/src/pxadd.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pxadd.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pxadd.c	(revision 28304)
@@ -130,5 +130,8 @@
                        char *dvodb,
                        char *note,
-                       bool image_only)
+                       bool image_only,
+		       bool minidvodb,
+		       char *minidvodb_group,
+		       char *minidvodb_name)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
@@ -158,7 +161,10 @@
                          note     ? note     : "NULL",
                          image_only,
+			 minidvodb,
+			 minidvodb_group,
+			 minidvodb_name,
                          (long long) cam_id
     )) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
+      psError(PS_ERR_UNKNOWN, false, "database error %s", query);
         return false;
     }
Index: /branches/czw_branch/20100519/ippTools/src/pxadd.h
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pxadd.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pxadd.h	(revision 28304)
@@ -38,5 +38,8 @@
 		       char *dvodb,
 		       char *note,
-		       bool image_only);
+		       bool image_only,
+		       bool minidvodb,
+		       char *minidvodb_group,
+		       char *minidvodb_name);
 
 #endif // PXADD_H
Index: /branches/czw_branch/20100519/ippTools/src/pxcam.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pxcam.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pxcam.c	(revision 28304)
@@ -152,5 +152,5 @@
                     char *tess_id,
                     char *end_stage,
-		    psS64 magicked,
+                    psS64 magicked,
                     char *note)
 {
@@ -172,22 +172,28 @@
     // different on 32/64
     if (!p_psDBRunQueryF(config->dbh, query,
-                "new", // state
-                workdir  ? workdir  : "NULL",
-                "dirty", //workdir_state
-                label    ? label    : "NULL",
-                data_group ? data_group : "NULL",
-                dist_group ? dist_group : "NULL",
-                recipe   ? recipe   : "NULL",
-                expgroup ? expgroup : "NULL",
-                dvodb    ? dvodb    : "NULL",
-                tess_id  ? tess_id  : "NULL",
-                end_stage ? end_stage : "NULL",
-                (long long) magicked,
-			 "NULL", // This shouldn't be propagated
-			 "NULL",
-			 "NULL",
-			 "NULL",
-			 "NULL",
-			 "NULL",
+                         "new", // state
+                         workdir  ? workdir  : "NULL",
+                         "dirty", //workdir_state
+                         label    ? label    : "NULL",
+                         data_group ? data_group : "NULL",
+                         dist_group ? dist_group : "NULL",
+                         recipe   ? recipe   : "NULL",
+                         expgroup ? expgroup : "NULL",
+                         dvodb    ? dvodb    : "NULL",
+                         tess_id  ? tess_id  : "NULL",
+                         end_stage ? end_stage : "NULL",
+                         (long long) magicked,
+                         // Here follows the software version and mask statistics which shouldn't be propagated
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
+                         "NULL",
                 note     ? note     : "NULL",
                 (long long)chip_id
Index: /branches/czw_branch/20100519/ippTools/src/pxchip.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pxchip.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pxchip.c	(revision 28304)
@@ -40,5 +40,5 @@
     psMetadataAddStr(md,  PS_LIST_TAIL, "-telescope",          0, "search for telescope", NULL);
     psMetadataAddTime(md, PS_LIST_TAIL, "-dateobs_begin",      0, "search for exposures by time (>=)", NULL);
-    psMetadataAddTime(md, PS_LIST_TAIL, "-dateobs_end",        0, "search for exposures by time (<)", NULL);
+    psMetadataAddTime(md, PS_LIST_TAIL, "-dateobs_end",        0, "search for exposures by time (<=)", NULL);
     psMetadataAddStr(md,  PS_LIST_TAIL, "-exp_tag",            0, "search by exp_tag", NULL);
     psMetadataAddStr(md,  PS_LIST_TAIL, "-exp_type",           0, "search by exp_type", NULL);
Index: /branches/czw_branch/20100519/ippTools/src/pxtools.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/pxtools.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/pxtools.c	(revision 28304)
@@ -48,142 +48,159 @@
 }
 
-psString pxMergeCodeVersions(psString version1, psString version2) {
+psString pxMergeCodeVersions(psString version1, psString version2)
+{
+    if (!version1 && !version2) {
+        return NULL;
+    }
+
+    if (!version1) {
+        return psStringCopy(version2);
+    }
+    if (!version2) {
+        return psStringCopy(version1);
+    }
+
+    bool mod1 = false, mod2 = false;    // Modified versions?
+    if (strchr(version1, 'M')) {
+        psStringSubstitute(&version1, "M", "");
+        mod1 = true;
+    }
+    if (strchr(version2, 'M')) {
+        psStringSubstitute(&version2, "M", "");
+        mod2 = true;
+    }
+
+    int num1 = strtol(version1, NULL, 10);
+    int num2 = strtol(version2, NULL, 10);
+    int numO = PS_MAX(num1, num2);
+
     psString out = NULL;
-
-    bool mod1 = false;
-    bool mod2 = false;
-
-    psS32 num1;
-    psS32 num2;
-    psS32 numO;
-
-    if (!version1) {
-	psStringAppend(&out, "%s", version2);
-	return(out);
-    }
-    if (!version2) {
-	psStringAppend(&out, "%s", version1);
-	return(out);
-    }
-  
-    if (strchr(version1,'M')) {
-	psStringSubstitute(&version1,"M","");
-	mod1 = true;
-    }
-    if (strchr(version2,'M')) {
-	psStringSubstitute(&version2,"M","");
-	mod2 = true;
-    }
-
-    num1 = strtol(version1,NULL,10);
-    num2 = strtol(version2,NULL,10);
-
-    if (num1 >= num2) {
-	numO = num1;
-    }
-    else {
-	numO = num2;
-    }
-  
-    psStringAppend(&out,"%" PRId32,numO);
+    psStringAppend(&out, "%" PRId32, numO);
     if (mod1 || mod2) {
-	psStringAppend(&out,"M");
-    }
-    return(out);
+        psStringAppend(&out, "M");
+    }
+    return out;
 }
 
 bool pxCoalesceRunStatus(pxConfig *config, const psString dbQFile, psS64 stage_id, psString *software_ver,
-			 psS64 *maskfrac_npix, psF32 *maskfrac_static, psF32 *maskfrac_dynamic,
-			 psF32 *maskfrac_magic, psF32 *maskfrac_advisory) {
+                         psS64 *maskfrac_npix, psF32 *maskfrac_static, psF32 *maskfrac_dynamic,
+                         psF32 *maskfrac_magic, psF32 *maskfrac_advisory)
+{
     psString query = pxDataGet(dbQFile);
-/*   psString text_id = NULL; */
-/*   psStringAppend(&text_id," %" PRId64,stage_id); */
-/*   psStringSubstitute(&query,text_id,"@STAGE_ID@"); */
-/*   psFree(text_id); */
+    if (!query) {
+        psError(psErrorCodeLast(), false, "Unable to read query");
+        return false;
+    }
     if (!p_psDBRunQueryF(config->dbh, query, stage_id)) {
-	psError(PS_ERR_UNKNOWN, false, "database error");
-	psFree(query);
-	return(false);
+        psError(psErrorCodeLast(), false, "database error");
+        psFree(query);
+        return false;
     }
     psFree(query);
+
     psArray *output = p_psDBFetchResult(config->dbh);
     if (!output) {
-	psError(PS_ERR_UNKNOWN, false, "database error");
-	return(false);
-    }
-  
+        psError(psErrorCodeLast(), false, "database error");
+        return false;
+    }
+
+    *maskfrac_npix = 0;
+    *maskfrac_static = 0.0;
+    *maskfrac_dynamic = 0.0;
+    *maskfrac_magic = 0.0;
+    *maskfrac_advisory = 0.0;
+
     for (long i = 0; i < psArrayLength(output); i++) {
-	psMetadata *row = output->data[i];
-
-	psS32 this_npix = psMetadataLookupS32(NULL, row, "maskfrac_npix");
-	psF32 this_static = psMetadataLookupF32(NULL, row, "maskfrac_static");
-	psF32 this_dynamic = psMetadataLookupF32(NULL, row, "maskfrac_dynamic");
-	psF32 this_magic = psMetadataLookupF32(NULL, row, "maskfrac_magic");
-	psF32 this_advisory = psMetadataLookupF32(NULL, row, "maskfrac_advisory");
-	psString this_version = psMetadataLookupStr(NULL, row, "software_ver");
-
-	*software_ver = pxMergeCodeVersions(*software_ver,this_version);
-/*     printf("%ld : %d %f %f %f %f <-> %ld %f %f %f %f\n",i,this_npix,this_static,this_dynamic,this_magic,this_advisory, */
-/* 	   *maskfrac_npix,*maskfrac_static,*maskfrac_dynamic,*maskfrac_magic,*maskfrac_advisory); */
-	if (this_npix > 0) {
-	    *maskfrac_static = ((*maskfrac_static * *maskfrac_npix) + (this_npix * this_static)) / (this_npix + *maskfrac_npix);
-	    *maskfrac_dynamic = ((*maskfrac_dynamic * *maskfrac_npix) + (this_npix * this_dynamic)) / (this_npix + *maskfrac_npix);
-	    *maskfrac_magic = ((*maskfrac_magic * *maskfrac_npix) + (this_npix * this_magic)) / (this_npix + *maskfrac_npix);
-	    *maskfrac_advisory = ((*maskfrac_advisory * *maskfrac_npix) + (this_npix * this_advisory)) / (this_npix + *maskfrac_npix);
-	    *maskfrac_npix += this_npix;
-	}
+        psMetadata *row = output->data[i];
+
+        psS32 this_npix = psMetadataLookupS32(NULL, row, "maskfrac_npix");
+        psF32 this_static = psMetadataLookupF32(NULL, row, "maskfrac_static");
+        psF32 this_dynamic = psMetadataLookupF32(NULL, row, "maskfrac_dynamic");
+        psF32 this_magic = psMetadataLookupF32(NULL, row, "maskfrac_magic");
+        psF32 this_advisory = psMetadataLookupF32(NULL, row, "maskfrac_advisory");
+
+        psTrace("pxtools", 3, "Mask stats: %d %f %f %f %f\n",
+                this_npix, this_static, this_dynamic, this_magic, this_advisory);
+
+        if (this_npix == 0 || this_npix == PS_MAX_S32) {
+            continue;
+        }
+        if (!isfinite(this_static) || !isfinite(this_dynamic) ||
+            !isfinite(this_magic) || !isfinite(this_advisory)) {
+            continue;
+        }
+
+        psString this_version = psMetadataLookupStr(NULL, row, "software_ver");
+        *software_ver = pxMergeCodeVersions(*software_ver,this_version);
+
+        *maskfrac_npix += this_npix;
+        *maskfrac_static += this_npix * this_static;
+        *maskfrac_dynamic += this_npix * this_dynamic;
+        *maskfrac_magic += this_npix * this_magic;
+        *maskfrac_advisory += this_npix * this_advisory;
     }
     psFree(output);
-    return(true);
-}
-
-bool pxSetRunSoftware(pxConfig *config, const psString tableName, const psString stage_id_name, const psS64 stage_id,
-		      psString software_ver) {
+
+    if (*maskfrac_npix > 0) {
+        *maskfrac_static /= *maskfrac_npix;
+        *maskfrac_dynamic /= *maskfrac_npix;
+        *maskfrac_magic /= *maskfrac_npix;
+        *maskfrac_advisory /= *maskfrac_npix;
+    }
+
+    return true;
+}
+
+bool pxSetRunSoftware(pxConfig *config, const psString tableName, const psString stage_id_name,
+                      const psS64 stage_id, psString software_ver)
+{
     char *query = "UPDATE %s SET software_ver = '%s' WHERE %s = %" PRId64;
-/*   printf(query,tableName,software_ver,stage_id_name,stage_id); */
-    if (!p_psDBRunQueryF(config->dbh,query,tableName,software_ver,stage_id_name,stage_id)) {
-	psError(PS_ERR_UNKNOWN, false,
-		"failed to set software version for %s %" PRId64,stage_id_name,stage_id);
-	return(false);
-    }
-  
-    return(true);
-}
-
-bool pxSetRunMaskfrac(pxConfig *config, const psString tableName, const psString stage_id_name, const psS64 stage_id,
-		      psS64 maskfrac_npix, psF32 maskfrac_static, psF32 maskfrac_dynamic,
-		      psF32 maskfrac_magic, psF32 maskfrac_advisory) {
-    char *query = "UPDATE %s SET maskfrac_npix = %f, maskfrac_static = %f, maskfrac_dynamic = %f, maskfrac_magic = %f, maskfrac_advisory = %f WHERE %s = %" PRId64;
-    if (!p_psDBRunQueryF(config->dbh,query,tableName,(float) maskfrac_npix,maskfrac_static,
-			 maskfrac_dynamic, maskfrac_magic,maskfrac_advisory,stage_id_name,stage_id)) {
-	psError(PS_ERR_UNKNOWN, false,
-		"failed to set maskfrac stats for %s %" PRId64,stage_id_name,stage_id);
-	return(false);
-    }
-  
-
-
-    return(true);
-}
-
-bool pxCamSetRunMaskfrac(pxConfig *config, const psString tableName, const psString stage_id_name, const psS64 stage_id,
-			 psS64 maskfrac_ref_npix, psF32 maskfrac_ref_static, psF32 maskfrac_ref_dynamic,
-			 psF32 maskfrac_ref_magic, psF32 maskfrac_ref_advisory,
-			 psS64 maskfrac_max_npix, psF32 maskfrac_max_static, psF32 maskfrac_max_dynamic,
-			 psF32 maskfrac_max_magic, psF32 maskfrac_max_advisory) {
-  char *query = "UPDATE %s SET maskfrac_ref_npix = %f, maskfrac_ref_static = %f, maskfrac_ref_dynamic = %f, maskfrac_ref_magic = %f, maskfrac_ref_advisory = %f, maskfrac_max_npix = %f, maskfrac_max_static = %f, maskfrac_max_dynamic = %f, maskfrac_max_magic = %f, maskfrac_max_advisory = %f WHERE %s = %" PRId64;
-  if (!p_psDBRunQueryF(config->dbh,query,tableName,(float) maskfrac_ref_npix,maskfrac_ref_static,
-		       maskfrac_ref_dynamic, maskfrac_ref_magic,maskfrac_ref_advisory,
-		       (float) maskfrac_max_npix,maskfrac_max_static,
-		       maskfrac_max_dynamic, maskfrac_max_magic,maskfrac_max_advisory,
-		       stage_id_name,stage_id)) {
-    psError(PS_ERR_UNKNOWN, false,
-	    "failed to set maskfrac stats for %s %" PRId64,stage_id_name,stage_id);
-    return(false);
+    if (!p_psDBRunQueryF(config->dbh, query, tableName, software_ver, stage_id_name, stage_id)) {
+        psError(psErrorCodeLast(), false,
+                "failed to set software version for %s %" PRId64, stage_id_name, stage_id);
+        return false;
+    }
+
+    return true;
+}
+
+bool pxSetRunMaskfrac(pxConfig *config, const psString tableName, const psString stage_id_name,
+                      const psS64 stage_id, psS64 maskfrac_npix, psF32 maskfrac_static,
+                      psF32 maskfrac_dynamic, psF32 maskfrac_magic, psF32 maskfrac_advisory)
+{
+    char *query = "UPDATE %s SET maskfrac_npix = %f, maskfrac_static = %f, maskfrac_dynamic = %f, "
+        "maskfrac_magic = %f, maskfrac_advisory = %f WHERE %s = %" PRId64;
+    if (!p_psDBRunQueryF(config->dbh, query, tableName, (float)maskfrac_npix, maskfrac_static,
+                         maskfrac_dynamic, maskfrac_magic, maskfrac_advisory, stage_id_name, stage_id)) {
+        psError(psErrorCodeLast(), false,
+                "failed to set maskfrac stats for %s %" PRId64,stage_id_name,stage_id);
+        return false;
+    }
+
+
+
+    return true;
+}
+
+bool pxCamSetRunMaskfrac(pxConfig *config, const psString tableName,
+                         const psString stage_id_name, const psS64 stage_id,
+                         psS64 maskfrac_ref_npix, psF32 maskfrac_ref_static, psF32 maskfrac_ref_dynamic,
+                         psF32 maskfrac_ref_magic, psF32 maskfrac_ref_advisory,
+                         psS64 maskfrac_max_npix, psF32 maskfrac_max_static, psF32 maskfrac_max_dynamic,
+                         psF32 maskfrac_max_magic, psF32 maskfrac_max_advisory) {
+  char *query = "UPDATE %s SET maskfrac_ref_npix = %f, maskfrac_ref_static = %f, maskfrac_ref_dynamic = %f, "
+      "maskfrac_ref_magic = %f, maskfrac_ref_advisory = %f, maskfrac_max_npix = %f, maskfrac_max_static = %f, "
+      "maskfrac_max_dynamic = %f, maskfrac_max_magic = %f, maskfrac_max_advisory = %f WHERE %s = %" PRId64;
+  if (!p_psDBRunQueryF(config->dbh, query, tableName, (float)maskfrac_ref_npix, maskfrac_ref_static,
+                       maskfrac_ref_dynamic,  maskfrac_ref_magic, maskfrac_ref_advisory,
+                       (float)maskfrac_max_npix, maskfrac_max_static,
+                       maskfrac_max_dynamic,  maskfrac_max_magic, maskfrac_max_advisory,
+                       stage_id_name, stage_id)) {
+      psError(psErrorCodeLast(), false,
+              "failed to set maskfrac stats for %s %" PRId64,stage_id_name,stage_id);
+      return false;
   }
-  
-
-
-  return(true);
+
+  return true;
 }
 
@@ -222,5 +239,5 @@
     psMetadataItem *item = psMetadataLookup(config->args, name);
     if (!item) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", name);
+        psError(psErrorCodeLast(), false, "failed to lookup value for %s", name);
         return false;
     }
@@ -239,5 +256,5 @@
             item->comment = psStringCopy (op);
             if (!psMetadataAddItem(where, item, PS_LIST_TAIL, PS_META_DUPLICATE_OK)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item %s", field);
+                psError(psErrorCodeLast(), false, "failed to add item %s", field);
                 psFree(where);
                 return false;
@@ -272,4 +289,14 @@
     PXOPT_LOOKUP_STR(note, config->args,        "-set_note", false, false);
 
+    if ((state)&&(!strcmp(state, "update"))) {
+        fprintf(stderr, "'-updaterun -set_state update' is not supported.");
+        if (!strcmp(runTable, "chipRun")) {
+            fprintf(stderr, " Use -setimfiletoupdate.\n");
+        } else {
+            fprintf(stderr, " Use -setskyfiletoupdate.\n");
+        }
+        exit(1);
+    }
+
     psString dist_group = NULL;
     if (has_dist_group) {
@@ -293,10 +320,10 @@
     char *comma = ",";
 
-#   define addColumn(_tab, _val)					\
-    do {								\
-	if (_val) {							\
-	    psStringAppend(pQuery, "%s %s.%s = '%s'", separator, _tab, #_val, _val); \
-	    separator = comma;						\
-	}								\
+#   define addColumn(_tab, _val)                                        \
+    do {                                                                \
+        if (_val) {                                                     \
+            psStringAppend(pQuery, "%s %s.%s = '%s'", separator, _tab, #_val, _val); \
+            separator = comma;                                          \
+        }                                                               \
     } while (0)
 
@@ -331,5 +358,5 @@
 
     if (!p_psDBRunQueryF(config->dbh, *pQuery, joinHook)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
+        psError(psErrorCodeLast(), false, "database error");
         return false;
     }
@@ -343,5 +370,5 @@
 
     if (!p_psDBRunQuery(config->dbh, query)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
+        psError(psErrorCodeLast(), false, "database error");
         return false;
     }
@@ -349,14 +376,14 @@
     psArray *output = p_psDBFetchResult(config->dbh);
     if (!output) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
+        psError(psErrorCodeLast(), false, "database error");
         return false;
     }
     if (!psArrayLength(output)) {
         psFree(output);
-        psError(PS_ERR_UNKNOWN, true, "no rows in dbversion");
+        psError(PXTOOLS_ERR_PROG, true, "no rows in dbversion");
         return false;
     }
     if (psArrayLength(output) > 1) {
-        psError(PS_ERR_UNKNOWN, true, "unexpected number of rows found in dbversion: %ld",
+        psError(PXTOOLS_ERR_PROG, true, "unexpected number of rows found in dbversion: %ld",
                 psArrayLength(output));
         return false;
@@ -373,10 +400,10 @@
     psArray *array = NULL;
     if (!pxLookupVersion(config, &array)) {
-        psError(PS_ERR_UNKNOWN, false, "pxLookupVersion failed");
+        psError(psErrorCodeLast(), false, "pxLookupVersion failed");
         return NULL;
     }
     psMetadata *md = array->data[0];
     if (!md) {
-        psError(PS_ERR_UNKNOWN, true, "output of pxLookupVersion is null");
+        psError(PXTOOLS_ERR_PROG, true, "output of pxLookupVersion is null");
         return NULL;
     }
@@ -394,9 +421,9 @@
     psArray *array = NULL;
     if (!pxLookupVersion(config, &array) || !array) {
-        psError(PS_ERR_UNKNOWN, false, "pxLookupVersion failed");
+        psError(psErrorCodeLast(), false, "pxLookupVersion failed");
         return false;
     }
     if (!ippdbPrintMetadatas(file, array, "dbversion", true)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to print array");
+        psError(psErrorCodeLast(), false, "failed to print array");
         psFree(array);
         return false;
@@ -414,5 +441,5 @@
     psMetadataItem *multi_item =  psMetadataLookup(input, "dbversion");
     if (!multi_item || (multi_item->type != PS_DATA_METADATA_MULTI)) {
-        psError(PS_ERR_UNKNOWN, true, "dbversion multi not found in input");
+        psError(PXTOOLS_ERR_PROG, true, "dbversion multi not found in input");
         return false;
     }
@@ -420,5 +447,5 @@
     psMetadataItem *dbversion = psListGet(multi_item->data.list, 0);
     if (!dbversion) {
-        psError(PS_ERR_UNKNOWN, true, "dbversion not found in input");
+        psError(PXTOOLS_ERR_PROG, true, "dbversion not found in input");
         return false;
     }
@@ -429,5 +456,5 @@
         psString schema_version = pxGetDBVersion(config);
         if (!schema_version) {
-            psError(PS_ERR_UNKNOWN, false, "pxGetDBVersion failed");
+            psError(psErrorCodeLast(), false, "pxGetDBVersion failed");
             return false;
         }
@@ -435,9 +462,9 @@
         psString import_version = psMetadataLookupStr(NULL, md, "schema_version");
         if (import_version && strcmp(import_version, schema_version)) {
-            psError(PS_ERR_UNKNOWN, true, "input file schema_version: %s does not match data base: %s",
-		    import_version, schema_version);
+            psError(PXTOOLS_ERR_PROG, true, "input file schema_version: %s does not match data base: %s",
+                    import_version, schema_version);
             return false;
         } else if (!import_version) {
-            psError(PS_ERR_UNKNOWN, true, "input file schema_version is NULL");
+            psError(PXTOOLS_ERR_PROG, true, "input file schema_version is NULL");
             return false;
         } else {
@@ -445,8 +472,8 @@
         }
     } else {
-        psError(PS_ERR_UNKNOWN, true, "Unexpected config dump format");
-        return false;
-    }
-
-    return true;
-}
+        psError(PXTOOLS_ERR_PROG, true, "Unexpected config dump format");
+        return false;
+    }
+
+    return true;
+}
Index: /branches/czw_branch/20100519/ippTools/src/stacktool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/stacktool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/stacktool.c	(revision 28304)
@@ -39,4 +39,5 @@
 static bool addsumskyfileMode(pxConfig *config);
 static bool sumskyfileMode(pxConfig *config);
+static bool sassskyfileMode(pxConfig *config);
 static bool revertsumskyfileMode(pxConfig *config);
 static bool tosummaryMode(pxConfig *config);
@@ -77,4 +78,5 @@
         MODECASE(STACKTOOL_MODE_ADDSUMSKYFILE,         addsumskyfileMode);
         MODECASE(STACKTOOL_MODE_SUMSKYFILE,            sumskyfileMode);
+	MODECASE(STACKTOOL_MODE_SASSSKYFILE,            sassskyfileMode);
         MODECASE(STACKTOOL_MODE_REVERTSUMSKYFILE,      revertsumskyfileMode);
 	MODECASE(STACKTOOL_MODE_TOSUMMARY,             tosummaryMode);
@@ -116,5 +118,10 @@
   psString idString = NULL;
   psStringAppend(&idString, "%" PRId64, stack_id);
-  psStringSubstitute(&select,idString, "@STACK_ID@");
+  // Copy string to get around the issue with psStringSubstitute not believing
+  // that select is a psString.
+  psString rep = psStringCopy(select);
+  psFree(select);
+  select = rep;
+  psStringSubstitute(&select, idString, "@STACK_ID@");
   psFree(idString);
 
@@ -143,12 +150,33 @@
     return(NULL);
   }
-  psMetadata *outrow = NULL;
+  psMetadata *outrow = psMetadataAlloc();
   for (long i = 0; i < output->n; i++) {
     psMetadata *row = output->data[i];
-    if (!psMetadataCopy(row,outrow)) {
-      psError(PS_ERR_UNKNOWN, false, "Failed to copy row to return");
-      return(NULL);
-    }
-  }
+
+    printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,row,"sass_id"),
+	   psMetadataLookupStr(NULL,row,"data_group"),
+	   psMetadataLookupStr(NULL,row,"tess_id"),
+	   psMetadataLookupStr(NULL,row,"filter"),
+	   psMetadataLookupStr(NULL,row,"projection_cell"));
+
+    if (psMetadataLookupS64(NULL,row,"sass_id") == PS_MAX_S64) {
+      psMetadataAddS64(outrow,PS_LIST_TAIL,"sass_id",PS_META_REPLACE,"",0);
+    }
+    else {
+      psMetadataAddS64(outrow,PS_LIST_TAIL,"sass_id",PS_META_REPLACE,"",psMetadataLookupS64(NULL,row,"sass_id"));
+    }
+    psMetadataAddStr(outrow,PS_LIST_TAIL,"data_group",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"data_group"));
+    psMetadataAddStr(outrow,PS_LIST_TAIL,"tess_id",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"tess_id"));
+    psMetadataAddStr(outrow,PS_LIST_TAIL,"filter",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"filter"));
+    psMetadataAddStr(outrow,PS_LIST_TAIL,"projection_cell",PS_META_REPLACE,"",
+		     psMetadataLookupStr(NULL,row,"projection_cell"));
+  }
+  printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,outrow,"sass_id"),
+	 psMetadataLookupStr(NULL,outrow,"data_group"),
+	 psMetadataLookupStr(NULL,outrow,"tess_id"),
+	 psMetadataLookupStr(NULL,outrow,"filter"),
+	 psMetadataLookupStr(NULL,outrow,"projection_cell"));
+  
+
   psFree(output);
   stackAssociationRow *sassRow = stackAssociationObjectFromMetadata(outrow);
@@ -1063,5 +1091,4 @@
     psMetadata *where = psMetadataAlloc();
     PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "==");
-    PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "==");
     PXOPT_COPY_STR(config->args, where, "-tess_id", "stackRun.tess_id", "==");
     PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "==");
@@ -1082,4 +1109,89 @@
 
     psString query = pxDataGet("stacktool_sumskyfile.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+        return false;
+    }
+
+    if (psListLength(where->list)) {
+        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, " WHERE %s", whereClause);
+        psFree(whereClause);
+    } else if (!all) {
+        psError(PXTOOLS_ERR_CONFIG, true, "search parameters or -all are required");
+        return false;
+    }
+
+    psFree(where);
+
+    // treat limit == 0 as "no limit"
+    if (limit) {
+        psString limitString = psDBGenerateLimitSQL(limit);
+        psStringAppend(&query, " %s", limitString);
+        psFree(limitString);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+        psErrorCode err = psErrorCodeLast();
+        switch (err) {
+            case PS_ERR_DB_CLIENT:
+                psError(PXTOOLS_ERR_SYS, false, "database error");
+            case PS_ERR_DB_SERVER:
+                psError(PXTOOLS_ERR_PROG, false, "database error");
+            default:
+                psError(PXTOOLS_ERR_PROG, false, "unknown error");
+        }
+
+        return false;
+    }
+    if (!psArrayLength(output)) {
+        psTrace("stacktool", PS_LOG_INFO, "no rows found");
+        psFree(output);
+        return true;
+    }
+
+    if (psArrayLength(output)) {
+        if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to print array");
+            psFree(output);
+            return false;
+        }
+    }
+
+    psFree(output);
+
+    return true;
+}
+
+static bool sassskyfileMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociation.sass_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-tess_id", "stackAssociation.tess_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-projection_cell", "stackAssociation.projection_cell", "==");
+    PXOPT_COPY_STR(config->args, where, "-filter", "stackAssociation.filter", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-data_group", "stackAssociation.data_group", "LIKE");
+
+//  The following three selectors are incompatible with the sql so omit them
+//    PXOPT_COPY_S64(config->args, where, "-warp_id", "warpRun.warp_id", "==");
+//     PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
+//    PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "==");
+
+    PXOPT_LOOKUP_BOOL(all, config->args, "-all", false);
+
+    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
+    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+
+    psString query = pxDataGet("stacktool_sassskyfile.sql");
     if (!query) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
@@ -1318,5 +1430,5 @@
   PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-  PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
+  PXOPT_LOOKUP_S64(sass_id, config->args, "-sass_id", true, false);
   PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false);
   PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false);
@@ -1327,5 +1439,5 @@
     return(false);
   }
-  if (!p_psDBRunQueryF(config->dbh, query, stack_id, projection_cell, path_base)) {
+  if (!p_psDBRunQueryF(config->dbh, query, sass_id, projection_cell, path_base)) {
     psError(PS_ERR_UNKNOWN, false, "database error");
     psFree(query);
Index: /branches/czw_branch/20100519/ippTools/src/stacktool.h
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/stacktool.h	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/stacktool.h	(revision 28304)
@@ -33,4 +33,5 @@
     STACKTOOL_MODE_ADDSUMSKYFILE,
     STACKTOOL_MODE_SUMSKYFILE,
+    STACKTOOL_MODE_SASSSKYFILE,
     STACKTOOL_MODE_REVERTSUMSKYFILE,
     STACKTOOL_MODE_TOSUMMARY,
Index: /branches/czw_branch/20100519/ippTools/src/stacktoolConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/stacktoolConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/stacktoolConfig.c	(revision 28304)
@@ -197,4 +197,16 @@
     psMetadataAddBool(sumskyfileArgs, PS_LIST_TAIL, "-all",  0,            "enable search without arguments", false);
 
+    // -sassskyfile
+    psMetadata *sassskyfileArgs = psMetadataAlloc();
+    psMetadataAddS64(sassskyfileArgs, PS_LIST_TAIL, "-sass_id", 0,           "search by stack association ID", 0);
+    psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-tess_id", 0,            "search by tess ID", 0);
+    psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-projection_cell", 0,         "search by projection cell", 0);
+
+    psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-data_group", 0,        "search by stackAssociation.data_group (LIKE comparison)", NULL);
+    psMetadataAddStr(sassskyfileArgs, PS_LIST_TAIL, "-filter", 0,            "search by filter (LIKE comparison)", NULL);
+    psMetadataAddU64(sassskyfileArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
+    psMetadataAddBool(sassskyfileArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
+    psMetadataAddBool(sassskyfileArgs, PS_LIST_TAIL, "-all",  0,            "enable search without arguments", false);
+
     // -revertsumskyfile
     psMetadata *revertsumskyfileArgs= psMetadataAlloc();
@@ -221,5 +233,5 @@
     // -addsummary
     psMetadata *addsummaryArgs = psMetadataAlloc();
-    psMetadataAddS64(addsummaryArgs, PS_LIST_TAIL, "-stack_id", 0,      "set stack ID", 0);
+    psMetadataAddS64(addsummaryArgs, PS_LIST_TAIL, "-sass_id", 0,      "set stack Association ID", 0);
     psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "set projection cell", NULL);
     psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-path_base", 0,     "set summary path base", NULL);		     
@@ -273,4 +285,5 @@
     PXOPT_ADD_MODE("-addsumskyfile",   "", STACKTOOL_MODE_ADDSUMSKYFILE,   addsumskyfileArgs);
     PXOPT_ADD_MODE("-sumskyfile",      "list results of stackRun", STACKTOOL_MODE_SUMSKYFILE,      sumskyfileArgs);
+    PXOPT_ADD_MODE("-sassskyfile",      "list results of stackAssociation", STACKTOOL_MODE_SASSSKYFILE,      sassskyfileArgs);
     PXOPT_ADD_MODE("-revertsumskyfile","", STACKTOOL_MODE_REVERTSUMSKYFILE,      revertsumskyfileArgs);
     PXOPT_ADD_MODE("-pendingcleanuprun",     "show runs that need to be cleaned up", STACKTOOL_MODE_PENDINGCLEANUPRUN,    pendingcleanuprunArgs);
Index: /branches/czw_branch/20100519/ippTools/src/staticskytool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/staticskytool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/staticskytool.c	(revision 28304)
@@ -42,4 +42,6 @@
 static bool importrunMode(pxConfig *config);
 
+static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state);
+
 # define MODECASE(caseName, func) \
     case caseName: \
@@ -129,4 +131,5 @@
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
+    PXOPT_LOOKUP_BOOL(check_inputs, config->args, "-check_inputs", false);
 
     psString select = pxDataGet("staticskytool_definebyquery_select.sql");
@@ -255,4 +258,16 @@
 	    psWarning("staticskytool ERROR: no rows found for known tess_id, skycell_id?");
 	    continue;
+	}
+
+	if (check_inputs) {
+	  // negative simple so the default is true
+	  if (!ippdbPrintMetadatas(stdout, inputs, "staticskyInput", !simple)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to print array");
+            psFree(output);
+            psFree(where);
+            return false;
+	  }
+	  psFree(inputs);
+	  continue;
 	}
 
@@ -550,4 +565,14 @@
     }
 
+    if (!fault) {
+        if (!setstaticskyRunState(config, sky_id, "full")) {
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
+            psError(PS_ERR_UNKNOWN, false, "failed to change staticskyRun state");
+            return false;
+        }
+    }
+
     // point of no return
     if (!psDBCommit(config->dbh)) {
@@ -643,9 +668,8 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-# if (0)
     psMetadata *where = psMetadataAlloc();
-    PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "==");
-    pxAddLabelSearchArgs(config, where, "-label", "stackRun.label", "==");
-    PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "==");
+    PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyResult.sky_id", "==");
+    pxAddLabelSearchArgs(config, where, "-label", "staticskyRun.label", "==");
+    PXOPT_COPY_S16(config->args, where, "-fault", "staticskyResult.fault", "==");
 
     if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
@@ -656,5 +680,5 @@
 
     // Delete product
-    psString delete = pxDataGet("staticskytool_revertsumskyfile_delete.sql");
+    psString delete = pxDataGet("staticskytool_revert.sql");
     if (!delete) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
@@ -680,39 +704,17 @@
 
     psFree(where);
-# endif
-
     return true;
 }
 
-# if (0)
-static bool updateresultState(pxConfig *config)
-{
-    // check that state is a valid string value
-    if (!pxIsValidState(state)) {
-        psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);
-        return false;
-    }
-
-    char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64;
-    if (!p_psDBRunQueryF(config->dbh, query, state, stack_id)) {
-        psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for stack_id %"PRId64, stack_id);
-        return false;
-    }
-    return true;
-}
-# endif
-
 static bool updateresult(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-# if (0)
     PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_COPY_S64(config->args, where, "-stack_id",   "stack_id",   "==");
-
-    if (!pxSetFaultCode(config->dbh, "stackSumSkyfile", where, fault)) {
+    PXOPT_COPY_S64(config->args, where, "-sky_id",   "sky_id",   "==");
+
+    if (!pxSetFaultCode(config->dbh, "staticskyResult", where, fault)) {
         psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
         psFree (where);
@@ -720,6 +722,4 @@
     }
     psFree (where);
-
-# endif
     return true;
 }
@@ -898,4 +898,23 @@
 # endif
   return true;
+}
+
+static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state)
+{
+    PS_ASSERT_PTR_NON_NULL(state, false);
+
+    // check that state is a valid string value
+    if (!pxIsValidState(state)) {
+        psError(PS_ERR_UNKNOWN, false, "invalid staticskyRun state: %s", state);
+        return false;
+    }
+
+    char *query = "UPDATE staticskyRun SET state = '%s' WHERE sky_id = %"PRId64;
+    if (!p_psDBRunQueryF(config->dbh, query, state, sky_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to change state for sky_id %"PRId64, sky_id);
+        return false;
+    }
+    return true;
+
 }
 
Index: /branches/czw_branch/20100519/ippTools/src/staticskytoolConfig.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/staticskytoolConfig.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/staticskytoolConfig.c	(revision 28304)
@@ -61,4 +61,5 @@
     psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-set_registered", 0, "time detrend run was registered", now);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",  0, "do not actually modify the database", false);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-check_inputs",  0, "list inputs, do not modify database", false);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
 
Index: /branches/czw_branch/20100519/ippTools/src/warptool.c
===================================================================
--- /branches/czw_branch/20100519/ippTools/src/warptool.c	(revision 28303)
+++ /branches/czw_branch/20100519/ippTools/src/warptool.c	(revision 28304)
@@ -430,5 +430,5 @@
     }
 
-    psString query = psStringCopy("UPDATE warpRun JOIN warpSkyfile USING(warp_id) JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)");
+    psString query = psStringCopy("UPDATE warpRun");
 
     // pxUpdateRun gets parameters from config->args and updates
Index: /branches/czw_branch/20100519/ippconfig/gpc1/dvo.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/gpc1/dvo.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/gpc1/dvo.config	(revision 28304)
@@ -17,6 +17,7 @@
 CCDNUM-KEYWORD		EXTNAME
 ST-KEYWORD		NONE
-OBSERVATORY-LATITUDE	NONE
-OBSERVATORY-LONGITUDE	NONE
+OBSERVATORY-LATITUDE	20.7070999146
+OBSERVATORY-LONGITUDE	10.4170608521
+
 SUBPIX_DATAFILE		NONE
 
Index: /branches/czw_branch/20100519/ippconfig/gpc1/psphot.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/gpc1/psphot.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/gpc1/psphot.config	(revision 28304)
@@ -36,5 +36,6 @@
   BACKGROUND.XBIN		    S32  32            # size of background superpixels
   BACKGROUND.YBIN	    	    S32  32            # size of background superpixels
-  OUTPUT.FORMAT		            STR  PS1_DV1
+  DIFF_STATS			    BOOL TRUE	       # Calculate diff-specific stats
+  OUTPUT.FORMAT		            STR  PS1_DV1       # Format of output file
 END
 
Index: /branches/czw_branch/20100519/ippconfig/recipes/nightly_science.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/recipes/nightly_science.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/recipes/nightly_science.config	(revision 28304)
@@ -116,5 +116,5 @@
 TARGETS METADATA
   NAME STR STS
-  TESS STR RINGS.V0
+  TESS STR STS.V0
   OBSMODE STR STS%
   OBJECT STR STS%
@@ -288,2 +288,75 @@
   STACKABLE BOOL TRUE
 END
+
+# Detrend verification data
+DETRENDS MULTI
+DETRENDS METADATA
+  NAME     STR DARK
+  DETTYPE     STR DARK
+  EXPTYPE  STR dark
+  REF_ID   S64 299
+  REF_ITER S32 0
+#  FILTER   STR 
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_G
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 300
+  REF_ITER S32 0
+  FILTER   STR g.00000
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_R
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 301
+  REF_ITER S32 0
+  FILTER   STR r.00000
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_I
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 302
+  REF_ITER S32 0
+  FILTER   STR i.00000
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_Z
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 303
+  REF_ITER S32 0
+  FILTER   STR z.00000
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_Y
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 304
+  REF_ITER S32 0
+  FILTER   STR y.00000
+  MAX      S32 10
+END
+
+DETRENDS METADATA
+  NAME     STR FLAT_W
+  DETTYPE     STR FLAT
+  EXPTYPE  STR skyflat
+  REF_ID   S64 305
+  REF_ITER S32 0
+  FILTER   STR w.00000
+  MAX      S32 10
+END
+
Index: /branches/czw_branch/20100519/ippconfig/recipes/ppSim.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/recipes/ppSim.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/recipes/ppSim.config	(revision 28304)
@@ -60,4 +60,5 @@
 PSF.ARATIO      F32     1.0		# minor / major (0.0 - 1.0)
 PSF.THETA	F32	0.0
+PSF.CONVOLVE    BOOL    FALSE		# generate fake stars with PSF (F), or smooth with PSF (T)?
 
 STARS.GRID      BOOL    FALSE		# Add grid of fake stars with constant flux
Index: /branches/czw_branch/20100519/ippconfig/recipes/ppStack.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/recipes/ppStack.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/recipes/ppStack.config	(revision 28304)
@@ -29,4 +29,6 @@
 PHOTOMETRY      BOOL    TRUE            # Do basic photometry?
 SKIP.BG.SUB	BOOL	FALSE		# Bypass background subtraction?
+TARGET.FRAC	F32	0.1		# Minimum flux fraction for target PSF
+TARGET.MINMAG	F32	3.0		# Minimum magnitude difference to tolerate in stamp
 
 RENORM		BOOL	TRUE		# Renormalise weight maps?
@@ -54,5 +56,5 @@
 ZP.STAR.SYS.1	F32	0.10		# Estimated systematic error; pass 1
 ZP.STAR.SYS.2	F32	0.05		# Estimated systematic error; pass 2
-ZP.MATCH	F32	0.3		# Fraction of images to match for good star
+ZP.MATCH	F32	0.1		# Fraction of images to match for good star
 ZP.AIRMASS	METADATA		# Airmass terms by filter
 	g	F32	0.0
Index: /branches/czw_branch/20100519/ippconfig/recipes/psphot.config
===================================================================
--- /branches/czw_branch/20100519/ippconfig/recipes/psphot.config	(revision 28303)
+++ /branches/czw_branch/20100519/ippconfig/recipes/psphot.config	(revision 28304)
@@ -342,4 +342,7 @@
 # Recipe overrides for DIFF
 DIFF	METADATA
+  DIFF_STATS			    BOOL TRUE	       # Calculate diff-specific stats
+  OUTPUT.FORMAT		            STR  PS1_DV1       # Format of output file
+
 END
 
Index: /branches/czw_branch/20100519/magic/remove/src/streaksremove.c
===================================================================
--- /branches/czw_branch/20100519/magic/remove/src/streaksremove.c	(revision 28303)
+++ /branches/czw_branch/20100519/magic/remove/src/streaksremove.c	(revision 28304)
@@ -940,4 +940,8 @@
 
         psArray *inTable = psFitsReadTable(in->fits);
+        if (!inTable) {
+            psErrorStackPrint(stderr, "failed to read tablle in %s", in->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
         if (!inTable->n) {
             psErrorStackPrint(stderr, "table in %s is empty", in->resolved_name);
Index: /branches/czw_branch/20100519/ppBackground/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ppBackground/Makefile.am	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/Makefile.am	(revision 28304)
@@ -0,0 +1,3 @@
+SUBDIRS = src
+
+CLEANFILES = *.pyc *~ core core.*
Index: /branches/czw_branch/20100519/ppBackground/autogen.sh
===================================================================
--- /branches/czw_branch/20100519/ppBackground/autogen.sh	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/autogen.sh	(revision 28304)
@@ -0,0 +1,103 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+PROJECT=ppBackground
+TEST_TYPE=-f
+# change this to be a unique filename in the top level dir
+FILE=autogen.sh
+
+DIE=0
+
+LIBTOOLIZE=libtoolize
+ACLOCAL="aclocal $ACLOCAL_FLAGS"
+AUTOHEADER=autoheader
+AUTOMAKE=automake
+AUTOCONF=autoconf
+
+($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $LIBTOOLIZE installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
+        DIE=1
+}
+
+($ACLOCAL --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $ACLOCAL installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOHEADER installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+        DIE=1
+}
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOMAKE installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOCONF installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+        DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+        echo "You must run this script in the top-level $PROJECT directory"
+        exit 1
+}
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+$LIBTOOLIZE --copy --force || echo "$LIBTOOLIZE failed"
+$ACLOCAL || echo "$ACLOCAL failed"
+$AUTOHEADER || echo "$AUTOHEADER failed"
+$AUTOMAKE --add-missing --force-missing --copy || echo "$AUTOMAKE  failed"
+$AUTOCONF || echo "$AUTOCONF failed"
+
+cd $ORIGDIR
+
+run_configure=true
+for arg in $*; do
+    case $arg in
+        --no-configure)
+            run_configure=false
+            ;;
+        *)
+            ;;
+    esac
+done
+
+if $run_configure; then
+    $srcdir/configure --enable-maintainer-mode "$@"
+    echo
+    echo "Now type 'make' to compile $PROJECT."
+else
+    echo
+    echo "Now run 'configure' and 'make' to compile $PROJECT."
+fi
Index: /branches/czw_branch/20100519/ppBackground/configure.ac
===================================================================
--- /branches/czw_branch/20100519/ppBackground/configure.ac	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/configure.ac	(revision 28304)
@@ -0,0 +1,38 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.61)
+
+AC_INIT([ppBackground], [0.1.1], [ipp-support@ifa.hawaii.edu])
+AC_CONFIG_SRCDIR([src])
+
+AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2])
+AM_CONFIG_HEADER([src/config.h])
+AM_MAINTAINER_MODE
+
+IPP_STDCFLAGS
+
+AC_LANG(C)
+AC_GNU_SOURCE
+AC_PROG_CC_C99
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_SYS_LARGEFILE
+
+PKG_CHECK_MODULES([PSLIB], [pslib >= 1.0.0])
+PKG_CHECK_MODULES([PSMODULE], [psmodules >= 1.0.0])
+PKG_CHECK_MODULES([PSPHOT], [psphot >= 1.0.0])
+
+dnl Set CFLAGS for build
+IPP_STDOPTS
+CFLAGS="${CFLAGS} -Wall -Werror"
+
+IPP_VERSION
+
+AC_SUBST([PPBACKGROUND_CFLAGS])
+AC_SUBST([PPBACKGROUND_LIBS])
+
+AC_CONFIG_FILES([
+  Makefile
+  src/Makefile
+])
+
+AC_OUTPUT
Index: /branches/czw_branch/20100519/ppBackground/src/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/Makefile.am	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/Makefile.am	(revision 28304)
@@ -0,0 +1,61 @@
+bin_PROGRAMS = ppBackground
+
+if HAVE_SVNVERSION
+PPVIZPATTERN_VERSION=`$(SVNVERSION) ..`
+else
+PPVIZPATTERN_VERSION="UNKNOWN"
+endif
+
+if HAVE_SVN
+PPVIZPATTERN_BRANCH=`$(SVN) info .. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'`
+PPVIZPATTERN_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
+else
+PPVIZPATTERN_BRANCH="UNKNOWN"
+PPVIZPATTERN_SOURCE="UNKNOWN"
+endif
+
+# Force recompilation of ppBackgroundVersion.c, since it gets the version information
+ppBackgroundVersion.c: ppBackgroundVersionDefinitions.h
+ppBackgroundVersionDefinitions.h: ppBackgroundVersionDefinitions.h.in FORCE
+	-$(RM) ppBackgroundVersionDefinitions.h
+	$(SED) -e "s|@PPVIZPATTERN_VERSION@|\"$(PPVIZPATTERN_VERSION)\"|" -e "s|@PPVIZPATTERN_BRANCH@|\"$(PPVIZPATTERN_BRANCH)\"|" -e "s|@PPVIZPATTERN_SOURCE@|\"$(PPVIZPATTERN_SOURCE)\"|" ppBackgroundVersionDefinitions.h.in > ppBackgroundVersionDefinitions.h
+FORCE: ;
+
+BUILT_SOURCES = ppBackgroundVersionDefinitions.h
+
+
+ppBackground_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PPBACKGROUND_CFLAGS)
+ppBackground_LDFLAGS  = $(PSLIB_LIBS)   $(PSMODULE_LIBS)   $(PSPHOT_LIBS)   $(PPBACKGROUND_LIBS)
+
+ppBackground_SOURCES =		\
+	ppBackground.c		\
+	ppBackgroundArguments.c	\
+	ppBackgroundCamera.c	\
+	ppBackgroundData.c	\
+	ppBackgroundLoop.c	\
+	ppBackgroundVersion.c   \
+	ppBackgroundModel.c	\
+	ppBackgroundErrorCodes.c
+
+noinst_HEADERS = \
+	ppBackground.h		\
+	ppBackgroundErrorCodes.h
+
+### Error codes.
+BUILT_SOURCES = ppBackgroundErrorCodes.h ppBackgroundErrorCodes.c
+CLEANFILES = ppBackgroundErrorCodes.h ppBackgroundErrorCodes.c
+
+ppBackgroundErrorCodes.h : ppBackgroundErrorCodes.dat ppBackgroundErrorCodes.h.in
+	$(ERRORCODES) --data=ppBackgroundErrorCodes.dat --outdir=. ppBackgroundErrorCodes.h
+
+ppBackgroundErrorCodes.c : ppBackgroundErrorCodes.dat ppBackgroundErrorCodes.c.in ppBackgroundErrorCodes.h
+	$(ERRORCODES) --data=ppBackgroundErrorCodes.dat --outdir=. ppBackgroundErrorCodes.c
+
+
+clean-local:
+	-rm -f TAGS
+
+# Tags for emacs
+tags:
+	etags `find . -name \*.[ch] -print`
+
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackground.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackground.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackground.c	(revision 28304)
@@ -0,0 +1,68 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+
+int main(int argc, char *argv[])
+{
+    ppBackgroundVersionPrint();
+
+    ppBackgroundData *data = ppBackgroundDataInit(&argc, argv);
+    if (!data) {
+        goto DIE;
+    }
+
+    if (!ppBackgroundArguments(data, argc, argv)) {
+        goto DIE;
+    }
+
+    if (!ppBackgroundCamera(data)) {
+        goto DIE;
+    }
+
+    if (!ppBackgroundLoop(data)) {
+        goto DIE;
+    }
+
+ DIE:
+    ; // Empty statement to satisy compiler
+    psExit exitValue = ppBackgroundExitCode(PS_EXIT_SUCCESS); // Exit code
+
+    if (data && data->stats && data->statsFile) {
+        psString stats = psMetadataConfigFormat(data->stats); // Statistics to output
+        if (!stats || strlen(stats) == 0) {
+            psError(PPBACKGROUND_ERR_IO, false, "Unable to format statistics file");
+        } else if (fprintf(data->statsFile, "%s", stats) != strlen(stats)) {
+            psError(PPBACKGROUND_ERR_IO, true, "Unable to write statistics file");
+        }
+        psFree(stats);
+        if (fclose(data->statsFile) == EOF) {
+            psError(PPBACKGROUND_ERR_IO, true, "Unable to close statistics file");
+        }
+        data->statsFile = NULL;
+        pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName);
+        exitValue = ppBackgroundExitCode(exitValue);
+    }
+
+    if (data) {
+        psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig");
+        if (dump_file) {
+            if (!pmConfigDump(data->config, dump_file)) {
+                psError(psErrorCodeLast(), false, "Unable to dump configuration.");
+                exitValue = ppBackgroundExitCode(exitValue);
+            }
+        }
+        psFree(data);
+    }
+
+    pmConfigDone();
+    psLibFinalize();
+
+    return ppBackgroundExitCode(exitValue);
+}
+
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackground.h
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackground.h	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackground.h	(revision 28304)
@@ -0,0 +1,52 @@
+#ifndef PP_VIZPSF_H
+#define PP_VIZPSF_H
+
+#include <pslib.h>
+#include <psmodules.h>
+
+#include <ppBackgroundErrorCodes.h>
+
+#define PPBACKGROUND_RECIPE "PPBACKGROUND"      // Recipe name
+
+// Data for processing
+typedef struct {
+    psString patternName;               // Filename of pattern
+    psString backgroundName;            // Filename of background
+    psString imageName, maskName;       // Filenames of input image/mask
+    psString outRoot;                   // Output root name
+    psMetadata *stats;                  // Statistics for output
+    FILE *statsFile;                    // Output statistics file
+    pmConfig *config;                   // Configuration
+} ppBackgroundData;
+
+/// Initialise data for processing
+ppBackgroundData *ppBackgroundDataInit(int *argc, char *argv[] // Command-line arguments
+    );
+
+/// Parse command-line arguments
+bool ppBackgroundArguments(ppBackgroundData *data, // Data for processing
+                        int argc, char *argv[] // Command-line arguments
+    );
+
+/// Parse camera configurations
+bool ppBackgroundCamera(ppBackgroundData *data // Data for processing
+    );
+
+/// Loop over input data, processing
+bool ppBackgroundLoop(ppBackgroundData *data // Data for processing
+    );
+
+/// Determine exit code
+psExit ppBackgroundExitCode(
+    psExit exitValue                    // Current exit code
+    );
+
+/// Add version information to header
+bool ppBackgroundVersionHeader(
+    psMetadata *header                  // Header to supplement
+    );
+
+/// Print version information to stdout
+void ppBackgroundVersionPrint(void);
+
+#endif
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundArguments.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundArguments.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundArguments.c	(revision 28304)
@@ -0,0 +1,76 @@
+/** @file ppBackgroundArguments.c
+ *
+ *  @brief
+ *
+ *  @ingroup ppBackground
+ *
+ *  @author Paul Price
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+
+/// Print usage information and die
+static void usage(const char *program,  // Name of the program
+                  psMetadata *arguments, // Command-line arguments
+                  ppBackgroundData *data   // Run-time data
+    )
+{
+    fprintf(stderr, "\nPan-STARRS background replacement\n\n");
+    fprintf(stderr, "Usage: %s OUTPUT_ROOT\n\n", program);
+    fprintf(stderr, "\n");
+    psArgumentHelp(arguments);
+    psFree(arguments);
+    psFree(data);
+
+    pmConfigDone();
+    psLibFinalize();
+
+    exit(PS_EXIT_CONFIG_ERROR);
+}
+
+
+bool ppBackgroundArguments(ppBackgroundData *data, int argc, char *argv[])
+{
+    assert(data);
+    assert(data->config);
+
+    psMetadata *arguments = psMetadataAlloc(); // Command-line arguments
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-pattern", 0, "Filename of pattern correction", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-background", 0, "Filename of background model", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-image", 0, "Filename of image", NULL);
+    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask", 0, "Filename of mask", NULL);
+    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 2) {
+        usage(argv[0], arguments, data);
+    }
+
+    data->patternName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-pattern"));
+    data->backgroundName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-background"));
+    data->imageName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-image"));
+    data->maskName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-mask"));
+    data->outRoot = psStringCopy(argv[1]);
+    psMetadataAddStr(data->config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Output root name", data->outRoot);
+
+    psTrace("ppBackground", 1, "Done reading command-line arguments\n");
+    psFree(arguments);
+
+    if (!data->patternName && !data->backgroundName) {
+        psError(PPBACKGROUND_ERR_CONFIG, true, "Must specify at least one of -pattern and -background");
+        return false;
+    }
+
+    PS_ASSERT_STRING_NON_EMPTY(data->outRoot, false);
+
+    return true;
+}
+
+
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundCamera.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundCamera.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundCamera.c	(revision 28304)
@@ -0,0 +1,83 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+
+/// Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc
+static void fileArguments(const char *file, // The symbolic name for the file
+                          const char *name, // The name of the file
+                          const char *comment, // Description of the file
+                          pmConfig *config // Configuration
+    )
+{
+    psArray *files = psArrayAlloc(1); // Array with file names
+    files->data[0] = psStringCopy(name);
+    if (psMetadataLookup(config->arguments, file)) {
+        psMetadataRemoveKey(config->arguments, file);
+    }
+    psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files);
+    psFree(files);
+    return;
+}
+
+
+bool ppBackgroundCamera(ppBackgroundData *data // Run-time data
+    )
+{
+    bool status;                        // Status of file definition
+
+    fileArguments("PATTERN", data->patternName, "Input pattern", data->config);
+    pmFPAfile *pattern = pmFPAfileDefineFromArgs(&status, data->config, "PPBACKGROUND.PATTERN",
+                                                 "PATTERN"); // File
+    if (!status) {
+        psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.PATTERN");
+        return false;
+    }
+
+    fileArguments("BACKGROUND", data->backgroundName, "Input background model", data->config);
+    pmFPAfile *background = pmFPAfileBindFromArgs(&status, data->config, "PPBACKGROUND.BACKGROUND",
+                                                  "BACKGROUND"); // File
+    if (!status) {
+        psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.BACKGROUND");
+        return false;
+    }
+
+    fileArguments("IMAGE", data->backgroundName, "Input uncorrected image", data->config);
+    pmFPAfile *image = pmFPAfileBindFromArgs(&status, background, data->config, "PPBACKGROUND.IMAGE",
+                                             "IMAGE"); // File
+    if (!status) {
+        psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.IMAGE");
+        return false;
+    }
+
+    fileArguments("MASK", data->backgroundName, "Input uncorrected mask", data->config);
+    pmFPAfile *mask = pmFPAfileBindFromArgs(&status, image, data->config, "PPBACKGROUND.MASK",
+                                              "MASK"); // File
+    if (!status) {
+        psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.MASK");
+        return false;
+    }
+
+    pmFPAfile *output = pmFPAfileDefineOutput(data->config, file->fpa, "PPBACKGROUND.OUTPUT");
+    if (!output) {
+        psError(psErrorCodeLast(), false, "Unable to define output.");
+        return false;
+    }
+    output->save = true;
+
+#if 0
+    // Now the camera has been determined, we can read the recipe
+    psMetadata *recipe = psMetadataLookupMetadata(NULL, data->config->recipes, PPBACKGROUND_RECIPE); // Recipe
+    if (!recipe) {
+        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPBACKGROUND_RECIPE);
+        return false;
+    }
+#endif
+
+    return true;
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundData.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundData.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundData.c	(revision 28304)
@@ -0,0 +1,56 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+
+// Destructor
+static void backgroundDataFree(ppBackgroundData *data // Data to free
+    )
+{
+    psFree(data->patternName);
+    psFree(data->backgroundName);
+    psFree(data->imageName);
+    psFree(data->maskName);
+    psFree(data->outRoot);
+    psFree(data->stats);
+    psFree(data->config);
+    return;
+}
+
+
+ppBackgroundData *ppBackgroundDataAlloc(void)
+{
+    ppBackgroundData *data = psAlloc(sizeof(ppBackgroundData)); // Processing data, to return
+    psMemSetDeallocator(data, (psFreeFunc)backgroundDataFree);
+
+    data->patternName = NULL;
+    data->backgroundName = NULL;
+    data->imageName = NULL;
+    data->maskName = NULL;
+    data->outRoot = NULL;
+    data->stats = NULL;
+    data->statsFile = NULL;
+    data->config = NULL;
+
+    return data;
+}
+
+
+ppBackgroundData *ppBackgroundDataInit(int *argc, char **argv)
+{
+    PS_ASSERT_PTR_NON_NULL(argc, NULL);
+    PS_ASSERT_PTR_NON_NULL(argv, NULL);
+
+    ppBackgroundData *data = ppBackgroundDataAlloc(); // Processing data, to return
+    data->config = pmConfigRead(argc, argv, PPBACKGROUND_RECIPE);
+    if (!data->config) {
+        psError(psErrorCodeLast(), false, "Unable to read configuration.");
+        return NULL;
+    }
+    return data;
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.c.in
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.c.in	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.c.in	(revision 28304)
@@ -0,0 +1,25 @@
+#include "pslib.h"
+#include "ppBackgroundErrorCodes.h"
+
+/*
+ * The line
+    { PPBACKGROUND_ERR_$X{ErrorCode}, "$X{ErrorDescription}"},
+ * (without the Xs)
+ * will be replaced by values from errorCodes.dat
+ */
+void ppBackgroundErrorRegister(void)
+{
+    static psErrorDescription errors[] = {
+       { PPBACKGROUND_ERR_BASE, "First value we use" },
+       { PPBACKGROUND_ERR_${ErrorCode}, "${ErrorDescription}"},
+    };
+    static int nerror = PPBACKGROUND_ERR_NERROR - PPBACKGROUND_ERR_BASE; ///< number of values in enum
+
+    for (int i = 0; i < nerror; i++) {
+       psErrorDescription *tmp = psAlloc(sizeof(psErrorDescription));
+       *tmp = errors[i];
+       psErrorRegister(tmp, 1);
+       psFree(tmp);                     /* it's on the internal list */
+    }
+    nerror = 0;                                 // don't register more than once
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.dat
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.dat	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.dat	(revision 28304)
@@ -0,0 +1,11 @@
+#
+# This file is used to generate ppBackgroundErrorClasses.h
+#
+BASE = 17000		First value we use
+UNKNOWN			Unknown ppBackground error code
+NOT_IMPLEMENTED		Desired feature is not yet implemented
+ARGUMENTS		Incorrect arguments
+CONFIG			Problem in configure files
+IO			Problem in FITS I/O
+DATA                    Problem in data values
+PROG			Programming error
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.h.in
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.h.in	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundErrorCodes.h.in	(revision 28304)
@@ -0,0 +1,18 @@
+#if !defined(PPBACKGROUND_ERROR_CODES_H)
+#define PPBACKGROUND_ERROR_CODES_H
+/*
+ * The line
+ *  PPBACKGROUND_ERR_$X{ErrorCode},
+ * (without the X)
+ *
+ * will be replaced by values from errorCodes.dat
+ */
+typedef enum {
+    PPBACKGROUND_ERR_BASE = 17000,
+    PPBACKGROUND_ERR_${ErrorCode},
+    PPBACKGROUND_ERR_NERROR
+} ppBackgroundErrorCode;
+
+void ppBackgroundErrorRegister(void);
+
+#endif
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundExit.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundExit.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundExit.c	(revision 28304)
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <pslib.h>
+
+#include "ppBackground.h"
+
+psExit ppBackgroundExitCode(psExit exitValue)
+{
+    if (exitValue != PS_EXIT_SUCCESS) {
+        return exitValue;
+    }
+
+    psErrorCode errorCode = psErrorCodeLast(); // Error code
+    if (errorCode != PS_ERR_NONE) {
+        pmFPAfileFreeSetStrict(false);
+        psErrorStackPrint(stderr, "Error in subtraction:");
+        switch (errorCode) {
+          case PS_ERR_UNKNOWN:
+            psLogMsg("ppBackground", PS_LOG_WARN, "Unknown error code: %x", errorCode);
+            exitValue = PS_EXIT_UNKNOWN_ERROR;
+            break;
+          case PS_ERR_IO:
+          case PS_ERR_DB_CLIENT:
+          case PS_ERR_DB_SERVER:
+          case PS_ERR_BAD_FITS:
+          case PS_ERR_OS_CALL_FAILED:
+          case PM_ERR_SYS:
+            psLogMsg("ppBackground", PS_LOG_WARN, "I/O error code: %x", errorCode);
+            exitValue = PS_EXIT_SYS_ERROR;
+            break;
+          case PS_ERR_BAD_PARAMETER_VALUE:
+          case PS_ERR_BAD_PARAMETER_TYPE:
+          case PS_ERR_BAD_PARAMETER_NULL:
+          case PS_ERR_BAD_PARAMETER_SIZE:
+          case PPBACKGROUND_ERR_ARGUMENTS:
+          case PPBACKGROUND_ERR_CONFIG:
+            psLogMsg("ppBackground", PS_LOG_WARN, "Configuration error code: %x", errorCode);
+            exitValue = PS_EXIT_CONFIG_ERROR;
+            break;
+          case PPBACKGROUND_ERR_DATA:
+            psLogMsg("ppBackground", PS_LOG_WARN, "Data error code: %x", errorCode);
+            exitValue = PS_EXIT_DATA_ERROR;
+            break;
+          case PS_ERR_UNEXPECTED_NULL:
+          case PS_ERR_PROGRAMMING:
+          case PPBACKGROUND_ERR_PROG:
+            psLogMsg("ppBackground", PS_LOG_WARN, "Programming error code: %x", errorCode);
+            exitValue = PS_EXIT_PROG_ERROR;
+            break;
+          default:
+            // It's a programming error if we're not dealing with the error correctly
+            psLogMsg("ppBackground", PS_LOG_WARN, "Unrecognised error code: %x", errorCode);
+            exitValue = PS_EXIT_PROG_ERROR;
+            break;
+        }
+    }
+
+    return exitValue;
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundLoop.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundLoop.c	(revision 28304)
@@ -0,0 +1,161 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+
+bool ppBackgroundLoop(ppBackgroundData *data // Run-time data
+    )
+{
+    pmConfig *config = data->config;                                        // Configuration data
+    pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.BACKGROUND", 0);
+    pmFPAfile *patternFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.PATTERN", 0); // File with data
+    pmFPA *patternMosaic = pmFPAConstruct(file->camera, file->cameraName); // Mosaicked FPA for pattern
+
+    psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Mask value to set
+
+    pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+        return NULL;
+    }
+    pmConceptsCopyFPA(patternMosaic, file->fpa, false, false);
+    pmChip *chip;                       // Chip from FPA
+    while ((chip = pmFPAviewNextChip(view, file->fpa, 1))) {
+        if (!chip->process || !chip->file_exists) {
+            continue;
+        }
+        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+            psError(psErrorCodeLast(), false, "Error loading data from files.");
+            return false;
+        }
+
+        if (chip->cell->n > 1) {
+            psError(PPBACKGROUND_ERR_CONFIG, true,
+                    "Input image and background model should be chip-mosaicked");
+            return false;
+        }
+
+        if (data->patternName) {
+            pmFPAfileActivate(config->files, false, NULL);
+            pmFPAfileActivate(config->files, true, "PPBACKGROUND.PATTERN");
+
+            pmCell *cell;               // Cell with pattern data
+            while ((patternCell = pmFPAviewNextCell(view, patternFile->fpa, 1))) {
+                if (!cell->process || !cell->file_exists) {
+                    continue;
+                }
+                if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+                    psError(psErrorCodeLast(), false, "Error loading data from files.");
+                    return false;
+                }
+
+                pmReadout *readout;         // Readout with pattern data
+                while ((readout = pmFPAviewNextReadout(view, patternFile->fpa, 1))) {
+                    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+                        psError(psErrorCodeLast(), false, "Error loading data from files.");
+                        return false;
+                    }
+                    if (!readout->data_exists) {
+                        continue;
+                    }
+
+                    int numCols = 0, numRows = 0; // Size of image
+
+                    // Get size of image from concepts
+                    if (numCols == 0 || numRows == 0) {
+                        numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE");
+                        numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE");
+                    }
+                    // Get size of image from TRIMSEC
+                    if (numCols == 0 || numRows == 0) {
+                        psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC");
+                        numCols = trimsec->x1 - trimsec->x0;
+                        numRows = trimsec->y1 - trimsec->y0;
+                    }
+                    if (numCols <= 0 || numRows <= 0) {
+                        psError(PS_ERR_UNKNOWN, true, "Image size isn't set: %dx%d.", numCols, numRows);
+                        return false;
+                    }
+
+                    readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32);
+                    psImageInit(readout->image, 0.0);
+
+                    if (!pmPatternRowApply(readout, maskBad) || !pmPatternCellApply(readout, maskBad)) {
+                        psError(psErrorCodeLast(), false, "Unable to apply pattern correction.");
+                        return false;
+                    }
+
+                    // Remove bias sections to avoid warnings
+                    psMetadataItem *biassec = psMetadataLookup(patternRO->parent->concepts, "CELL.BIASSEC");
+                    if (psListLength(biassec->data.V)) {
+                        psFree(biassec->data.V);
+                        biassec->data.V = psListAlloc(NULL);
+                    }
+
+                    readout->data_exists = true;
+                    readout->parent->data_exists = true;
+                    readout->parent->parent->data_exists = true;
+
+                    // Readout
+                    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+                        psError(psErrorCodeLast(), false, "Error saving data to files.");
+                        return false;
+                    }
+                }
+                // Cell
+                if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+                    psError(psErrorCodeLast(), false, "Error saving data to files.");
+                    return false;
+                }
+            }
+
+            pmChip *mosaic = pmFPAviewThisChip(view, patternMosaic); // Chip for mosaicked pattern
+            if (!pmChipMosaic(mosaic, chip, true, maskBad)) {
+                psError(psErrorCodeLast(), false, "Unable to mosaic pattern correction");
+                return false;
+            }
+            pmFPAfileActivate(config->files, true, NULL);
+            pmFPAfileActivate(config->files, false, "PPBACKGROUND.PATTERN");
+        }
+
+
+
+
+
+
+
+                pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, cell); // HDU for readout
+                if (!hdu) {
+                    psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data.");
+                    return false;
+                }
+                if (!hdu->header) {
+                    hdu->header = psMetadataAlloc();
+                }
+                ppBackgroundVersionHeader(hdu->header);
+
+
+
+
+
+
+
+
+        // Chip
+        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+            psError(psErrorCodeLast(), false, "Error saving data to files.");
+            return false;
+        }
+    }
+    // FPA
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+        psError(psErrorCodeLast(), false, "Error saving data to files.");
+        return false;
+    }
+
+    return true;
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundModel.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundModel.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundModel.c	(revision 28304)
@@ -0,0 +1,92 @@
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+#include <psphot.h>
+
+
+bool ppBackgroundModel(
+        pmReadout *ro = cell->readouts->data[0]; // Readout of interest
+        if (!ro || !ro->data_exists) {
+            psError(PS_ERR_UNKNOWN, true, "readout has no data");
+            return false;
+        }
+        psImage *image = ro->image;
+//        psImage *mask = NULL;
+//        psImageMaskType maskVal = 0;
+
+        pmFPAview roView = *view;
+        roView.cell = 0;
+        roView.readout = 0;
+        pmReadout *modelRO = pmFPAviewThisReadout(&roView, backmdl->fpa);
+        if (!modelRO || !modelRO->data_exists) {
+            psError(PS_ERR_UNKNOWN, true, "model readout has no data");
+            return false;
+        }
+        output->save = true;
+        background->save = save_background;
+
+        psImageBinning *binning = psphotBackgroundBinning(image, config);
+        if (!binning) {
+            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find background binning");
+            return false;
+        }
+        pmReadout *backgroundRO;
+#define USE_CELL
+#ifdef USE_CELL
+        pmCell *backgroundCell = pmFPAviewThisCell(&roView, background->fpa);
+        backgroundRO = pmReadoutAlloc(backgroundCell);
+#else
+        backgroundRO = pmFPAviewThisReadout(&roView, background->fpa);
+//        backgroundRO = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", image->numCols, image->numRows, PS_TYPE_F32);
+#endif
+        backgroundRO->image = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32);
+        backgroundRO->data_exists = true;
+        backgroundRO->parent->data_exists = true;
+        backgroundRO->parent->parent->data_exists = true;
+
+        // linear interpolation to full-scale
+        if (!psImageUnbin (backgroundRO->image, modelRO->image, binning)) {
+            psError (PSPHOT_ERR_PROG, true, "inconsistent sizes for unbinning");
+            psFree(binning);
+            return false;
+        }
+        psFree(binning);
+        psF32 **backData = backgroundRO->image->data.F32;
+
+        // Undo the background subtraction
+        int numCols = image->numCols, numRows = image->numRows; // Size of image
+        long nancount = 0;
+        long naninputs = 0;
+        long finitecount = 0;
+        for (int y = 0; y < numRows; y++) {
+            for (int x = 0; x < numCols; x++) {
+                float imageval =  image->data.F32[y][x] ;
+                float bgvalue = backData[y][x];
+                if (!isfinite(bgvalue)) {
+                    // if background is NAN leave the image unchanged
+                    // According to ppImageSubtractBackground pixels where the background is not finite should be NAN
+                    // experimentally
+                    // for breakpoint
+                    nancount++;
+                    if (isfinite(imageval)) {
+                         finitecount++;
+                         //   psWarning("unexpected finite image value %f found at %d %d background is infinite", imageval, x, y);
+                    }
+                    //      Doing this is causes a lot of new NAN pixels to appear.
+                    //      NANS are appearing in the model for some reason.
+                    //      image->data.F32[y][x] = NAN;
+                } else if (isfinite(imageval)) {
+                    // XXX: TODO:following ppImage we should not modify pixels that are masked.
+                    image->data.F32[y][x] = imageval + bgvalue;
+                } else {
+                    naninputs++;
+                }
+            }
+        }
+        if (naninputs) {
+            printf("%ld infinite pixels found in input image\n", naninputs);
+        }
+        if (nancount) {
+            psWarning("%ld infinite pixels found in background %ld pixels were finite\n", nancount, finitecount);
+        }
+//        pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND");
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersion.c
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersion.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersion.c	(revision 28304)
@@ -0,0 +1,118 @@
+/** @file ppBackgroundVersion.c
+ *
+ *  @brief
+ *
+ *  @ingroup ppBackground
+ *
+ *  @author IfA
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 19:45:30 $
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppBackground.h"
+#include "ppBackgroundVersionDefinitions.h"
+
+#ifndef PPBACKGROUND_VERSION
+#error "PPBACKGROUND_VERSION is not set"
+#endif
+#ifndef PPBACKGROUND_BRANCH
+#error "PPBACKGROUND_BRANCH is not set"
+#endif
+#ifndef PPBACKGROUND_SOURCE
+#error "PPBACKGROUND_SOURCE is not set"
+#endif
+
+psString ppBackgroundVersion(void)
+{
+    char *value = NULL;
+    psStringAppend(&value, "%s@%s", PPBACKGROUND_BRANCH, PPBACKGROUND_VERSION);
+    return value;
+}
+
+psString ppBackgroundSource(void)
+{
+    return psStringCopy(PPBACKGROUND_SOURCE);
+}
+
+psString ppBackgroundVersionLong(void)
+{
+    psString version = ppBackgroundVersion();  // Version, to return
+    psString source = ppBackgroundSource();    // Source
+
+    psStringPrepend(&version, "ppBackground ");
+    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
+    psFree(source);
+
+#ifdef __OPTIMIZE__
+    psStringAppend(&version, " optimised");
+#else
+    psStringAppend(&version, " unoptimised");
+#endif
+
+    return version;
+};
+
+bool ppBackgroundVersionHeader(psMetadata *header)
+{
+    PS_ASSERT_METADATA_NON_NULL(header, false);
+
+    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
+    psString timeString = psTimeToISO(time); // The time in an ISO string
+    psFree(time);
+    psString history = NULL;               // History string
+    psStringAppend(&history, "ppBackground at %s", timeString);
+    psFree(timeString);
+    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history);
+    psFree(history);
+
+    psLibVersionHeader(header);
+    psModulesVersionHeader(header);
+
+    psString version = ppBackgroundVersion(); // Software version
+    psString source  = ppBackgroundSource();  // Software source
+
+    psMetadataAddStr(header, PS_LIST_TAIL, "VIZPAT_V", PS_META_REPLACE, NULL, PPBACKGROUND_VERSION);
+    
+    psStringPrepend(&version, "ppBackground version: ");
+    psStringPrepend(&version, "ppBackground source: ");
+
+    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version);
+    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source);
+
+    psFree(version);
+    psFree(source);
+
+    return true;
+}
+
+void ppBackgroundVersionPrint(void)
+{
+    psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now
+    psString timeString = psTimeToISO(time); // The time in an ISO string
+    psFree(time);
+    psLogMsg("ppBackground", PS_LOG_INFO, "ppBackground at %s", timeString);
+    psFree(timeString);
+
+    psString pslib = psLibVersionLong();// psLib version
+    psString psmodules = psModulesVersionLong(); // psModules version
+    psString ppBackground = ppBackgroundVersionLong(); // ppBackground version
+
+    psLogMsg("ppBackground", PS_LOG_INFO, "%s", pslib);
+    psLogMsg("ppBackground", PS_LOG_INFO, "%s", psmodules);
+    psLogMsg("ppBackground", PS_LOG_INFO, "%s", ppBackground);
+
+    psFree(pslib);
+    psFree(psmodules);
+    psFree(ppBackground);
+
+    return;
+}
Index: /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersionDefinitions.h.in
===================================================================
--- /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersionDefinitions.h.in	(revision 28304)
+++ /branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersionDefinitions.h.in	(revision 28304)
@@ -0,0 +1,8 @@
+#ifndef PPVIZPATTERN_VERSION_DEFINITIONS_H
+#define PPVIZPATTERN_VERSION_DEFINITIONS_H
+
+#define PPVIZPATTERN_VERSION @PPVIZPATTERN_VERSION@ // SVN version
+#define PPVIZPATTERN_BRANCH  @PPVIZPATTERN_BRANCH@  // SVN branch
+#define PPVIZPATTERN_SOURCE  @PPVIZPATTERN_SOURCE@  // SVN source
+
+#endif
Index: /branches/czw_branch/20100519/ppImage/src/ppImageCleanup.c
===================================================================
--- /branches/czw_branch/20100519/ppImage/src/ppImageCleanup.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppImage/src/ppImageCleanup.c	(revision 28304)
@@ -29,5 +29,5 @@
 
     // fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "ppImage");
-    fprintf(stderr, "Found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppImage");
+    psLogMsg("ppImage", PS_LOG_INFO, "Memory leaks: %d\n", psMemCheckLeaks(0, NULL, stdout, false));
 
     return;
Index: /branches/czw_branch/20100519/ppImage/src/ppImageLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppImage/src/ppImageLoop.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppImage/src/ppImageLoop.c	(revision 28304)
@@ -51,5 +51,5 @@
             ESCAPE("load failure for Chip");
         }
-
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         // crosstalk measurement needs to be done on the entire chip at once, and before
         // signal levels are modified by the detrending.  If crosstalk measurement is
@@ -65,5 +65,5 @@
           ESCAPE("Unable to perform crosstalk correction");
         }
-
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         psTimerStart(TIMER_DETREND);
         pmCell *cell;                   // Cell from chip
@@ -152,5 +152,5 @@
             ESCAPE("Unable to free detrend images");
         }
-
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         // Apply the fringe correction
         if (options->doFringe) {
@@ -163,5 +163,5 @@
             ESCAPE("Unable to free fringe images");
         }
-
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         // Apply the pattern correction
         if (options->doPatternRow || options->doPatternCell) {
@@ -170,9 +170,10 @@
           }
         }
-
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         // measure various pixel-based statistics for this image
         if (!ppImagePixelStats(config, stats, options, view)) {
             ESCAPE("Unable to measures pixel stats for image");
         }
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         if (!ppImageMosaicChip(config, options, view, "PPIMAGE.CHIP", "PPIMAGE.OUTPUT")) {
             ESCAPE("Unable to mosaic chip");
@@ -181,4 +182,5 @@
 
         // we perform photometry on the readouts of this chip in the output
+	printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
         psTimerStart(TIMER_PHOT);
         if (options->doPhotom) {
Index: /branches/czw_branch/20100519/ppImage/src/ppImageMaskStats.c
===================================================================
--- /branches/czw_branch/20100519/ppImage/src/ppImageMaskStats.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppImage/src/ppImageMaskStats.c	(revision 28304)
@@ -6,7 +6,12 @@
 
 
-bool ppImageMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats) {
+bool ppImageMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats)
+{
   PS_ASSERT_PTR_NON_NULL(view, false);
   PS_ASSERT_PTR_NON_NULL(config, false);
+
+  if (!stats) {
+      return true;
+  }
 
   bool status;
@@ -19,5 +24,5 @@
 
   psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PPIMAGE");
-  
+
   psU16 staticMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.STATIC");
   psU16 magicMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.MAGIC");
@@ -60,28 +65,28 @@
     return(true);
   }
-  
+
   psImage *mask = readout->mask;  // Mask of interest;
   psWarning("In ppImageMaskStats: %d %ld\n",Npix_valid, (long) mask);
 
   if (!pmSingleImageMaskStats(mask,&Npix_valid,&Npix_static,&Npix_magic,
-			      &Npix_dynamic,&Npix_advisory,
-			      staticMaskVal,magicMaskVal,
-			      dynamicMaskVal,advisoryMaskVal)) {
+                              &Npix_dynamic,&Npix_advisory,
+                              staticMaskVal,magicMaskVal,
+                              dynamicMaskVal,advisoryMaskVal)) {
     psError(PS_ERR_UNKNOWN, false, "Unable to calculate masks for readout.");
     return(false);
   }
   psMetadataAddS32(stats, PS_LIST_TAIL,"MASKFRAC_NPIX", 0,
-		   "Number of valid pixels", Npix_valid);
+                   "Number of valid pixels", Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_STATIC", 0,
-		   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
+                   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_DYNAMIC", 0,
-		   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
+                   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", 0,
-		   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
+                   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_ADVISORY", 0,
-		   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
+                   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
   psWarning("In ppImageMaskStats: %d %f %f %f %f\n",Npix_valid, (float) Npix_static / Npix_valid,
-	    (float) Npix_dynamic / Npix_valid, (float) Npix_magic / Npix_valid,
-	    (float) Npix_advisory / Npix_valid);
+            (float) Npix_dynamic / Npix_valid, (float) Npix_magic / Npix_valid,
+            (float) Npix_advisory / Npix_valid);
   return(true);
 }
Index: /branches/czw_branch/20100519/ppImage/src/ppImageMosaic.c
===================================================================
--- /branches/czw_branch/20100519/ppImage/src/ppImageMosaic.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppImage/src/ppImageMosaic.c	(revision 28304)
@@ -9,5 +9,5 @@
 {
     bool status;                        // Status of MD lookup
-
+	printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     pmFPAfile *in = psMetadataLookupPtr(&status, config->files, inFile); // Input file
     if (!status) {
@@ -15,5 +15,5 @@
         exit(EXIT_FAILURE);
     }
-
+	printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     pmFPAfile *out = psMetadataLookupPtr(&status, config->files, outFile); // Output file
     if (!status) {
@@ -21,5 +21,5 @@
         exit(EXIT_FAILURE);
     }
-
+	printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     pmChip *outChip = pmFPAviewThisChip(view, out->fpa);
     pmChip *inChip = pmFPAviewThisChip(view, in->fpa);
@@ -27,5 +27,23 @@
         pmFPAAddSourceFromView(out->fpa, view, out->format);
     }
-
+	printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
+    // If the input is a dark (normalising and mosaicking) then it looks like a video cell and will be ignored
+    // by pmChipMosaic.  We therefore hack the structure so it doesn't look like a video cell.
+    psVector *darkNumbers = NULL;       // Number of dark readouts for each cell
+    //    psVectorInit(darkNumbers, 0);
+    printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
+    if (psMetadataLookupBool(&status, config->arguments, "INPUT_IS_DARK")) {
+        darkNumbers = psVectorAlloc(inChip->cells->n, PS_TYPE_S32);
+	psVectorInit(darkNumbers, 0);
+        for (int i = 0; i < inChip->cells->n; i++) {
+            pmCell *cell = inChip->cells->data[i];
+            if (!cell) {
+                continue;
+            }
+            darkNumbers->data.S32[i] = cell->readouts->n;
+            cell->readouts->n = 1;
+        }
+    }
+	printf("PPMI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     psTrace("pmChipMosaic", 5, "mosaic chip %s to %s (xbin,ybin: %d,%d to %d,%d)\n",
             in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin);
@@ -34,4 +52,17 @@
     // image products pure trimmed images, but also increases the memory footprint.
     status = pmChipMosaic(outChip, inChip, true, options->blankMask);
+
+    // Restore dark structure
+    if (darkNumbers) {
+        for (int i = 0; i < inChip->cells->n; i++) {
+            pmCell *cell = inChip->cells->data[i];
+            if (!cell) {
+                continue;
+            }
+            cell->readouts->n = darkNumbers->data.S32[i];
+        }
+        psFree(darkNumbers);
+    }
+
     return status;
 }
Index: /branches/czw_branch/20100519/ppImage/src/ppImagePhotom.c
===================================================================
--- /branches/czw_branch/20100519/ppImage/src/ppImagePhotom.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppImage/src/ppImagePhotom.c	(revision 28304)
@@ -11,7 +11,7 @@
     pmCell *cell;
     pmReadout *readout;
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     psphotInit();
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // find or define a pmFPAfile PSPHOT.INPUT
     pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT");
@@ -20,10 +20,10 @@
         return false;
     }
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // we make a new copy of the output chip to keep psphot from modifying the output image
     pmChip *oldChip = pmFPAviewThisChip (view, input->src);
     pmChip *newChip = pmFPAviewThisChip (view, input->fpa);
     pmChipCopy (newChip, oldChip);
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // iterate over the cells and readout for this chip
     while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
@@ -34,5 +34,5 @@
         while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
             if (! readout->data_exists) { continue; }
-
+	    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
             // run the actual photometry analysis
             if (!psphotReadout (config, view)) {
Index: /branches/czw_branch/20100519/ppSim/src/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ppSim/src/Makefile.am	(revision 28303)
+++ /branches/czw_branch/20100519/ppSim/src/Makefile.am	(revision 28304)
@@ -43,4 +43,5 @@
 	ppSimBounds.c             \
 	ppSimStars.c              \
+	ppSimSmoothReadout.c      \
 	ppSimSetPSF.c             \
 	ppSimUtils.c              \
Index: /branches/czw_branch/20100519/ppSim/src/ppSim.h
===================================================================
--- /branches/czw_branch/20100519/ppSim/src/ppSim.h	(revision 28303)
+++ /branches/czw_branch/20100519/ppSim/src/ppSim.h	(revision 28304)
@@ -106,4 +106,6 @@
 bool ppSimInsertStars (pmReadout *readout, psImage *expCorr, psArray *stars, pmConfig *config);
 
+bool ppSimSmoothReadout(pmReadout *input, psMetadata *recipe);
+
 bool ppSimInitHeader(pmConfig *config,
                      pmFPA *fpa,
Index: /branches/czw_branch/20100519/ppSim/src/ppSimInsertStars.c
===================================================================
--- /branches/czw_branch/20100519/ppSim/src/ppSimInsertStars.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSim/src/ppSimInsertStars.c	(revision 28304)
@@ -23,4 +23,6 @@
     // XXX this is missing the gain.
     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe
+
+    bool psfConvolve = psMetadataLookupBool(NULL, recipe, "PSF.CONVOLVE"); // smooth the image with the PSF?
 
     float expTime   = psMetadataLookupF32(NULL, recipe, "EXPTIME"); // Exposure time
@@ -103,43 +105,50 @@
         float flux = star->flux * expCorr->data.F32[(int)yCell][(int)xCell];
 
-        // instantiate a model for the PSF at this location, set desired flux
-        pmModel *model = pmModelFromPSFforXY (psf, xChip, yChip, 1.0);
-        pmModelSetFlux (model, flux);
+	// if psfConvolve is TRUE, we will (elsewhere) convolve the image we a PSF
+	// in this case, simply place delta functions in the image
+	if (psfConvolve) {
+	    readout->image->data.F32[(int)(yCell)][(int)(xCell)] += flux;
+	    continue;
+	}
 
-        float radius = model->modelRadius (model->params, nSigmaLim * roughNoise);
-        radius = PS_MAX (radius, 1.0);
+	// instantiate a model for the PSF at this location, set desired flux
+	pmModel *model = pmModelFromPSFforXY (psf, xChip, yChip, 1.0);
+	pmModelSetFlux (model, flux);
 
-        // construct a source, with model flux pixels set, based on the model
-        pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_STAR);
+	float radius = model->modelRadius (model->params, nSigmaLim * roughNoise);
+	radius = PS_MAX (radius, 1.0);
 
-        // XXX set the mag & err values (should this be done in pmSourceFromModel?)
-        // XXX i should be applying the gain and the correct effective area
-        psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, 20.0);
-        psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
+	// construct a source, with model flux pixels set, based on the model
+	pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_STAR);
 
-        // this value is the pure (input) flux, and is saved in the output source cmf files
-        source->psfMag = -2.5*log10(star->flux);
-        source->errMag = sqrt(Area*PS_SQR(roughNoise) + flux) / flux;
+	// XXX set the mag & err values (should this be done in pmSourceFromModel?)
+	// XXX i should be applying the gain and the correct effective area
+	psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, 20.0);
+	psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
 
-        fprintf (outfile, "%8.3f %8.3f  %10.2f  %7.3f %5.3f\n", star->x, star->y, star->flux, source->psfMag, source->errMag);
+	// this value is the pure (input) flux, and is saved in the output source cmf files
+	source->psfMag = -2.5*log10(star->flux);
+	source->errMag = sqrt(Area*PS_SQR(roughNoise) + flux) / flux;
 
-        // insert the source flux in the image
-        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
+	fprintf (outfile, "%8.3f %8.3f  %10.2f  %7.3f %5.3f\n", star->x, star->y, star->flux, source->psfMag, source->errMag);
 
-        // insert the source flux in the noise image
-        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, dX, dY);
+	// insert the source flux in the image
+	pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
 
-        // Blow away the image parts of the source, which makes the memory explode
-        RESET(source->pixels);
-        RESET(source->variance);
-        RESET(source->maskObj);
-        RESET(source->maskView);
-        RESET(source->modelFlux);
-        RESET(source->psfImage);
-        RESET(source->blends);
+	// insert the source flux in the noise image
+	pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, dX, dY);
 
-        // add the sources to the source array
-        psArrayAdd (sources, 100,source);
-        psFree(source);                 // Drop reference
+	// Blow away the image parts of the source, which makes the memory explode
+	RESET(source->pixels);
+	RESET(source->variance);
+	RESET(source->maskObj);
+	RESET(source->maskView);
+	RESET(source->modelFlux);
+	RESET(source->psfImage);
+	RESET(source->blends);
+
+	// add the sources to the source array
+	psArrayAdd (sources, 100,source);
+	psFree(source);                 // Drop reference
     }
     fclose (outfile);
Index: /branches/czw_branch/20100519/ppSim/src/ppSimLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppSim/src/ppSimLoop.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSim/src/ppSimLoop.c	(revision 28304)
@@ -30,4 +30,6 @@
     ppSimType type = ppSimTypeFromString (typeStr); // Type of image to simulate
     int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y
+
+    bool psfConvolve = psMetadataLookupBool(NULL, recipe, "PSF.CONVOLVE"); // smooth the image with the PSF?
 
     ppSimUpdateConceptsFPA (fpa, config);
@@ -155,4 +157,11 @@
                 psFree(expCorr);
 
+		// we have two options for generating images which have a PSF:
+		// 1) lay down stars with the PSF model applied : in this case, galaxies do NOT have the PSF
+		// 2) lay down delta functions for stars and smooth the image with a PSF : in this case, the stars land at integer pixel locations
+		if (psfConvolve) {
+		    if (!ppSimSmoothReadout(readout, recipe)) ESCAPE (PS_ERR_UNKNOWN, "problem smoothing image");
+		}
+
             done:
                 if (!ppSimAddNoise(readout->image, readout->variance, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");
Index: /branches/czw_branch/20100519/ppSim/src/ppSimSmoothReadout.c
===================================================================
--- /branches/czw_branch/20100519/ppSim/src/ppSimSmoothReadout.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppSim/src/ppSimSmoothReadout.c	(revision 28304)
@@ -0,0 +1,29 @@
+#include "ppSim.h"
+
+bool ppSimSmoothReadout(pmReadout *input, psMetadata *recipe)
+{
+    bool status;
+
+    // XXX use these defaults?
+    // float minGauss = 0.1;
+    float nSigma = 3.0;
+    float sigma = psMetadataLookupF32(&status, recipe, "SEEING"); // Seeing SIGMA (pixels)
+
+    // bool oldThreads = psImageConvolveSetThreads(true); // Old value of threading in psImageConvolve
+
+    psTimerStart ("ppSmooth");
+
+    // smooth the image in place, applying the mask as we go
+    psImageSmooth(input->image, sigma, nSigma);
+    psLogMsg("ppSmooth", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark("ppSmooth"));
+
+    // psImageConvolveSetThreads(oldThreads);
+    return true;
+}
+
+// The variance is smoothed by the PSF^2, renomalized to maintain the input level of the
+// variance.  We achieve this by smoothing with a Gaussian with sigma = SIGMA_SMTH/sqrt(2) with
+// unity normalization.  Note that this process yields a smoothed image with correlated errors.
+// The pixel-to-pixel variations in smooth_im will be decreased by a factor of
+// 4*pi*SIGMA_SMTH^2, but for measurements based on apertures comparable to or larger than the
+// smoothing kernel, the effective per-pixel variance is maintained.
Index: /branches/czw_branch/20100519/ppStack/src/Makefile.am
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/Makefile.am	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/Makefile.am	(revision 28304)
@@ -48,4 +48,5 @@
 	ppStackPhotometry.c	\
 	ppStackFinish.c		\
+	ppStackTarget.c		\
 	ppStackErrorCodes.c
 
Index: /branches/czw_branch/20100519/ppStack/src/ppStack.h
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStack.h	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStack.h	(revision 28304)
@@ -26,4 +26,5 @@
 typedef enum {
     PPSTACK_FILES_PREPARE,              // Files for preparation
+    PPSTACK_FILES_TARGET,               // Files for target generation
     PPSTACK_FILES_CONVOLVE,             // Files for convolution
     PPSTACK_FILES_STACK,                // Stack files
@@ -115,6 +116,12 @@
 void ppStackVersionPrint(void);
 
+/// Generate target PSF image
+psImage *ppStackTarget(ppStackOptions *options, // Options for stacking
+                       pmConfig *config         // Configuration
+    );
+
 /// Convolve image to match specified seeing
 bool ppStackMatch(pmReadout *readout,   // Readout to be convolved; replaced with output
+                  const psImage *target,   // Target PSF image
                   ppStackOptions *options, // Options for stacking
                   int index,            // Index of image to match
Index: /branches/czw_branch/20100519/ppStack/src/ppStackConvolve.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackConvolve.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackConvolve.c	(revision 28304)
@@ -45,4 +45,13 @@
     options->convCovars = psArrayAlloc(num); // Covariance matrices
 
+    psImage *target = NULL;             // Target PSF image
+    if (options->convolve) {
+        target = ppStackTarget(options, config);
+        if (!target) {
+            psError(psErrorCodeLast(), false, "Unable to produce stack target image");
+            return false;
+        }
+    }
+
     psVector *renorms = psVectorAlloc(num, PS_TYPE_F32); // Renormalisation values for variances
     psVectorInit(renorms, NAN);
@@ -71,4 +80,5 @@
             psFree(fpaList);
             psFree(cellList);
+            psFree(target);
             return false;
         }
@@ -87,4 +97,5 @@
             psFree(fpaList);
             psFree(cellList);
+            psFree(target);
             return false;
         }
@@ -93,5 +104,5 @@
         psTimerStart("PPSTACK_MATCH");
         options->origCovars->data[i] = psMemIncrRefCounter(readout->covariance);
-        if (!ppStackMatch(readout, options, i, config)) {
+        if (!ppStackMatch(readout, target, options, i, config)) {
             // XXX many things can cause a failure of ppStackMatch -- should some be handled differently?
             psErrorCode error = psErrorCodeLast(); // Error code
@@ -102,4 +113,8 @@
               case PPSTACK_ERR_IO:
                 psError(error, false, "Unable to match image %d due to fatal error.", i);
+                psFree(rng);
+                psFree(fpaList);
+                psFree(cellList);
+                psFree(target);
                 return false;
                 // Non-fatal errors
@@ -154,4 +169,5 @@
             psFree(cellList);
             psFree(rng);
+            psFree(target);
             return false;
         }
@@ -164,4 +180,5 @@
             psFree(rng);
             psFree(maskHeader);
+            psFree(target);
             return false;
         }
@@ -172,4 +189,5 @@
             psFree(cellList);
             psFree(rng);
+            psFree(target);
             return false;
         }
@@ -222,4 +240,5 @@
             psFree(cellList);
             psFree(rng);
+            psFree(target);
             return false;
         }
@@ -229,4 +248,5 @@
     }
     psFree(rng);
+    psFree(target);
 
     psFree(options->sourceLists); options->sourceLists = NULL;
@@ -235,8 +255,11 @@
 
     if (numGood == 0) {
-        psError(PPSTACK_ERR_REJECTED, false, "No good images to combine.");
+        options->quality = PPSTACK_ERR_REJECTED;
+        psErrorStackPrint(stderr, "No good images survived convolution stage.");
+        psErrorClear();
+        psWarning("No good images survived convolution stage.");
         psFree(fpaList);
         psFree(cellList);
-        return false;
+        return true;
     }
 
@@ -324,6 +347,9 @@
 
     if (numGood == 0) {
-        psError(PPSTACK_ERR_REJECTED, false, "No good images to combine.");
-        return false;
+        options->quality = PPSTACK_ERR_REJECTED;
+        psErrorStackPrint(stderr, "No good images survived convolution stage.");
+        psErrorClear();
+        psWarning("No good images survived convolution stage.");
+        return true;
     }
 
Index: /branches/czw_branch/20100519/ppStack/src/ppStackErrorCodes.h.in
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackErrorCodes.h.in	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackErrorCodes.h.in	(revision 28304)
@@ -21,5 +21,5 @@
  */
 typedef enum {
-    PPSTACK_ERR_BASE = 14000,
+    PPSTACK_ERR_BASE = 13000,
     PPSTACK_ERR_${ErrorCode},
     PPSTACK_ERR_NERROR
Index: /branches/czw_branch/20100519/ppStack/src/ppStackFiles.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackFiles.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackFiles.c	(revision 28304)
@@ -16,8 +16,9 @@
 static char *filesPrepare[] = { "PPSTACK.INPUT.PSF", "PPSTACK.INPUT.SOURCES", "PPSTACK.TARGET.PSF", NULL };
 
+/// Files required for generating convolution target
+static char *filesTarget[] = { "PPSTACK.INPUT.VARIANCE", "PPSTACK.INPUT.MASK", NULL };
+
 /// Files required for the convolution
 static char *filesConvolve[] = { "PPSTACK.INPUT", "PPSTACK.INPUT.MASK", "PPSTACK.INPUT.VARIANCE", NULL };
-
-//                                 "PPSTACK.CONV.KERNEL", NULL };
 
 /// Regular (convolved) stack files
@@ -41,4 +42,5 @@
     switch (list) {
       case PPSTACK_FILES_PREPARE:  return filesPrepare;
+      case PPSTACK_FILES_TARGET:   return filesTarget;
       case PPSTACK_FILES_CONVOLVE: return filesConvolve;
       case PPSTACK_FILES_STACK:    return filesStack;
Index: /branches/czw_branch/20100519/ppStack/src/ppStackLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackLoop.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackLoop.c	(revision 28304)
@@ -91,4 +91,9 @@
     ppStackMemDump("convolve");
 
+    if (options->quality) {
+        // Can't do anything else
+        return true;
+    }
+
     // Ensure sufficient inputs
     {
@@ -97,6 +102,9 @@
         bool safe = psMetadataLookupBool(NULL, recipe, "SAFE"); // Be safe when combining
         if (safe && numGood <= 1) {
-            psError(PPSTACK_ERR_REJECTED, true, "Insufficient inputs for combination with safety on");
-            return false;
+            options->quality = PPSTACK_ERR_REJECTED;
+            psErrorStackPrint(stderr, "Insufficient inputs for combination with safety on");
+            psErrorClear();
+            psWarning("Insufficient inputs for combination with safety on");
+            return true;
         }
     }
@@ -147,6 +155,9 @@
         int numGood = stackSummary(options, "final combination");
         if (numGood <= 0) {
-            psError(PPSTACK_ERR_REJECTED, true, "Insufficient inputs for combination");
-            return false;
+            options->quality = PPSTACK_ERR_REJECTED;
+            psErrorStackPrint(stderr, "Insufficient inputs survived rejection stage");
+            psErrorClear();
+            psWarning("Insufficient inputs survived rejection stage");
+            return true;
         }
     }
Index: /branches/czw_branch/20100519/ppStack/src/ppStackMatch.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackMatch.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackMatch.c	(revision 28304)
@@ -13,7 +13,4 @@
 #define MAG_IGNORE 50                   // Ignore magnitudes fainter than this --- they're not real!
 #define FAKE_SIZE 1                     // Size of fake convolution kernel
-#define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
-                     PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply to input sources
-#define NOISE_FRACTION 0.01             // Set minimum flux to this fraction of noise
 #define COVAR_FRAC 0.01                 // Truncation fraction for covariance matrix
 
@@ -49,77 +46,4 @@
 #endif
 
-// Get coordinates from a source
-static void coordsFromSource(float *x, float *y, const pmSource *source)
-{
-    assert(x && y);
-    assert(source);
-
-    if (source->modelPSF) {
-        *x = source->modelPSF->params->data.F32[PM_PAR_XPOS];
-        *y = source->modelPSF->params->data.F32[PM_PAR_YPOS];
-    } else {
-        *x = source->peak->xf;
-        *y = source->peak->yf;
-    }
-    return;
-}
-
-static psArray *stackSourcesFilter(psArray *sources, // Source list to filter
-                                   int exclusion // Exclusion zone, pixels
-    )
-{
-    psAssert(sources && sources->n > 0, "Require array of sources");
-    if (exclusion <= 0) {
-        return psMemIncrRefCounter(sources);
-    }
-
-    int num = sources->n;               // Number of sources
-    psVector *x = psVectorAlloc(num, PS_TYPE_F32), *y = psVectorAlloc(num, PS_TYPE_F32); // Coordinates
-    int numGood = 0;                    // Number of good sources
-    for (int i = 0; i < num; i++) {
-        pmSource *source = sources->data[i]; // Source of interest
-        if (!source) {
-            continue;
-        }
-        coordsFromSource(&x->data.F32[numGood], &y->data.F32[numGood], source);
-        numGood++;
-    }
-    x->n = y->n = numGood;
-
-    psTree *tree = psTreePlant(2, 2, PS_TREE_EUCLIDEAN, x, y); // kd tree
-
-    psArray *filtered = psArrayAllocEmpty(numGood); // Filtered list of sources
-    psVector *coords = psVectorAlloc(2, PS_TYPE_F64); // Coordinates of source
-    int numFiltered = 0;                // Number of filtered sources
-    for (int i = 0; i < num; i++) {
-        pmSource *source = sources->data[i]; // Source of interest
-        if (!source) {
-            continue;
-        }
-        float xSource, ySource;         // Coordinates of source
-        coordsFromSource(&xSource, &ySource, source);
-
-        coords->data.F64[0] = xSource;
-        coords->data.F64[1] = ySource;
-
-        long numWithin = psTreeWithin(tree, coords, exclusion); // Number within exclusion zone
-        psTrace("ppStack", 9, "Source at %.0lf,%.0lf has %ld sources in exclusion zone",
-                coords->data.F64[0], coords->data.F64[1], numWithin);
-        if (numWithin == 1) {
-            // Only itself inside the exclusion zone
-            filtered = psArrayAdd(filtered, filtered->n, source);
-        } else {
-            numFiltered++;
-        }
-    }
-    psFree(coords);
-    psFree(tree);
-    psFree(x);
-    psFree(y);
-
-    psLogMsg("ppStack", PS_LOG_INFO, "Filtered out %d of %d sources", numFiltered, numGood);
-
-    return filtered;
-}
 
 // Add background into the fake image
@@ -202,5 +126,6 @@
 
 
-bool ppStackMatch(pmReadout *readout, ppStackOptions *options, int index, const pmConfig *config)
+bool ppStackMatch(pmReadout *readout, const psImage *target, ppStackOptions *options,
+                  int index, const pmConfig *config)
 {
     assert(readout);
@@ -286,8 +211,6 @@
         } else {
 #endif
-
             // Normal operations here
-            psAssert(options->psf, "Require target PSF");
-            psAssert(options->sourceLists && options->sourceLists->data[index], "Require source list");
+            psAssert(target, "Require target PSF image");
 
             int order = psMetadataLookupS32(NULL, ppsub, "SPATIAL.ORDER"); // Spatial polynomial order
@@ -341,37 +264,6 @@
             }
 
-            pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
-
-            psStats *bg = psStatsAlloc(PS_STAT_ROBUST_STDEV); // Statistics for background
-            psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
-            if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskVal | maskBad, rng)) {
-                psError(PPSTACK_ERR_DATA, false, "Can't measure background for image.");
-                psFree(fake);
-                psFree(optWidths);
-                psFree(conv);
-                psFree(bg);
-                psFree(rng);
-                return false;
-            }
-            float minFlux = NOISE_FRACTION * bg->robustStdev; // Minimum flux level for fake image
-            psFree(rng);
-            psFree(bg);
-
-            // For the sake of stamps, remove nearby sources
-            psArray *stampSources = stackSourcesFilter(options->sourceLists->data[index],
-                                                       footprint); // Filtered list of sources
-
-            bool oldThreads = pmReadoutFakeThreads(true); // Old threading state
-            if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows,
-                                          stampSources, SOURCE_MASK, NULL, NULL, options->psf,
-                                          minFlux, footprint + size, false, true)) {
-                psError(PPSTACK_ERR_DATA, false, "Unable to generate fake image with target PSF.");
-                psFree(fake);
-                psFree(optWidths);
-                psFree(conv);
-                return false;
-            }
-            pmReadoutFakeThreads(oldThreads);
-
+            pmReadout *fake = pmReadoutAlloc(NULL);
+            fake->image = psImageCopy(NULL, target, PS_TYPE_F32);
             fake->mask = psImageCopy(NULL, readout->mask, PS_TYPE_IMAGE_MASK);
 
@@ -420,5 +312,4 @@
                     psFree(fake);
                     psFree(optWidths);
-                    psFree(stampSources);
                     psFree(conv);
                     if (threads > 0) {
@@ -436,5 +327,4 @@
                     psFree(fake);
                     psFree(optWidths);
-                    psFree(stampSources);
                     psFree(conv);
                     psFree(widthsCopy);
@@ -446,5 +336,5 @@
 
                 if (!pmSubtractionMatch(NULL, conv, fake, readout, footprint, stride, regionSize, spacing,
-                                        threshold, stampSources, stampsName, type, size, order, widthsCopy,
+                                        threshold, options->sources, stampsName, type, size, order, widthsCopy,
                                         orders, inner, ringsOrder, binning, penalty,
                                         optimum, optWidths, optOrder, optThresh, iter, rej, normFrac,
@@ -454,5 +344,4 @@
                     psFree(fake);
                     psFree(optWidths);
-                    psFree(stampSources);
                     psFree(conv);
                     psFree(widthsCopy);
@@ -492,5 +381,4 @@
             psFree(fake);
             psFree(optWidths);
-            psFree(stampSources);
 
             if (threads > 0) {
Index: /branches/czw_branch/20100519/ppStack/src/ppStackReject.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackReject.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackReject.c	(revision 28304)
@@ -166,9 +166,4 @@
     psFree(options->inspect); options->inspect = NULL;
 
-    if (numRejected >= num) {
-        psError(PPSTACK_ERR_REJECTED, true, "All inputs completely rejected; unable to proceed.");
-        return false;
-    }
-
     if (options->stats) {
         psMetadataAddS32(options->stats, PS_LIST_TAIL, "REJECT_IMAGES", 0,
Index: /branches/czw_branch/20100519/ppStack/src/ppStackSources.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackSources.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackSources.c	(revision 28304)
@@ -298,5 +298,5 @@
                         continue;
                     }
-                    source->psfMag -= magCorr;
+                    source->psfMag += magCorr;
                 }
             }
Index: /branches/czw_branch/20100519/ppStack/src/ppStackTarget.c
===================================================================
--- /branches/czw_branch/20100519/ppStack/src/ppStackTarget.c	(revision 28304)
+++ /branches/czw_branch/20100519/ppStack/src/ppStackTarget.c	(revision 28304)
@@ -0,0 +1,213 @@
+#include <stdio.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "ppStack.h"
+
+#define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \
+                     PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply to input sources
+
+// Get coordinates from a source
+static void coordsFromSource(float *x, float *y, float *mag, const pmSource *source)
+{
+    assert(x && y);
+    assert(source);
+
+    if (source->modelPSF) {
+        *x = source->modelPSF->params->data.F32[PM_PAR_XPOS];
+        *y = source->modelPSF->params->data.F32[PM_PAR_YPOS];
+    } else {
+        *x = source->peak->xf;
+        *y = source->peak->yf;
+    }
+    if (mag) {
+        *mag = source->psfMag;
+    }
+    return;
+}
+
+// Filter a list of sources to exclude sources with near neighbours
+static psArray *stackSourcesFilter(psArray *sources, // Source list to filter
+                                   int exclusion, // Exclusion zone, pixels
+                                   float minMagDiff // Minimum magnitude difference
+    )
+{
+    psAssert(sources && sources->n > 0, "Require array of sources");
+    if (exclusion <= 0) {
+        return psMemIncrRefCounter(sources);
+    }
+
+    int num = sources->n;               // Number of sources
+    psVector *x = psVectorAlloc(num, PS_TYPE_F32), *y = psVectorAlloc(num, PS_TYPE_F32); // Coordinates
+    psVector *mag = psVectorAlloc(num, PS_TYPE_F32);                                     // Magnitudes
+    int numGood = 0;                    // Number of good sources
+    for (int i = 0; i < num; i++) {
+        pmSource *source = sources->data[i]; // Source of interest
+        if (!source) {
+            continue;
+        }
+        coordsFromSource(&x->data.F32[numGood], &y->data.F32[numGood], &mag->data.F32[numGood], source);
+        numGood++;
+    }
+    x->n = y->n = mag->n = numGood;
+
+    psTree *tree = psTreePlant(2, 2, PS_TREE_EUCLIDEAN, x, y); // kd tree
+
+    psArray *filtered = psArrayAllocEmpty(numGood); // Filtered list of sources
+    psVector *coords = psVectorAlloc(2, PS_TYPE_F64); // Coordinates of source
+    int numFiltered = 0;                // Number of filtered sources
+    for (int i = 0; i < num; i++) {
+        pmSource *source = sources->data[i]; // Source of interest
+        if (!source) {
+            continue;
+        }
+        float xSource, ySource;         // Coordinates of source
+        coordsFromSource(&xSource, &ySource, NULL, source);
+
+        coords->data.F64[0] = xSource;
+        coords->data.F64[1] = ySource;
+
+        psVector *indices = psTreeAllWithin(tree, coords, exclusion); // Number within exclusion zone
+        psTrace("ppStack", 9, "Source at %.0lf,%.0lf has %ld sources in exclusion zone",
+                coords->data.F64[0], coords->data.F64[1], indices->n);
+        if (indices->n == 1) {
+            // Only itself inside the exclusion zone
+            filtered = psArrayAdd(filtered, filtered->n, source);
+        } else {
+            float inMag = mag->data.F32[i]; // Input magnitude
+            bool filter = false;        // Filter this source?
+            for (int j = 0; j < indices->n; j++) {
+                long index = indices->data.S64[j]; // Index of matching source
+                float compareMag = mag->data.F32[index]; // Magnitude of matching source
+                if (fabsf(inMag - compareMag) < minMagDiff) {
+                    filter = true;
+                    break;
+                }
+            }
+            if (!filter) {
+                filtered = psArrayAdd(filtered, filtered->n, source);
+            } else {
+                numFiltered++;
+            }
+        }
+    }
+    psFree(coords);
+    psFree(tree);
+    psFree(x);
+    psFree(y);
+    psFree(mag);
+
+    psLogMsg("ppStack", PS_LOG_INFO, "Filtered out %d of %d sources", numFiltered, numGood);
+
+    return filtered;
+}
+
+
+psImage *ppStackTarget(ppStackOptions *options, pmConfig *config)
+{
+    psAssert(options, "Require options");
+    psAssert(config, "Require configuration");
+
+    psAssert(options->psf, "Require target PSF");
+    psAssert(options->sourceLists, "Require source lists");
+
+    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
+    psAssert(recipe, "We've thrown an error on this before.");
+    psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe
+    psAssert(recipe, "We've thrown an error on this before.");
+
+    psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of input bits to mask
+    psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Input bits to mask
+    float targetFrac = psMetadataLookupF32(NULL, recipe, "TARGET.FRAC"); // Target min flux fraction of noise
+
+    int num = options->num;             // Number of inputs
+    int numCols = 0, numRows = 0;       // Size of image
+
+    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
+    float minVariance = INFINITY;       // Minimum variance
+    for (int i = 0; i < num; i++) {
+        if (options->inputMask->data.U8[i]) {
+            continue;
+        }
+        psTrace("ppStack", 2, "Characterising image %d....\n", i);
+        pmFPAfileActivate(config->files, false, NULL);
+        ppStackFileActivationSingle(config, PPSTACK_FILES_TARGET, true, i);
+
+        pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT.VARIANCE", i); // File to read
+        pmFPAview *view = ppStackFilesIterateDown(config);
+        if (!view) {
+            psFree(rng);
+            return NULL;
+        }
+        pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); // Input readout
+        psFree(view);
+
+        if (numCols == 0 && numRows == 0) {
+            numCols = readout->variance->numCols;
+            numRows = readout->variance->numRows;
+        } else if (numCols != readout->variance->numCols ||
+                   numRows != readout->variance->numRows) {
+            psError(PPSTACK_ERR_ARGUMENTS, true, "Sizes of input images don't match: %dx%d vs %dx%d",
+                    readout->variance->numCols, readout->variance->numRows, numCols, numRows);
+            psFree(rng);
+            return NULL;
+        }
+
+        psImage *variance = readout->variance, *mask = readout->mask; // Dereference images
+        for (int y = 0; y < numRows; y++) {
+            for (int x = 0; x < numCols; x++) {
+                if (!isfinite(variance->data.F32[y][x])) {
+                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskVal;
+                }
+            }
+        }
+
+        psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background
+        if (!psImageBackground(bg, NULL, variance, mask, maskVal, rng)) {
+            psError(PPSTACK_ERR_DATA, false, "Can't measure background for image.");
+            psFree(rng);
+            return NULL;
+        }
+
+        float norm = powf(10.0, -0.4 * options->norm->data.F32[i]); // Normalisation from stars
+        float meanVariance = bg->robustMedian * PS_SQR(norm);       // Mean variance in normalised image
+
+        if (meanVariance < minVariance) {
+            minVariance = meanVariance;
+        }
+
+        if (!ppStackFilesIterateUp(config)) {
+            psFree(rng);
+            return NULL;
+        }
+
+        ppStackMemDump("target");
+    }
+    psFree(rng);
+
+    float minFlux = targetFrac * sqrtf(minVariance); // Minimum flux for target image
+
+    int footprint = psMetadataLookupS32(NULL, ppsub, "STAMP.FOOTPRINT"); // Stamp half-size
+    int size = psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Kernel half-size
+    float minMagDiff = psMetadataLookupF32(NULL, recipe, "TARGET.MINMAG"); // Minimum magnitude difference
+
+    // For the sake of stamps, remove nearby sources
+    psArray *stampSources = stackSourcesFilter(options->sources, footprint, minMagDiff); // Filtered list
+
+    bool oldThreads = pmReadoutFakeThreads(true); // Old threading state
+    pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
+    if (!pmReadoutFakeFromSources(fake, numCols, numRows, stampSources, SOURCE_MASK, NULL, NULL, options->psf,
+                                  minFlux, footprint + size, false, true)) {
+        psError(PPSTACK_ERR_DATA, false, "Unable to generate fake image with target PSF.");
+        psFree(fake);
+        return NULL;
+    }
+    pmReadoutFakeThreads(oldThreads);
+
+    psFree(stampSources);
+
+    psImage *target = psMemIncrRefCounter(fake->image);
+    psFree(fake);
+
+    return target;
+}
Index: /branches/czw_branch/20100519/ppSub/src/ppSub.h
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSub.h	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSub.h	(revision 28304)
@@ -111,5 +111,6 @@
 
 /// Perform Variance correction (rescale within a modest range)
-bool ppSubVarianceRescale(pmConfig *config   ///< Configuration
+bool ppSubVarianceRescale(pmConfig *config,   ///< Configuration
+                          ppSubData *data     ///< Processing data
     );
 
Index: /branches/czw_branch/20100519/ppSub/src/ppSubDefineOutput.c
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubDefineOutput.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubDefineOutput.c	(revision 28304)
@@ -16,4 +16,5 @@
 
 #include <stdio.h>
+#include <libgen.h>
 #include <pslib.h>
 #include <psmodules.h>
@@ -71,10 +72,19 @@
     pmFPAfile *refFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.REF"); // Reference file
     pmFPAfile *inFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file
+
+    // We should be using the GNU version of basename() which doesn't modify its argument, but just in case,
+    // we'll copy the string.
+    psString refName = psStringCopy(refFile->filename); // Filename of reference
+    const char *refBase = basename(refName);            // Basename of reference
     psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.REFERENCE", 0,
-                     "Subtraction reference", refFile->filename);
+                     "Subtraction reference", refBase);
+    psFree(refName);
+    psString inName = psStringCopy(inFile->filename);   // Filename of input
+    const char *inBase = basename(inName);              // Basename of input
     psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.INPUT", 0,
-                     "Subtraction input", inFile->filename);
+                     "Subtraction input", inBase);
+    psFree(inName);
+
     ppSubVersionHeader(outHDU->header);
-
 
     outRO->analysis = psMetadataCopy(outRO->analysis, analysis);
Index: /branches/czw_branch/20100519/ppSub/src/ppSubErrorCodes.dat
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubErrorCodes.dat	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubErrorCodes.dat	(revision 28304)
@@ -11,2 +11,3 @@
 NO_OVERLAP		No overlap between input and skycell
 PROG			Programming error
+VARIANCE		Variance renormalisation out of bounds
Index: /branches/czw_branch/20100519/ppSub/src/ppSubLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubLoop.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubLoop.c	(revision 28304)
@@ -119,7 +119,12 @@
 
     // Perform Variance correction (rescale within a modest range)
-    if (!ppSubVarianceRescale(config)) {
+    if (!ppSubVarianceRescale(config, data)) {
         psError(psErrorCodeLast(), false, "Unable to rescale variance.");
         return false;
+    }
+
+    if (data->quality) {
+        // Done all we can do up to this point
+        return true;
     }
 
Index: /branches/czw_branch/20100519/ppSub/src/ppSubMaskStats.c
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubMaskStats.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubMaskStats.c	(revision 28304)
@@ -9,15 +9,22 @@
 
 
-bool ppSubMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats) {
+bool ppSubMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats)
+{
   PS_ASSERT_PTR_NON_NULL(view, false);
   PS_ASSERT_PTR_NON_NULL(config, false);
+
+  pmReadout *readout = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");
+  if (!stats || !readout || !readout->data_exists) {
+      // Nothing to process
+      return(true);
+  }
 
   bool status;
 
   psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSUB_RECIPE);
-  psU16 staticMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.STATIC");
-  psU16 magicMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.MAGIC");
-  psU16 dynamicMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.DYNAMIC");
-  psU16 advisoryMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.ADVISORY");
+  psImageMaskType staticMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.STATIC");
+  psImageMaskType magicMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.MAGIC");
+  psImageMaskType dynamicMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.DYNAMIC");
+  psImageMaskType advisoryMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.ADVISORY");
 
   psS32 Npix_valid = 0;
@@ -27,29 +34,22 @@
   psS32 Npix_advisory = 0;
 
-  psWarning("ppSubMaskStats: %d %d %d %d\n",staticMaskVal,magicMaskVal,dynamicMaskVal,advisoryMaskVal);
-  
-  pmReadout *readout = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");
-  if (!readout || !readout->data_exists) {
-    // Nothing to process
-    return(true);
-  }
   psImage *mask = readout->mask;  // Mask of interest;
   if (!pmSingleImageMaskStats(mask,&Npix_valid,&Npix_static,&Npix_magic,
-			      &Npix_dynamic,&Npix_advisory,
-			      staticMaskVal,magicMaskVal,
-			      dynamicMaskVal,advisoryMaskVal)) {
+                              &Npix_dynamic,&Npix_advisory,
+                              staticMaskVal,magicMaskVal,
+                              dynamicMaskVal,advisoryMaskVal)) {
     psError(PS_ERR_UNKNOWN, false, "Unable to calculate masks for readout.");
     return(false);
   }
   psMetadataAddS32(stats, PS_LIST_TAIL,"MASKFRAC_NPIX", 0,
-		   "Number of valid pixels", Npix_valid);
+                   "Number of valid pixels", Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_STATIC", 0,
-		   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
+                   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_DYNAMIC", 0,
-		   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
+                   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", 0,
-		   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
+                   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_ADVISORY", 0,
-		   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
+                   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
   return(true);
 }
Index: /branches/czw_branch/20100519/ppSub/src/ppSubMatchPSFs.c
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubMatchPSFs.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubMatchPSFs.c	(revision 28304)
@@ -243,7 +243,15 @@
         psFree(lists);
         if (!detections->allSources) {
-            psError(PPSUB_ERR_DATA, false, "Unable to merge source lists");
             psFree(detections);
-            return false;
+            psErrorCode error = psErrorCodeLast(); // Error code
+            if (error == PM_ERR_OBJECTS) {
+                psErrorStackPrint(stderr, "Unable to match source lists");
+                psWarning("Unable to match source lists --- suspect bad data quality.");
+                ppSubDataQuality(data, error, PPSUB_FILES_ALL);
+                return true;
+            } else {
+                psError(error, false, "Unable to merge source lists");
+                return false;
+            }
         }
     }
Index: /branches/czw_branch/20100519/ppSub/src/ppSubVarianceRescale.c
===================================================================
--- /branches/czw_branch/20100519/ppSub/src/ppSubVarianceRescale.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppSub/src/ppSubVarianceRescale.c	(revision 28304)
@@ -22,5 +22,5 @@
 #include "ppSub.h"
 
-bool ppSubVarianceRescale(pmConfig *config)
+bool ppSubVarianceRescale(pmConfig *config, ppSubData *data)
 {
     psAssert(config, "Require configuration");
@@ -60,4 +60,13 @@
     }
 
-    return pmReadoutVarianceRenormalise(readout, maskBad, num, minValid, maxValid);
+    if (!pmReadoutVarianceRenormalise(readout, maskBad, num, minValid, maxValid)) {
+        psErrorStackPrint(stderr, "Unable to renormalise variances");
+        psWarning("Unable to renormalise variances --- suspect bad data quality.");
+        // Allow the convolved and subtracted images to be written
+        ppSubDataQuality(data, PPSUB_ERR_VARIANCE,
+                         PPSUB_FILES_INPUT | PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV |
+                         PPSUB_FILES_PSF | PPSUB_FILES_PHOT);
+    }
+
+    return true;
 }
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMops.c
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMops.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMops.c	(revision 28304)
@@ -20,17 +20,15 @@
     }
 
-    ppMopsDetections *merged = ppMopsMerge(detections); // Merged detections
-    psFree(detections);
-    if (!merged) {
+    if (!ppMopsPurgeDuplicates(detections)) {
         psErrorStackPrint(stderr, "Unable to merge detections");
         exit(PS_EXIT_SYS_ERROR);
     }
 
-    if (!ppMopsWrite(merged, args)) {
+    if (!ppMopsWrite(detections, args)) {
         psErrorStackPrint(stderr, "Unable to write detections");
         exit(PS_EXIT_SYS_ERROR);
     }
 
-    psFree(merged);
+    psFree(detections);
     psFree(args);
 
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMops.h
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMops.h	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMops.h	(revision 28304)
@@ -7,7 +7,4 @@
 #define IN_EXTNAME "SkyChip.psf"        // Extension name for data in input
 #define OBSERVATORY_CODE "F51"          // IAU Observatory Code
-#define OUT_EXTNAME "MOPS_TRANSIENT_DETECTIONS" // Extension name for data in output
-#define SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_BADPSF | PM_SOURCE_MODE_SATURATED | \
-                     PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_SKY_FAILURE) // Flags to exclude
 
 // Configuration data
@@ -27,35 +24,10 @@
 } ppMopsArguments;
 
-#if 0
-TTYPE19 = 'PSF_CHISQ'          / label for field  19
-TFORM19 = '1E      '           / data format of field: 4-byte REAL
-TTYPE20 = 'CR_NSIGMA'          / label for field  20
-TFORM20 = '1E      '           / data format of field: 4-byte REAL
-TTYPE21 = 'EXT_NSIGMA'         / label for field  21
-TFORM21 = '1E      '           / data format of field: 4-byte REAL
-TTYPE22 = 'PSF_MAJOR'          / label for field  22
-TFORM22 = '1E      '           / data format of field: 4-byte REAL
-TTYPE23 = 'PSF_MINOR'          / label for field  23
-TFORM23 = '1E      '           / data format of field: 4-byte REAL
-TTYPE24 = 'PSF_THETA'          / label for field  24
-TFORM24 = '1E      '           / data format of field: 4-byte REAL
-TTYPE25 = 'PSF_QF  '           / label for field  25
-TFORM25 = '1E      '           / data format of field: 4-byte REAL
-TTYPE26 = 'PSF_NDOF'           / label for field  26
-TFORM26 = '1J      '           / data format of field: 4-byte INTEGER
-TTYPE27 = 'PSF_NPIX'           / label for field  27
-TFORM27 = '1J      '           / data format of field: 4-byte INTEGER
-TTYPE28 = 'MOMENTS_XX'         / label for field  28
-TFORM28 = '1E      '           / data format of field: 4-byte REAL
-TTYPE29 = 'MOMENTS_XY'         / label for field  29
-TFORM29 = '1E      '           / data format of field: 4-byte REAL
-TTYPE30 = 'MOMENTS_YY'         / label for field  30
-TFORM30 = '1E      '           / data format of field: 4-byte REAL
-#endif
-
 /// Parse arguments
 ppMopsArguments *ppMopsArgumentsParse(int argc, char *argv[]);
 
 typedef struct {
+    psString component;                 // Component name
+    psMetadata *header;                 // FITS header (extension names *.hdr)
     psString raBoresight, decBoresight; // RA,Dec of telescope boresight
     psString filter;                    // Filter for exposure
@@ -64,45 +36,27 @@
     double posangle;                    // Position angle
     double alt, az;                     // Telescope altitude and azimuth
-    double mjd;                         // Modified Julian Date
+    double mjd;                         // Modified Julian Date of exposure mid-point
     float seeing;                       // Seeing of exposure
+    int naxis1, naxis2;                 // Size of image
     long num;                           // Number of detections
+    psMetadata *psfHeader;              // FITS header (extension names *.psf)
+    psMetadata *table;                  // Columns of data
     psVector *x, *y;                    // Image coordinates
     psVector *ra, *dec;                 // Sky coordinates
-    psVector *raErr, *decErr;           // Error in sky coordinates
-    psVector *mag, *magErr;             // Magnitude and associated error
-    psVector *chi2, *dof;               // Chi^2 from fitting, with associated degrees of freedom
-    psVector *cr, *extended;            // Measures of CR-ness and extendedness
-    psVector *psfMajor, *psfMinor, *psfTheta; // PSF major and minor axes, and position angle
-    psVector *quality, *numPix;               // PSF quality factor and number of pixels
-    psVector *xxMoment, *xyMoment, *yyMoment; // Moments
-    psVector *flags;                    // psphot flags
-    psVector *diffSkyfileId;            // Identifier for source image
-    psVector *naxis1, *naxis2;          // Size of image
-    psVector *mask;                     // Mask for detections
-    psVector *nPos;                     // Number of positive pixels
-    psVector *fPos;                     // Fraction of positive flux
-    psVector *nRatioBad;                // Fraction of positive pixels to negative
-    psVector *nRatioMask;               // Fraction of positive pixels to masked
-    psVector *nRatioAll;                // Fraction of positive pixels to all
+    psMetadata *deteffHeader;           // Detection efficiency header (extension names *.deteff)
+    psMetadata *deteffTable;            // Detection efficiency table
 } ppMopsDetections;
 
-
-ppMopsDetections *ppMopsDetectionsAlloc(long num);
-
-/// Copy a detection
-bool ppMopsDetectionsCopySingle(ppMopsDetections *target, const ppMopsDetections *source, long index);
-
-/// Purge the detections list of masked detections
-bool ppMopsDetectionsPurge(ppMopsDetections *detections);
-
+// Allocator
+ppMopsDetections *ppMopsDetectionsAlloc(void);
 
 /// Read detections
 psArray *ppMopsRead(const ppMopsArguments *args);
 
-/// Merge detections
-ppMopsDetections *ppMopsMerge(const psArray *detections);
+/// Purge duplicate detections
+bool ppMopsPurgeDuplicates(const psArray *detections);
 
 /// Write detections
-bool ppMopsWrite(const ppMopsDetections *detections, const ppMopsArguments *args);
+bool ppMopsWrite(const psArray *detections, const ppMopsArguments *args);
 
 #endif
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMopsDetections.c
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMopsDetections.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMopsDetections.c	(revision 28304)
@@ -10,46 +10,26 @@
 static void mopsDetectionsFree(ppMopsDetections *det)
 {
+    psFree(det->component);
     psFree(det->raBoresight);
     psFree(det->decBoresight);
     psFree(det->filter);
+    psFree(det->header);
+    psFree(det->table);
     psFree(det->x);
     psFree(det->y);
     psFree(det->ra);
     psFree(det->dec);
-    psFree(det->raErr);
-    psFree(det->decErr);
-    psFree(det->mag);
-    psFree(det->magErr);
-    psFree(det->chi2);
-    psFree(det->dof);
-    psFree(det->cr);
-    psFree(det->extended);
-    psFree(det->psfMajor);
-    psFree(det->psfMinor);
-    psFree(det->psfTheta);
-    psFree(det->quality);
-    psFree(det->numPix);
-    psFree(det->xxMoment);
-    psFree(det->xyMoment);
-    psFree(det->yyMoment);
-    psFree(det->flags);
-    psFree(det->diffSkyfileId);
-    psFree(det->naxis1);
-    psFree(det->naxis2);
-    psFree(det->mask);
-    psFree(det->nPos);
-    psFree(det->fPos);
-    psFree(det->nRatioBad);
-    psFree(det->nRatioMask);
-    psFree(det->nRatioAll);
+    psFree(det->deteffHeader);
+    psFree(det->deteffTable);
 
     return;
 }
 
-ppMopsDetections *ppMopsDetectionsAlloc(long num)
+ppMopsDetections *ppMopsDetectionsAlloc(void)
 {
     ppMopsDetections *det = psAlloc(sizeof(ppMopsDetections)); // Detections, to return
     psMemSetDeallocator(det, (psFreeFunc)mopsDetectionsFree);
 
+    det->component = NULL;
     det->raBoresight = NULL;
     det->decBoresight = NULL;
@@ -63,234 +43,13 @@
     det->seeing = NAN;
     det->num = 0;
-    det->x = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->y = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->ra = psVectorAllocEmpty(num, PS_TYPE_F64);
-    det->dec = psVectorAllocEmpty(num, PS_TYPE_F64);
-    det->raErr = psVectorAllocEmpty(num, PS_TYPE_F64);
-    det->decErr = psVectorAllocEmpty(num, PS_TYPE_F64);
-    det->mag = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->magErr = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->chi2 = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->dof = psVectorAllocEmpty(num, PS_TYPE_S32);
-    det->cr = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->extended = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->psfMajor = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->psfMinor = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->psfTheta = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->quality = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->numPix = psVectorAllocEmpty(num, PS_TYPE_S32);
-    det->xxMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->xyMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->yyMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->flags = psVectorAllocEmpty(num, PS_TYPE_U32);
-    det->diffSkyfileId = psVectorAllocEmpty(num, PS_TYPE_S64);
-    det->naxis1 = psVectorAllocEmpty(num, PS_TYPE_S32);
-    det->naxis2 = psVectorAllocEmpty(num, PS_TYPE_S32);
-    det->mask = psVectorAllocEmpty(num, PS_TYPE_U8);
-    det->nPos = psVectorAllocEmpty(num, PS_TYPE_S32);
-    det->fPos = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->nRatioBad = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->nRatioMask = psVectorAllocEmpty(num, PS_TYPE_F32);
-    det->nRatioAll = psVectorAllocEmpty(num, PS_TYPE_F32);
+    det->header = NULL;
+    det->table = NULL;
+    det->x = NULL;
+    det->y = NULL;
+    det->ra = NULL;
+    det->dec = NULL;
+    det->deteffHeader = NULL;
+    det->deteffTable = NULL;
 
     return det;
 }
-
-
-ppMopsDetections *ppMopsDetectionsRealloc(ppMopsDetections *det, long num)
-{
-    det->x = psVectorRealloc(det->x, num);
-    det->y = psVectorRealloc(det->y, num);
-    det->ra = psVectorRealloc(det->ra, num);
-    det->dec = psVectorRealloc(det->dec, num);
-    det->raErr = psVectorRealloc(det->raErr, num);
-    det->decErr = psVectorRealloc(det->decErr, num);
-    det->mag = psVectorRealloc(det->mag, num);
-    det->magErr = psVectorRealloc(det->magErr, num);
-    det->chi2 = psVectorRealloc(det->chi2, num);
-    det->dof = psVectorRealloc(det->dof, num);
-    det->cr = psVectorRealloc(det->cr, num);
-    det->extended = psVectorRealloc(det->extended, num);
-    det->psfMajor = psVectorRealloc(det->psfMajor, num);
-    det->psfMinor = psVectorRealloc(det->psfMinor, num);
-    det->psfTheta = psVectorRealloc(det->psfTheta, num);
-    det->quality = psVectorRealloc(det->quality, num);
-    det->numPix = psVectorRealloc(det->numPix, num);
-    det->xxMoment = psVectorRealloc(det->xxMoment, num);
-    det->xyMoment = psVectorRealloc(det->xyMoment, num);
-    det->yyMoment = psVectorRealloc(det->yyMoment, num);
-    det->flags = psVectorRealloc(det->flags, num);
-    det->diffSkyfileId = psVectorRealloc(det->diffSkyfileId, num);
-    det->naxis1 = psVectorRealloc(det->naxis1, num);
-    det->naxis2 = psVectorRealloc(det->naxis2, num);
-    det->mask = psVectorRealloc(det->mask, num);
-    det->nPos = psVectorRealloc(det->nPos, num);
-    det->fPos = psVectorRealloc(det->fPos, num);
-    det->nRatioBad = psVectorRealloc(det->nRatioBad, num);
-    det->nRatioMask = psVectorRealloc(det->nRatioMask, num);
-    det->nRatioAll = psVectorRealloc(det->nRatioAll, num);
-
-    return det;
-}
-
-
-bool ppMopsDetectionsAdd(ppMopsDetections *det, float x, float y, double ra, double dec,
-                         double raErr, double decErr, float mag, float magErr,
-                         float chi2, int dof, float cr, float extended, float psfMajor,
-                         float psfMinor, float psfTheta, float quality, int numPix,
-                         float xxMoment, float xyMoment, float yyMoment,
-                         psU32 flags, psS64 diffSkyfileId, int naxis1, int naxis2,
-                         int nPos, float fPos, float nRatioBad, float nRatioMask, float nRatioAll)
-{
-    psVectorAppend(det->x, x);
-    psVectorAppend(det->y, y);
-    psVectorAppend(det->ra, ra);
-    psVectorAppend(det->dec, dec);
-    psVectorAppend(det->raErr, raErr);
-    psVectorAppend(det->decErr, decErr);
-    psVectorAppend(det->mag, mag);
-    psVectorAppend(det->magErr, magErr);
-    psVectorAppend(det->chi2, chi2);
-    psVectorAppend(det->dof, dof);
-    psVectorAppend(det->cr, cr);
-    psVectorAppend(det->extended, extended);
-    psVectorAppend(det->psfMajor, psfMajor);
-    psVectorAppend(det->psfMinor, psfMinor);
-    psVectorAppend(det->psfTheta, psfTheta);
-    psVectorAppend(det->quality, quality);
-    psVectorAppend(det->numPix, numPix);
-    psVectorAppend(det->xxMoment, xxMoment);
-    psVectorAppend(det->xyMoment, xyMoment);
-    psVectorAppend(det->yyMoment, yyMoment);
-    psVectorAppend(det->flags, flags);
-    psVectorAppend(det->diffSkyfileId, diffSkyfileId);
-    psVectorAppend(det->naxis1, naxis1);
-    psVectorAppend(det->naxis2, naxis2);
-    psVectorAppend(det->mask, 0);
-    psVectorAppend(det->nPos, nPos);
-    psVectorAppend(det->fPos, fPos);
-    psVectorAppend(det->nRatioBad, nRatioBad);
-    psVectorAppend(det->nRatioMask, nRatioMask);
-    psVectorAppend(det->nRatioAll, nRatioAll);
-
-    return true;
-}
-
-
-bool ppMopsDetectionsCopySingle(ppMopsDetections *target, const ppMopsDetections *source, long index)
-{
-    psVectorAppend(target->x, source->x->data.F32[index]);
-    psVectorAppend(target->y, source->y->data.F32[index]);
-    psVectorAppend(target->ra, source->ra->data.F64[index]);
-    psVectorAppend(target->dec, source->dec->data.F64[index]);
-    psVectorAppend(target->raErr, source->raErr->data.F64[index]);
-    psVectorAppend(target->decErr, source->decErr->data.F64[index]);
-    psVectorAppend(target->mag, source->mag->data.F32[index]);
-    psVectorAppend(target->magErr, source->magErr->data.F32[index]);
-    psVectorAppend(target->chi2, source->chi2->data.F32[index]);
-    psVectorAppend(target->dof, source->dof->data.S32[index]);
-    psVectorAppend(target->cr, source->cr->data.F32[index]);
-    psVectorAppend(target->extended, source->extended->data.F32[index]);
-    psVectorAppend(target->psfMajor, source->psfMajor->data.F32[index]);
-    psVectorAppend(target->psfMinor, source->psfMinor->data.F32[index]);
-    psVectorAppend(target->psfTheta, source->psfTheta->data.F32[index]);
-    psVectorAppend(target->quality, source->quality->data.F32[index]);
-    psVectorAppend(target->numPix, source->numPix->data.S32[index]);
-    psVectorAppend(target->xxMoment, source->xxMoment->data.F32[index]);
-    psVectorAppend(target->xyMoment, source->xyMoment->data.F32[index]);
-    psVectorAppend(target->yyMoment, source->yyMoment->data.F32[index]);
-    psVectorAppend(target->flags, source->flags->data.U32[index]);
-    psVectorAppend(target->diffSkyfileId, source->diffSkyfileId->data.S64[index]);
-    psVectorAppend(target->naxis1, source->naxis1->data.S32[index]);
-    psVectorAppend(target->naxis2, source->naxis2->data.S32[index]);
-    psVectorAppend(target->mask, 0);
-    psVectorAppend(target->nPos, source->nPos->data.S32[index]);
-    psVectorAppend(target->fPos, source->fPos->data.F32[index]);
-    psVectorAppend(target->nRatioBad, source->nRatioBad->data.F32[index]);
-    psVectorAppend(target->nRatioMask, source->nRatioMask->data.F32[index]);
-    psVectorAppend(target->nRatioAll, source->nRatioAll->data.F32[index]);
-
-    target->num++;
-
-    return true;
-}
-
-
-bool ppMopsDetectionsPurge(ppMopsDetections *det)
-{
-    long num = 0;
-    for (long i = 0; i < det->num; i++) {
-        if (!det->mask->data.U8[i]) {
-            if (i == num) {
-                // No need to copy
-                num++;
-                continue;
-            }
-            det->x->data.F32[num] = det->x->data.F32[i];
-            det->y->data.F32[num] = det->y->data.F32[i];
-            det->ra->data.F64[num] = det->ra->data.F64[i];
-            det->dec->data.F64[num] = det->dec->data.F64[i];
-            det->raErr->data.F64[num] = det->raErr->data.F64[i];
-            det->decErr->data.F64[num] = det->decErr->data.F64[i];
-            det->mag->data.F32[num] = det->mag->data.F32[i];
-            det->magErr->data.F32[num] = det->magErr->data.F32[i];
-            det->chi2->data.F32[num] = det->chi2->data.F32[i];
-            det->dof->data.S32[num] = det->dof->data.S32[i];
-            det->cr->data.F32[num] = det->cr->data.F32[i];
-            det->extended->data.F32[num] = det->extended->data.F32[i];
-            det->psfMajor->data.F32[num] = det->psfMajor->data.F32[i];
-            det->psfMinor->data.F32[num] = det->psfMinor->data.F32[i];
-            det->psfTheta->data.F32[num] = det->psfTheta->data.F32[i];
-            det->quality->data.F32[num] = det->quality->data.F32[i];
-            det->numPix->data.S32[num] = det->numPix->data.S32[i];
-            det->xxMoment->data.F32[num] = det->xxMoment->data.F32[i];
-            det->xyMoment->data.F32[num] = det->xyMoment->data.F32[i];
-            det->yyMoment->data.F32[num] = det->yyMoment->data.F32[i];
-            det->flags->data.U32[num] = det->flags->data.U32[i];
-            det->diffSkyfileId->data.S64[num] = det->diffSkyfileId->data.S64[i];
-            det->naxis1->data.S32[num] = det->naxis1->data.S32[i];
-            det->naxis2->data.S32[num] = det->naxis2->data.S32[i];
-            det->mask->data.U8[num] = 0;
-            det->nPos->data.S32[num] = det->nPos->data.S32[i];
-            det->fPos->data.F32[num] = det->fPos->data.F32[i];
-            det->nRatioBad->data.F32[num] = det->nRatioBad->data.F32[i];
-            det->nRatioMask->data.F32[num] = det->nRatioMask->data.F32[i];
-            det->nRatioAll->data.F32[num] = det->nRatioAll->data.F32[i];
-            num++;
-        }
-    }
-    det->x->n = num;
-    det->y->n = num;
-    det->ra->n = num;
-    det->dec->n = num;
-    det->raErr->n = num;
-    det->decErr->n = num;
-    det->mag->n = num;
-    det->magErr->n = num;
-    det->chi2->n = num;
-    det->dof->n = num;
-    det->cr->n = num;
-    det->extended->n = num;
-    det->psfMajor->n = num;
-    det->psfMinor->n = num;
-    det->psfTheta->n = num;
-    det->quality->n = num;
-    det->numPix->n = num;
-    det->xxMoment->n = num;
-    det->xyMoment->n = num;
-    det->yyMoment->n = num;
-    det->flags->n = num;
-    det->diffSkyfileId->n = num;
-    det->naxis1->n = num;
-    det->naxis2->n = num;
-    det->mask->n = num;
-    det->num = num;
-    det->nPos->n = num;
-    det->fPos->n = num;
-    det->nRatioBad->n = num;
-    det->nRatioMask->n = num;
-    det->nRatioAll->n = num;
-
-    return true;
-}
-
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMopsMerge.c
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMopsMerge.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMopsMerge.c	(revision 28304)
@@ -9,5 +9,5 @@
 #include "ppMops.h"
 
-#define LEAF_SIZE 4                     // Size of leaf
+#define LEAF_SIZE 2                     // Size of leaf
 #define MATCH_RADIUS SEC_TO_RAD(1.0)    // Matching radius
 #define MJD_TOL 1.0/3600.0/24.0         // Tolerance for MJD matching
@@ -17,4 +17,12 @@
 #define AIRMASS_TOL 1.0e-3              // Tolerance for airmass matching
 
+#if 0
+#undef psTrace
+#define psTrace(facil, level, ...)              \
+    if (level <= 5) {                           \
+        fprintf(stderr, __VA_ARGS__);           \
+    }
+#endif
+
 // Get distance from detection to centre of image
 static float mergeDistance(const ppMopsDetections *detections, // Detections of interest
@@ -22,92 +30,139 @@
     )
 {
-    float dx = detections->x->data.F32[index] - detections->naxis1->data.S32[index] / 2.0;
-    float dy = detections->y->data.F32[index] - detections->naxis2->data.S32[index] / 2.0;
+    float dx = detections->x->data.F32[index] - detections->naxis1 / 2.0;
+    float dy = detections->y->data.F32[index] - detections->naxis2 / 2.0;
     return PS_SQR(dx) + PS_SQR(dy);
 }
 
 
-ppMopsDetections *ppMopsMerge(const psArray *detections)
+bool ppMopsPurgeDuplicates(const psArray *detections)
 {
     PS_ASSERT_ARRAY_NON_NULL(detections, NULL);
 
-    psTrace("ppMops.merge", 1, "Merging detections from %ld inputs\n", detections->n);
-
-    ppMopsDetections *merged = NULL;    // Merged list
-    int num = 1;                                                         // Number of merged files
+    int numInputs = detections->n;                // Number of inputs
+    psTrace("ppMops.merge", 1, "Checking detections from %d inputs\n", numInputs);
+
+    long total = 0;                                // Total number of sources
+    psArray *duplicates = psArrayAlloc(numInputs); // Vector of duplicate bits for each input
+    psVector *dupNum = psVectorAlloc(numInputs, PS_TYPE_U32); // Number of duplicates for each input
+    psVectorInit(dupNum, 0);
+    for (int i = 0; i < numInputs; i++) {
+        ppMopsDetections *det = detections->data[i]; // Detections from
+        if (!det || det->num == 0) {
+            continue;
+        }
+        psVector *dupes = duplicates->data[i] = psVectorAlloc(det->num, PS_TYPE_U8);
+        psVectorInit(dupes, 0);
+        total += det->num;
+    }
+    psTrace("ppMops.merge", 2, "Total detections: %ld\n", total);
+
+    psVector *raMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged RAs
+    psVector *decMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged Decs
+    psVector *sourceMerged = psVectorAlloc(total, PS_TYPE_U16); // Source image of merged sources
+    psVector *indexMerged = psVectorAlloc(total, PS_TYPE_U32); // Index of merged sources
+    long num = 0;                                                   // Number of merged sources
+
+    const char *raBoresight = NULL, *decBoresight = NULL; // Boresight coordinates
+    const char *filter = NULL;                    // Filter name
+    float airmass = NAN, exptime = NAN;           // Exposure details
+    double posangle = NAN, alt = NAN, az = NAN; // Telescope pointing
+    double mjd = NAN;                           // Time of exposure
+
+    for (int i = 0; i < numInputs; i++) {
+        ppMopsDetections *det = detections->data[i]; // Detections of interest
+        if (!det) {
+            psTrace("ppMops.merge", 3, "Ignoring NULL input %d\n", i);
+            continue;
+        } else if (det->num == 0) {
+            psTrace("ppMops.merge", 3, "Ignoring empty input %d\n", i);
+            continue;
+        }
+
+        // Check exposure characteristics
+        if (num == 0) {
+            raBoresight = det->raBoresight;
+            decBoresight = det->decBoresight;
+            filter = det->filter;
+            airmass = det->airmass;
+            exptime = det->exptime;
+            posangle = det->posangle;
+            alt = det->alt;
+            az = det->az;
+        } else {
+            if (strcmp(raBoresight, det->raBoresight) != 0) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure RA values differ: %s vs %s",
+                        raBoresight, det->raBoresight);
+                return false;
+            }
+            if (strcmp(decBoresight, det->decBoresight) != 0) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure Dec values differ: %s vs %s",
+                        decBoresight, det->decBoresight);
+                return false;
+            }
+            if (strcmp(filter, det->filter) != 0) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure filter values differ: %s vs %s",
+                        filter, det->filter);
+                return false;
+            }
+            if (fabsf(airmass - det->airmass) > AIRMASS_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure airmass values differ: %f vs %f",
+                        airmass, det->airmass);
+                return false;
+            }
+            if (fabsf(exptime - det->exptime) > EXPTIME_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure exposure time values differ: %f vs %f",
+                        exptime, det->exptime);
+                return false;
+            }
+            if (fabs(posangle - det->posangle) > POSANGLE_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure position angle values differ: %f vs %f",
+                        posangle, det->posangle);
+                return false;
+            }
+            if (fabs(alt - det->alt) > BORESIGHT_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure altitude values differ: %lf vs %lf",
+                        alt, det->alt);
+                return false;
+            }
+            if (fabs(az - det->az) > BORESIGHT_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure azimuth values differ: %lf vs %lf",
+                        az, det->az);
+                return false;
+            }
+            if (fabs(mjd - det->mjd) > MJD_TOL) {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure MJD values differ: %lf vs %lf",
+                        mjd, det->mjd);
+                return false;
+            }
+        }
+
+        psTrace("ppMops.merge", 3, "Accepting %ld detections from input %d\n", det->num, i);
+        memcpy(&raMerged->data.F64[num], det->ra->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
+        memcpy(&decMerged->data.F64[num], det->dec->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
+        for (long j = 0, k = num; j < det->num; j++, k++) {
+            sourceMerged->data.U16[k] = i;
+            indexMerged->data.U32[k] = j;
+        }
+        num += det->num;
+    }
+
+    psTrace("ppMops.merge", 3, "Generating kd-tree from %ld sources\n", num);
+    psTree *tree = psTreePlant(2, LEAF_SIZE, PS_TREE_SPHERICAL, raMerged, decMerged); // kd tree
+    if (!tree) {
+        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate kd tree");
+        return false;
+    }
+
     for (int i = 0; i < detections->n; i++) {
         ppMopsDetections *det = detections->data[i]; // Detections of interest
         if (!det) {
-            psTrace("ppMops.merge", 3, "Ignoring NULL input %d\n", i);
             continue;
         } else if (det->num == 0) {
-            psTrace("ppMops.merge", 3, "Ignoring empty input %d\n", i);
-            continue;
-        }
-        num++;
-        if (!merged) {
-            psTrace("ppMops.merge", 3, "Accepting %ld detections from input %d\n", det->num, i);
-            merged = psMemIncrRefCounter(det);
-            continue;
-        }
-        psTrace("ppMops.merge", 3, "Merging %ld detections from input %d\n", det->num, i);
-
-        // XXX compare exposure properties
-        if (strcmp(merged->raBoresight, det->raBoresight) != 0) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure RA values differ: %s vs %s",
-                    merged->raBoresight, det->raBoresight);
-            return NULL;
-        }
-        if (strcmp(merged->decBoresight, det->decBoresight) != 0) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure Dec values differ: %s vs %s",
-                    merged->decBoresight, det->decBoresight);
-            return NULL;
-        }
-        if (strcmp(merged->filter, det->filter) != 0) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure filter values differ: %s vs %s",
-                    merged->filter, det->filter);
-            return NULL;
-        }
-
-        if (fabsf(merged->airmass - det->airmass) > AIRMASS_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure airmass values differ: %f vs %f",
-                    merged->airmass, det->airmass);
-            return NULL;
-        }
-        if (fabsf(merged->exptime - det->exptime) > EXPTIME_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure exposure time values differ: %f vs %f",
-                    merged->exptime, det->exptime);
-            return NULL;
-        }
-        if (fabs(merged->posangle - det->posangle) > POSANGLE_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure position angle values differ: %f vs %f",
-                    merged->posangle, det->posangle);
-            return NULL;
-        }
-        if (fabs(merged->alt - det->alt) > BORESIGHT_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure altitude values differ: %lf vs %lf",
-                    merged->alt, det->alt);
-            return NULL;
-        }
-        if (fabs(merged->az - det->az) > BORESIGHT_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure azimuth values differ: %lf vs %lf",
-                    merged->az, det->az);
-            return NULL;
-        }
-        if (fabs(merged->mjd - det->mjd) > MJD_TOL) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Exposure MJD values differ: %lf vs %lf",
-                    merged->mjd, det->mjd);
-            return NULL;
-        }
-
-        merged->seeing += det->seeing;  // Taking average
-
-        psTree *tree = psTreePlant(2, LEAF_SIZE, PS_TREE_SPHERICAL, merged->ra, merged->dec); // kd tree
-        if (!tree) {
-            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate kd tree");
-            psFree(merged);
-            return NULL;
-        }
-
+            continue;
+        }
+        psTrace("ppMops.merge", 3, "Checking %ld detections from input %d\n", det->num, i);
+
+        psVector *dupes = duplicates->data[i];            // Duplicates list
         psVector *coords = psVectorAlloc(2, PS_TYPE_F64); // Coordinates of interest
         for (int j = 0; j < det->num; j++) {
@@ -119,14 +174,14 @@
                 psFree(coords);
                 psFree(tree);
-                psFree(merged);
-                return NULL;
-            }
-            if (indices->n == 0) {
-                psTrace("ppMops.merge", 9, "No matches for source %d in input %d\n", j, i);
+                return false;
+            }
+            psTrace("ppMops.merge", 5, "%ld matches for source %d from input %d\n", indices->n, j, i);
+            psAssert(indices->n > 0, "Expect at least one match for source %d in input %d", j, i);
+
+            if (indices->n == 1 && sourceMerged->data.U16[indices->data.S64[0]] == i) {
+                // It's myself
                 psFree(indices);
-                ppMopsDetectionsCopySingle(merged, det, j);
                 continue;
             }
-            psTrace("ppMops.merge", 5, "%ld matches for source %d from input %d\n", indices->n, j, i);
 
             // Which one do we keep?
@@ -134,6 +189,16 @@
             long bestIndex = -1;           // Index with best distance
             for (int k = 0; k < indices->n; k++) {
-                long index = indices->data.S64[k]; // Index of point
-                float distance = mergeDistance(merged, index); // Distance to centre of image
+                long mergeIndex = indices->data.S64[k]; // Index of point in merged list
+                int source = sourceMerged->data.U16[mergeIndex]; // Source image
+                if (source == i) {
+                    continue;
+                }
+                long index = indexMerged->data.U32[mergeIndex];  // Index in source
+                psVector *dupes = duplicates->data[source];     // Duplicates list
+                if (dupes->data.U8[index]) {
+                    continue;
+                }
+
+                float distance = mergeDistance(detections->data[source], index); // Distance to centre of image
                 if (distance < bestDistance) {
                     bestDistance = distance;
@@ -142,30 +207,84 @@
             }
 
-            float distance = mergeDistance(det, j); // Distance to centre of image
-            if (distance < bestDistance) {
-                psTrace("ppMops.merge", 6, "New source clobbers old sources\n");
-                // Blow away existing sources
-                for (int k = 0; k < indices->n; k++) {
-                    long index = indices->data.S64[k]; // Index of point
-                    merged->mask->data.U8[index] = 0xFF;
-                }
-                ppMopsDetectionsCopySingle(merged, det, j);
-            } else {
-                psTrace("ppMops.merge", 6, "Old sources clobber new source\n");
+            if (bestIndex >= 0) {
+                float distance = mergeDistance(det, j); // Distance to centre of image
+                if (bestIndex >= 0 && distance < bestDistance) {
+                    psTrace("ppMops.merge", 6, "New source clobbers old sources\n");
+                    for (int k = 0; k < indices->n; k++) {
+                        long mergeIndex = indices->data.S64[k]; // Index of point
+                        int source = sourceMerged->data.U16[mergeIndex]; // Source image
+                        if (source == i) {
+                            continue;
+                        }
+                        long index = indexMerged->data.U32[mergeIndex];  // Index in source
+                        psVector *dupes = duplicates->data[source];      // Duplicates list
+                        if (!dupes->data.U8[index]) {
+                            dupes->data.U8[index] = 0xFF;
+                            dupNum->data.U32[source]++;
+                        }
+                    }
+                } else {
+                    psTrace("ppMops.merge", 6, "Old sources clobber new source\n");
+                    dupes->data.U8[j] = 0xFF;
+                    dupNum->data.U32[i]++;
+                }
             }
             psFree(indices);
         }
-
-        psTrace("ppMops.merge", 3, "Done merging input %d, %ld merged sources\n", i, merged->num);
-
-        psFree(tree);
-        ppMopsDetectionsPurge(merged);
-    }
-
-    psTrace("ppMops.merge", 2, "%ld sources in merged detections list\n", merged->num);
-
-    merged->seeing /= num;
-
-    return merged;
+        psFree(coords);
+    }
+    psFree(tree);
+    psFree(raMerged);
+    psFree(decMerged);
+    psFree(sourceMerged);
+    psFree(indexMerged);
+
+    // Remove duplicates
+    for (int i = 0; i < detections->n; i++) {
+        ppMopsDetections *det = detections->data[i]; // Detections of interest
+        if (!det) {
+            continue;
+        } else if (det->num == 0) {
+            continue;
+        }
+        psTrace("ppMops.merge", 3, "Purging %d duplicates from input %d\n", dupNum->data.U32[i], i);
+
+#define VECTOR_PURGE_CASE(TYPE)                                      \
+        case PS_TYPE_##TYPE:                                         \
+          for (int i = 0, j = 0; i < vector->n; i++) {               \
+              if (!dupes->data.U8[i]) {                              \
+                  if (i == j) {                                      \
+                      j++;                                           \
+                      continue;                                      \
+                  }                                                  \
+                  vector->data.TYPE[j] = vector->data.TYPE[i];       \
+              }                                                      \
+          }                                                          \
+          break;
+
+        psVector *dupes = duplicates->data[i]; // Duplicates
+        psArray *table = psListToArray(det->table->list); // Table of data
+        for (int j = 0; j < table->n; j++) {
+            psMetadataItem *item = table->data[j]; // Table item
+            psAssert(item->type == PS_DATA_VECTOR, "Table column is not a vector: %x", item->type);
+            psVector *vector = item->data.V; // Vector to purge
+            switch (vector->type.type) {
+                VECTOR_PURGE_CASE(U8);
+                VECTOR_PURGE_CASE(U16);
+                VECTOR_PURGE_CASE(U32);
+                VECTOR_PURGE_CASE(U64);
+                VECTOR_PURGE_CASE(S8);
+                VECTOR_PURGE_CASE(S16);
+                VECTOR_PURGE_CASE(S32);
+                VECTOR_PURGE_CASE(S64);
+                VECTOR_PURGE_CASE(F32);
+                VECTOR_PURGE_CASE(F64);
+              default:
+                psAbort("Unrecognised vector type: %x", vector->type.type);
+            }
+        }
+    }
+
+    return true;
 }
 
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMopsRead.c
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMopsRead.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMopsRead.c	(revision 28304)
@@ -4,4 +4,5 @@
 
 #include <stdio.h>
+#include <string.h>
 #include <pslib.h>
 
@@ -16,5 +17,6 @@
     psArray *detections = psArrayAlloc(num); // Array of detections, to return
     for (int i = 0; i < num; i++) {
-        psFits *fits = psFitsOpen(inNames->data[i], "r"); // FITS file
+        const char *name = inNames->data[i]; // File name
+        psFits *fits = psFitsOpen(name, "r"); // FITS file
         if (!fits) {
             psError(PS_ERR_IO, false, "Unable to open input %d", i);
@@ -24,10 +26,4 @@
         if (!header) {
             psError(PS_ERR_IO, false, "Unable to read header %d", i);
-            return false;
-        }
-
-        psS64 diffSkyfileId = psMetadataLookupS64(NULL, header, "IMAGEID"); // Identifier for image
-        if (diffSkyfileId == 0) {
-            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find identifier for image %d", i);
             return false;
         }
@@ -47,7 +43,8 @@
             continue;
         }
-        ppMopsDetections *det = ppMopsDetectionsAlloc(size);
-
-        psTrace("ppMops.read", 3, "Reading %ld rows from %s\n", size, (const char*)inNames->data[i]);
+        ppMopsDetections *det = detections->data[i] = ppMopsDetectionsAlloc();
+        det->component = psStringNCopy(name, strrchr(name, '.') - name); // Strip off extension
+        det->header = header;
+        det->num = size;
 
         det->raBoresight = psMemIncrRefCounter(psMetadataLookupStr(NULL, header, "FPA.RA"));
@@ -64,132 +61,55 @@
                              psMetadataLookupF32(NULL, header, "FWHM_MIN"));
 
-        int naxis1 = psMetadataLookupS32(NULL, header, "IMNAXIS1"); // Number of columns
-        int naxis2 = psMetadataLookupS32(NULL, header, "IMNAXIS2"); // Number of rows
+        det->naxis1 = psMetadataLookupS32(NULL, header, "IMNAXIS1");
+        det->naxis2 = psMetadataLookupS32(NULL, header, "IMNAXIS2");
 
-        psFree(header);
-
-        psArray *table = psFitsReadTable(fits); // Table of interest
-        if (!table) {
-            psError(PS_ERR_IO, false, "Unable to read table %d", i);
+        det->psfHeader = psFitsReadHeader(NULL, fits);
+        if (!det->psfHeader) {
+            psError(psErrorCodeLast(), false, "Unable to read header %d", i);
             return false;
         }
-        psFitsClose(fits);
-
-        double plateScale = 0.0;        // Plate scale
-        long numGood = 0;               // Number of good rows
-        for (long j = 0; j < size; j++) {
-            psMetadata *row = table->data[j]; // Row of interest
-
-            psU32 flags = psMetadataLookupU32(NULL, row, "FLAGS");
-            if (flags & SOURCE_MASK) {
-                psTrace("ppMops.read", 10, "Discarding row %ld from input %d because of flags: %ud", j, i, flags);
-                continue;
-            }
-
-            det->x->data.F32[numGood] = psMetadataLookupF32(NULL, row, "X_PSF");
-            det->y->data.F32[numGood] = psMetadataLookupF32(NULL, row, "Y_PSF");
-            det->ra->data.F64[numGood] = DEG_TO_RAD(psMetadataLookupF64(NULL, row, "RA_PSF"));
-            det->dec->data.F64[numGood] = DEG_TO_RAD(psMetadataLookupF64(NULL, row, "DEC_PSF"));
-            det->mag->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_INST_MAG");
-            det->magErr->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_INST_MAG_SIG");
-            det->chi2->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_CHISQ");
-            det->dof->data.S32[numGood] = psMetadataLookupS32(NULL, row, "PSF_NDOF");
-            det->cr->data.F32[numGood] = psMetadataLookupF32(NULL, row, "CR_NSIGMA");
-            det->extended->data.F32[numGood] = psMetadataLookupF32(NULL, row, "EXT_NSIGMA");
-            det->psfMajor->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_MAJOR");
-            det->psfMinor->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_MINOR");
-            det->psfTheta->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_THETA");
-            det->quality->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_QF");
-            det->numPix->data.S32[numGood] = psMetadataLookupS32(NULL, row, "PSF_NPIX");
-            det->xxMoment->data.F32[numGood] = psMetadataLookupF32(NULL, row, "MOMENTS_XX");
-            det->xyMoment->data.F32[numGood] = psMetadataLookupF32(NULL, row, "MOMENTS_XY");
-            det->yyMoment->data.F32[numGood] = psMetadataLookupF32(NULL, row, "MOMENTS_YY");
-            det->flags->data.U32[numGood] = psMetadataLookupU32(NULL, row, "FLAGS");
-            det->diffSkyfileId->data.S64[numGood] = diffSkyfileId;
-            det->naxis1->data.S32[numGood] = naxis1;
-            det->naxis2->data.S32[numGood] = naxis2;
-
-            det->nPos->data.S32[numGood] = psMetadataLookupS32(NULL, row, "DIFF_NPOS");
-            det->fPos->data.F32[numGood] = psMetadataLookupF32(NULL, row, "DIFF_FRATIO");
-            det->nRatioBad->data.F32[numGood] = psMetadataLookupF32(NULL, row, "DIFF_NRATIO_BAD");
-            det->nRatioMask->data.F32[numGood] = psMetadataLookupF32(NULL, row, "DIFF_NRATIO_MASK");
-            det->nRatioAll->data.F32[numGood] = psMetadataLookupF32(NULL, row, "DIFF_NRATIO_ALL");
-
-            // Calculate error in RA, Dec
-            double xErr = psMetadataLookupF64(NULL, row, "X_PSF_SIG");
-            double yErr = psMetadataLookupF64(NULL, row, "Y_PSF_SIG");
-            double scale = psMetadataLookupF64(NULL, row, "PLTSCALE");
-            double angle = psMetadataLookupF64(NULL, row, "POSANGLE");
-
-            if (!isfinite(det->x->data.F32[numGood]) || !isfinite(det->y->data.F32[numGood]) ||
-                !isfinite(det->ra->data.F64[numGood]) || !isfinite(det->dec->data.F64[numGood]) ||
-                !isfinite(det->mag->data.F32[numGood]) || !isfinite(det->magErr->data.F32[numGood]) ||
-                !isfinite(xErr) || !isfinite(yErr) || !isfinite(scale) || !isfinite(angle)) {
-                psTrace("ppMops.read", 10,
-                        "Discarding row %ld from input %d because of non-finite values: "
-                        "%f %f %lf %lf %f %f %f %f %f %f",
-                        j, i,
-                        det->x->data.F32[numGood], det->y->data.F32[numGood],
-                        det->ra->data.F64[numGood], det->dec->data.F64[numGood],
-                        det->mag->data.F32[numGood], det->magErr->data.F32[numGood],
-                        xErr, yErr, scale, angle);
-                continue;
-            }
-
-            // XXX Not at all sure I've got the angles around the right way here...
-            double cosAngle = cos(angle), sinAngle = sin(angle);
-            double cosAngle2 = PS_SQR(cosAngle), sinAngle2 = PS_SQR(sinAngle);
-            double xErr2 = PS_SQR(xErr), yErr2 = PS_SQR(yErr);
-            double errScale = scale / 3600.0;
-            det->raErr->data.F64[numGood] = errScale * sqrt(cosAngle2 * xErr2 + sinAngle2 * yErr2);
-            det->decErr->data.F64[numGood] = errScale * sqrt(sinAngle2 * xErr2 + cosAngle2 * yErr2);
-
-            det->mask->data.U8[numGood] = 0;
-            plateScale += scale;
-            numGood++;
-        }
-        det->seeing *= plateScale / numGood;
-
-        det->x->n = numGood;
-        det->y->n = numGood;
-        det->ra->n = numGood;
-        det->dec->n = numGood;
-        det->raErr->n = numGood;
-        det->decErr->n = numGood;
-        det->mag->n = numGood;
-        det->magErr->n = numGood;
-        det->chi2->n = numGood;
-        det->dof->n = numGood;
-        det->cr->n = numGood;
-        det->extended->n = numGood;
-        det->psfMajor->n = numGood;
-        det->psfMinor->n = numGood;
-        det->psfTheta->n = numGood;
-        det->quality->n = numGood;
-        det->numPix->n = numGood;
-        det->xxMoment->n = numGood;
-        det->xyMoment->n = numGood;
-        det->yyMoment->n = numGood;
-        det->flags->n = numGood;
-        det->diffSkyfileId->n = numGood;
-        det->naxis1->n = numGood;
-        det->naxis2->n = numGood;
-        det->mask->n = numGood;
-        det->nPos->n = numGood;
-        det->fPos->n = numGood;
-        det->nRatioBad->n = numGood;
-        det->nRatioMask->n = numGood;
-        det->nRatioAll->n = numGood;
-
-        det->num = numGood;
-
-        if (isfinite(args->zp) && numGood > 0) {
-            psBinaryOp(det->mag, det->mag, "+", psScalarAlloc(args->zp, PS_TYPE_F32));
+        psMetadata *table = det->table = psFitsReadTableAllColumns(fits); // Table of interest
+        if (!table) {
+            psError(psErrorCodeLast(), false, "Unable to read table %d", i);
+            return false;
         }
 
-        psTrace("ppMops.read", 2, "Read %ld good rows from %s\n", numGood, (const char*)inNames->data[i]);
+        psVector *ra = psMetadataLookupVector(NULL, table, "RA_PSF");
+        psVector *dec = psMetadataLookupVector(NULL, table, "DEC_PSF");
 
-        psFree(table);
-        detections->data[i] = det;
+        det->ra = (psVector*)psBinaryOp(NULL, ra, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
+        det->dec = (psVector*)psBinaryOp(NULL, dec, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
+        det->x = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "X_PSF"));
+        det->y = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "Y_PSF"));
+        if (!det->ra || !det->dec || !det->x || !det->y) {
+            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find all of RA, Dec, X and Y columns");
+            return false;
+        }
+
+        psTrace("ppMops.read", 2, "Read %ld rows from %s\n", det->num, det->component);
+
+        if (!psFitsMoveExtName(fits, "SkyChip.deteff")) {
+            psWarning("No detection efficiencies included in %s", det->component);
+            psErrorStackPrint(stderr, "No detection efficiencies included in %s", det->component);
+            psErrorClear();
+            continue;
+        }
+
+        det->deteffHeader = psFitsReadHeader(NULL, fits);
+        if (!det->deteffHeader) {
+            psWarning("Unable to read detection efficiency header in %s", det->component);
+            psErrorClear();
+            continue;
+        }
+        det->deteffTable = psFitsReadTableAllColumns(fits);
+        if (!det->deteffTable) {
+            psFree(det->deteffHeader);
+            det->deteffHeader = NULL;
+            psWarning("Unable to read detection efficiency table in %s", det->component);
+            psErrorClear();
+            continue;
+        }
+        psTrace("ppMops.read", 2, "Read detection efficiency from %s\n", det->component);
+        psFitsClose(fits);
     }
 
Index: /branches/czw_branch/20100519/ppTranslate/src/ppMopsWrite.c
===================================================================
--- /branches/czw_branch/20100519/ppTranslate/src/ppMopsWrite.c	(revision 28303)
+++ /branches/czw_branch/20100519/ppTranslate/src/ppMopsWrite.c	(revision 28304)
@@ -9,7 +9,7 @@
 #include "ppTranslateVersion.h"
 
-bool ppMopsWrite(const ppMopsDetections *det, const ppMopsArguments *args)
+bool ppMopsWrite(const psArray *detections, const ppMopsArguments *args)
 {
-    psTrace("ppMops.write", 1, "Writing %ld rows to %s", det->num, args->output);
+    psTrace("ppMops.write", 1, "Writing %ld extensions to %s", detections->n, args->output);
 
     psFits *fits = psFitsOpen(args->output, "w"); // FITS file
@@ -19,134 +19,67 @@
     }
 
+    // Primary header
+    {
+        psMetadata *header = psMetadataAlloc(); // Header to write
+        ppTranslateVersionHeader(header);
+        psMetadataAddStr(header, PS_LIST_TAIL, "EXP_NAME", 0, "Exposure name", args->exp_name);
+        psMetadataAddS64(header, PS_LIST_TAIL, "EXP_ID", 0, "Exposure identifier", args->exp_id);
+        psMetadataAddS64(header, PS_LIST_TAIL, "CHIP_ID", 0, "Chip stage identifier", args->chip_id);
+        psMetadataAddS64(header, PS_LIST_TAIL, "CAM_ID", 0, "Cam stage identifier", args->cam_id);
+        psMetadataAddS64(header, PS_LIST_TAIL, "FAKE_ID", 0, "Fake stage identifier", args->fake_id);
+        psMetadataAddS64(header, PS_LIST_TAIL, "WARP_ID", 0, "Warp stage identifier", args->warp_id);
+        psMetadataAddS64(header, PS_LIST_TAIL, "DIFF_ID", 0, "Diff stage identifier", args->diff_id);
+        psMetadataAddBool(header, PS_LIST_TAIL, "DIFF_POS", 0, "Positive subtraction?", args->positive);
+        psMetadataAddF32(header, PS_LIST_TAIL, "MAGZP", 0, "Magnitude zero point", args->zp);
+        psMetadataAddF32(header, PS_LIST_TAIL, "MAGZPERR", 0, "Error in magnitude zero point", args->zpErr);
+        psMetadataAddF32(header, PS_LIST_TAIL, "ASTRORMS", 0, "RMS of astrometric fit", args->rmsAstrom);
+        psMetadataAddStr(header, PS_LIST_TAIL, "OBSCODE", 0, "IAU Observatory code", OBSERVATORY_CODE);
 
-    psMetadata *header = psMetadataAlloc(); // Header to write
-    psString source = ppTranslateSource(), version = ppTranslateVersion();
-    psMetadataAddStr(header, PS_LIST_TAIL, "SWSOURCE", 0, "Software source", source);
-    psMetadataAddStr(header, PS_LIST_TAIL, "SWVERSN", 0, "Software version", version);
-    ppTranslateVersionHeader(header);
-    psFree(source);
-    psFree(version);
+        ppMopsDetections *det = detections->data[0]; // Representative set of detections
+        psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight);
+        psMetadataAddStr(header, PS_LIST_TAIL, "DEC", 0, "Declination of boresight", det->decBoresight);
+        psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter);
+        psMetadataAddF32(header, PS_LIST_TAIL, "AIRMASS", 0, "Airmass at boresight", det->airmass);
+        psMetadataAddF32(header, PS_LIST_TAIL, "EXPTIME", 0, "Exposure time (sec)", det->exptime);
+        psMetadataAddF64(header, PS_LIST_TAIL, "POSANG", 0, "Position angle", det->posangle);
+        psMetadataAddF64(header, PS_LIST_TAIL, "ALT", 0, "Altitude of boresight", det->alt);
+        psMetadataAddF64(header, PS_LIST_TAIL, "AZ", 0, "Azimuth of boresight", det->az);
+        psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of observation", det->mjd);
 
-    psMetadataAddStr(header, PS_LIST_TAIL, "EXP_NAME", 0, "Exposure name", args->exp_name);
-    psMetadataAddS64(header, PS_LIST_TAIL, "EXP_ID", 0, "Exposure identifier", args->exp_id);
-    psMetadataAddS64(header, PS_LIST_TAIL, "CHIP_ID", 0, "Chip stage identifier", args->chip_id);
-    psMetadataAddS64(header, PS_LIST_TAIL, "CAM_ID", 0, "Cam stage identifier", args->cam_id);
-    psMetadataAddS64(header, PS_LIST_TAIL, "FAKE_ID", 0, "Fake stage identifier", args->fake_id);
-    psMetadataAddS64(header, PS_LIST_TAIL, "WARP_ID", 0, "Warp stage identifier", args->warp_id);
-    psMetadataAddS64(header, PS_LIST_TAIL, "DIFF_ID", 0, "Diff stage identifier", args->diff_id);
-    psMetadataAddBool(header, PS_LIST_TAIL, "DIFF_POS", 0, "Positive subtraction?", args->positive);
-
-    psMetadataAddF64(header, PS_LIST_TAIL, "MJD-OBS", 0, "MJD of exposure midpoint", det->mjd);
-    psMetadataAddStr(header, PS_LIST_TAIL, "RA", 0, "Right Ascension of boresight", det->raBoresight);
-    psMetadataAddStr(header, PS_LIST_TAIL, "DEC", 0, "Declination of boresight", det->decBoresight);
-    psMetadataAddF64(header, PS_LIST_TAIL, "TEL_ALT", 0, "Telescope altitude", det->alt);
-    psMetadataAddF64(header, PS_LIST_TAIL, "TEL_AZ", 0, "Telescope azimuth", det->az);
-    psMetadataAddF64(header, PS_LIST_TAIL, "EXPTIME", 0, "Exposure time (sec)", det->exptime);
-    psMetadataAddF64(header, PS_LIST_TAIL, "ROTANGLE", 0, "Rotator position angle", det->posangle);
-    psMetadataAddStr(header, PS_LIST_TAIL, "FILTER", 0, "Filter name", det->filter);
-    psMetadataAddF32(header, PS_LIST_TAIL, "AIRMASS", 0, "Airmass of exposure", det->airmass);
-    psMetadataAddStr(header, PS_LIST_TAIL, "OBSCODE", 0, "IAU Observatory code", OBSERVATORY_CODE);
-    psMetadataAddF32(header, PS_LIST_TAIL, "SEEING", 0, "Mean seeing", det->seeing);
-    psMetadataAddF32(header, PS_LIST_TAIL, "MAGZP", 0, "Magnitude zero point", args->zp);
-    psMetadataAddF32(header, PS_LIST_TAIL, "MAGZPERR", 0, "Error in magnitude zero point", args->zpErr);
-    psMetadataAddF32(header, PS_LIST_TAIL, "ASTRORMS", 0, "RMS of astrometric fit", args->rmsAstrom);
-
-    if (det->num == 0) {
-        // Write dummy table
-        psMetadata *row = psMetadataAlloc(); // Output row
-        psMetadataAddF64(row, PS_LIST_TAIL, "RA", 0, "Right ascension (degrees)", NAN);
-        psMetadataAddF64(row, PS_LIST_TAIL, "RA_ERR", 0, "Right ascension error (degrees)", NAN);
-        psMetadataAddF64(row, PS_LIST_TAIL, "DEC", 0, "Declination (degrees)", NAN);
-        psMetadataAddF64(row, PS_LIST_TAIL, "DEC_ERR", 0, "Declination error (degrees)", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "MAG", 0, "Magnitude", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "MAG_ERR", 0, "Magnitude error", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "PSF_CHI2", 0, "chi^2 of PSF fit", NAN);
-        psMetadataAddS32(row, PS_LIST_TAIL, "PSF_DOF", 0, "Degrees of freedom of PSF fit", 0);
-        psMetadataAddF32(row, PS_LIST_TAIL, "CR_SIGNIFICANCE", 0, "Significance of CR", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "EXT_SIGNIFICANCE", 0, "Significance of extendedness", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "PSF_MAJOR", 0, "PSF major axis (pixels)", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "PSF_MINOR", 0, "PSF minor axis (pixels)", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "PSF_THETA", 0, "PSF position angle (deg on chip)", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "PSF_QUALITY", 0, "PSF quality factor", NAN);
-        psMetadataAddS32(row, PS_LIST_TAIL, "PSF_NPIX", 0, "Number of pixels in PSF", 0);
-        psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_XX", 0, "xx moment", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_XY", 0, "xy moment", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_YY", 0, "yy moment", NAN);
-        psMetadataAddU32(row, PS_LIST_TAIL, "FLAGS", 0, "Detection bit flags", 0);
-        psMetadataAddS64(row, PS_LIST_TAIL, "DIFF_SKYFILE_ID", 0, "Identifier for diff skyfile", 0);
-
-        psMetadataAddS32(row, PS_LIST_TAIL, "N_POS", 0, "Number of positive pixels", 0);
-        psMetadataAddF32(row, PS_LIST_TAIL, "F_POS", 0, "Fraction of positive pixels", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_BAD", 0, "Ratio of positive pixels to negative", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_MASK", 0, "Ratio of positive pixels to masked", NAN);
-        psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_ALL", 0, "Ratio of positive pixels to all", NAN);
-        if (!psFitsWriteTableEmpty(fits, header, row, OUT_EXTNAME)) {
-            psErrorStackPrint(stderr, "Unable to write empty table.");
-            psFree(header);
-            psFree(row);
+        if (!psFitsWriteBlank(fits, header, NULL)) {
+            psError(psErrorCodeLast(), false, "Unable to write primary header");
             return false;
         }
-        psFree(row);
-    } else {
-        psArray *table = psArrayAlloc(det->num); // Table to write
-        for (long i = 0; i < det->num; i++) {
-            psMetadata *row = psMetadataAlloc(); // Output row
-            psMetadataAddF64(row, PS_LIST_TAIL, "RA", 0, "Right ascension (degrees)",
-                             RAD_TO_DEG(det->ra->data.F64[i]));
-            psMetadataAddF64(row, PS_LIST_TAIL, "RA_ERR", 0, "Right ascension error (degrees)",
-                             det->raErr->data.F64[i]);
-            psMetadataAddF64(row, PS_LIST_TAIL, "DEC", 0, "Declination (degrees)",
-                             RAD_TO_DEG(det->dec->data.F64[i]));
-            psMetadataAddF64(row, PS_LIST_TAIL, "DEC_ERR", 0, "Declination error (degrees)",
-                             det->decErr->data.F64[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "MAG", 0, "Magnitude", det->mag->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "MAG_ERR", 0, "Magnitude error", det->magErr->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "PSF_CHI2", 0, "chi^2 of PSF fit", det->chi2->data.F32[i]);
-            psMetadataAddS32(row, PS_LIST_TAIL, "PSF_DOF", 0, "Degrees of freedom of PSF fit",
-                             det->dof->data.S32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "CR_SIGNIFICANCE", 0, "Significance of CR",
-                             det->cr->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "EXT_SIGNIFICANCE", 0, "Significance of extendedness",
-                             det->extended->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "PSF_MAJOR", 0, "PSF major axis (pixels)", det->psfMajor->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "PSF_MINOR", 0, "PSF minor axis (pixels)", det->psfMinor->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "PSF_THETA", 0, "PSF position angle (deg on chip)",
-                             det->psfTheta->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "PSF_QUALITY", 0, "PSF quality factor",
-                             det->quality->data.F32[i]);
-            psMetadataAddS32(row, PS_LIST_TAIL, "PSF_NPIX", 0, "Number of pixels in PSF",
-                             det->numPix->data.S32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_XX", 0, "xx moment", det->xxMoment->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_XY", 0, "xy moment", det->xyMoment->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "MOMENTS_YY", 0, "yy moment", det->yyMoment->data.F32[i]);
-            psMetadataAddS32(row, PS_LIST_TAIL, "N_POS", 0, "Number of positive pixels",
-                             det->nPos->data.S32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "F_POS", 0, "Fraction of positive pixels",
-                             det->fPos->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_BAD", 0, "Ratio of positive pixels to negative",
-                             det->nRatioBad->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_MASK", 0, "Ratio of positive pixels to masked",
-                             det->nRatioMask->data.F32[i]);
-            psMetadataAddF32(row, PS_LIST_TAIL, "RATIO_ALL", 0, "Ratio of positive pixels to all",
-                             det->nRatioAll->data.F32[i]);
-            psMetadataAddU32(row, PS_LIST_TAIL, "FLAGS", 0, "Detection bit flags", det->flags->data.U32[i]);
-            psMetadataAddS64(row, PS_LIST_TAIL, "DIFF_SKYFILE_ID", 0, "Identifier for diff skyfile",
-                             det->diffSkyfileId->data.S64[i]);
+        psFree(header);
+    }
 
-            table->data[i] = row;
-        }
-        if (!psFitsWriteTable(fits, header, table, OUT_EXTNAME)) {
-            psErrorStackPrint(stderr, "Unable to write table.");
-            psFree(header);
-            psFree(table);
+    for (int i = 0; i < detections->n; i++) {
+        ppMopsDetections *det = detections->data[i]; // Detections for extension
+        psTrace("ppMops.write", 1, "Writing extension %d to %s", i, args->output);
+        psString hdrName = NULL, psfName = NULL, deteffName = NULL;
+        psStringAppend(&hdrName, "%s.hdr", det->component);
+        psStringAppend(&psfName, "%s.psf", det->component);
+        psStringAppend(&deteffName, "%s.deteff", det->component);
+
+        if (!psFitsWriteBlank(fits, det->header, hdrName)) {
+            psError(psErrorCodeLast(), false, "Unable to write header %d", i);
             return false;
         }
-        psFree(table);
+        if (!psFitsWriteTableAllColumns(fits, det->psfHeader, det->table, psfName)) {
+            psError(psErrorCodeLast(), false, "Unable to write table %d", i);
+            return false;
+        }
+        if (det->deteffHeader && det->deteffTable &&
+            !psFitsWriteTableAllColumns(fits, det->deteffHeader, det->deteffTable, deteffName)) {
+            psError(psErrorCodeLast(), false, "Unable to write detection efficiency %d", i);
+            return false;
+        }
+        psFree(hdrName);
+        psFree(psfName);
+        psFree(deteffName);
     }
-
-    psFree(header);
     psFitsClose(fits);
 
-    psTrace("ppMops.write", 1, "Done writing %ld rows to %s", det->num, args->output);
+    psTrace("ppMops.write", 1, "Done writing to %s", args->output);
 
     return true;
Index: /branches/czw_branch/20100519/psLib/src/fits/psFits.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/fits/psFits.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/fits/psFits.c	(revision 28304)
@@ -815,38 +815,38 @@
 {
     switch (datatype) {
-    case TBYTE:
+      case TBYTE:
         return PS_TYPE_U8;
-    case TSBYTE:
+      case TSBYTE:
         return PS_TYPE_S8;
-    case TSHORT:
+      case TSHORT:
         return PS_TYPE_S16;
-    case TUSHORT:
+      case TUSHORT:
         return PS_TYPE_U16;
-    case TLONG:
+      case TLONG:
         if (sizeof(long) == 8) {
             return PS_TYPE_S64;
         }
         // no break
-    case TINT:
+      case TINT:
         return PS_TYPE_S32;
-    case TULONG:
+      case TULONG:
         if (sizeof(unsigned long) == 8) {
             return PS_TYPE_U64;
         }
         // no break
-    case TUINT:
+      case TUINT:
         return PS_TYPE_U32;
-    case TLONGLONG:
+      case TLONGLONG:
         return PS_TYPE_S64;
-    case TFLOAT:
+      case TFLOAT:
         return PS_TYPE_F32;
-    case TDOUBLE:
+      case TDOUBLE:
         return PS_TYPE_F64;
-    case TLOGICAL:
+      case TLOGICAL:
         return PS_TYPE_BOOL;
-    default:
-        psError(PS_ERR_IO, true,
-                "Unknown FITS datatype, %d.",
-                datatype);
+      case TSTRING:
+        return PS_DATA_STRING;
+      default:
+        psError(PS_ERR_IO, true, "Unknown FITS datatype, %d.", datatype);
         return 0;
     }
Index: /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.c	(revision 28304)
@@ -746,2 +746,259 @@
     return true;
 }
+
+
+psMetadata *psFitsReadTableAllColumns(const psFits *fits)
+{
+    PS_ASSERT_FITS_NON_NULL(fits, NULL);
+
+    if (!readTableCheck(fits)) {
+        return NULL;
+    }
+
+    int status = 0;                     // CFITSIO return status
+
+    long numRows = 0;                   // Number of rows in table
+    int numCols = 0;                    // Number of columns in table
+    fits_get_num_rows(fits->fd, &numRows, &status);
+    fits_get_num_cols(fits->fd, &numCols, &status);
+    if (psFitsError(status, true, "Failed to determine the size of the current HDU table.")) {
+        return NULL;
+    }
+
+    int hdutype;                        // Type of HDU: need to distinguish ASCII and binary tables
+    fits_get_hdu_type(fits->fd, &hdutype, &status);
+    if (psFitsError(status, true, "Could not determine the HDU type.")) {
+        return false;
+    }
+
+    psMetadata *table = psMetadataAlloc();     // Table to return
+    for (int col = 1; col <= numCols; col++) { // Fortran indexing
+        char name[FLEN_VALUE];           // Column name
+        if (hdutype == BINARY_TBL) {
+            fits_get_bcolparms(fits->fd, col, name,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, &status);
+        } else {
+            fits_get_acolparms(fits->fd, col, name,
+                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, &status);
+        }
+
+        int cfitsioType = 0;             // Column type from CFITSIO
+        long repeat;                     // Number of repeats
+        fits_get_eqcoltype(fits->fd, col, &cfitsioType, &repeat, NULL, &status);
+        if (psFitsError(status, true, "Could not determine the column data for %s", name)) {
+            psFree(table);
+            return false;
+        }
+
+        psDataType pslibType = p_psFitsTypeFromCfitsio(cfitsioType); // Column type in psLib
+        if (pslibType == PS_DATA_STRING) {
+            // Strings
+            int width;                  // Width of strings
+            if (fits_get_col_display_width(fits->fd, col, &width, &status) != 0) {
+                psFitsError(status, true, "Could not determine the width of column %s", name);
+                psFree(table);
+                return NULL;
+            }
+            psArray *array = psArrayAlloc(numRows); // Array of strings from table
+            for (int i = 0; i < numRows; i++) {
+                array->data[i] = psStringAlloc(width);
+            }
+            fits_read_col_str(fits->fd, col, 1, 1, numRows, "", (char**)array->data, NULL, &status);
+            if (psFitsError(status, true, "Failed to read column %s", name)) {
+                psFree(array);
+                psFree(table);
+                return NULL;
+            }
+            if (!psMetadataAddArray(table, PS_LIST_TAIL, name, 0, NULL, array)) {
+                psError(PS_ERR_BAD_FITS, false, "Unable to add column %s to table", name);
+                psFree(array);
+                psFree(table);
+                return NULL;
+            }
+            psFree(array);
+        } else if (repeat == 1) {
+            // Single numbers
+            psVector* vector = psVectorAlloc(numRows, pslibType); // Vector from table
+            fits_read_col(fits->fd, cfitsioType, col, 1, 1, numRows, NULL,
+                          vector->data.U8, NULL, &status);
+            if (psFitsError(status, true, "Failed to read column %s", name)) {
+                psFree(vector);
+                psFree(table);
+                return NULL;
+            }
+            if (!psMetadataAddVector(table, PS_LIST_TAIL, name, 0, NULL, vector)) {
+                psError(PS_ERR_BAD_FITS, false, "Unable to add column %s to table", name);
+                psFree(vector);
+                psFree(table);
+                return NULL;
+            }
+            psFree(vector);
+        } else  {
+            // Vectors of numbers
+            psAssert(pslibType != PS_DATA_STRING, "Vectors of strings not handled");
+            psImage *image = psImageAlloc(repeat, numRows, pslibType); // Image to store vector of vectors
+            for (int row = 1, i = 0; row <= numRows; row++, i++) { // Fortran indexing for row
+                int anynul = 0;         // Any nulls in what was read?
+                fits_read_col(fits->fd, cfitsioType, col, row, 1, repeat, NULL,
+                              image->data.U8[i], &anynul, &status);
+                if (psFitsError(status, true, "Failed to read column %s row %d", name, row)) {
+                    psFree(image);
+                    psFree(table);
+                    return NULL;
+                }
+            }
+            if (!psMetadataAddImage(table, PS_LIST_TAIL, name, 0, NULL, image)) {
+                psError(PS_ERR_BAD_FITS, false, "Unable to add column %s to table", name);
+                psFree(image);
+                psFree(table);
+                return NULL;
+            }
+            psFree(image);
+        }
+    }
+
+    return table;
+}
+
+bool psFitsWriteTableAllColumns(psFits *fits, psMetadata *header, const psMetadata *table, const char *extname)
+{
+    PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_FITS_WRITABLE(fits, false);
+    PS_ASSERT_METADATA_NON_NULL(table, false);
+
+    psArray *columns = psListToArray(table->list); // Columns in psMetadataItems
+    int numCols = columns->n;                      // Number of columns
+    long numRows = 0;                              // Number of rows
+    psArray *names = psArrayAlloc(numCols);        // Column names
+    psArray *types = psArrayAlloc(numCols);        // Column types
+
+    for (int i = 0; i < numCols; i++) {
+        psMetadataItem *colItem = columns->data[i]; // Column
+        names->data[i] = psMemIncrRefCounter(colItem->name);
+
+        size_t size = 0;                   // Size of column
+        char tform = 0;                 // Type in character for FITS
+        long rows = 0;                   // Number of rows
+        switch (colItem->type) {
+          case PS_DATA_VECTOR:
+            size = 1;
+            psVector *vector = colItem->data.V; // Vector of interest
+            tform = getTForm(vector->type.type);
+            rows = vector->n;
+            break;
+          case PS_DATA_ARRAY:
+            tform = getTForm(PS_DATA_STRING);
+            psArray *array = colItem->data.V; // Array of interest
+            rows = array->n;
+            for (int i = 0; i < rows; i++) {
+                const char *string = array->data[i];
+                size = PS_MAX(size, strlen(string));
+            }
+            break;
+          case PS_DATA_IMAGE: ;
+            psImage *image = colItem->data.V; // Image of interest
+            tform = getTForm(image->type.type);
+            size = image->numCols;
+            rows = image->numRows;
+            break;
+          default:
+            psAbort("Unrecognised column type: %x", colItem->type);
+        }
+        psString type = NULL;           // Column type
+        psStringAppend(&type, "%zd%c", size, tform);
+        types->data[i] = type;
+        if (i == 0) {
+            numRows = rows;
+        } else if (numRows != rows) {
+            psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Column %d has differing size: %ld vs %ld",
+                    i, rows, numRows);
+            psFree(names);
+            psFree(types);
+            psFree(columns);
+            return false;
+        }
+    }
+
+    // Create the table HDU
+    int numHDUs = psFitsGetSize(fits);  // Number of HDUs in file
+    int status = 0;                     // Status from cfitsio
+    if (numHDUs == 0) {
+        // We're creating the first extension
+        fits_create_tbl(fits->fd, BINARY_TBL, numRows, numCols, (char**)names->data, (char**)types->data,
+                        NULL, NULL, &status);
+    } else {
+        fits_insert_btbl(fits->fd, numRows, numCols, (char**)names->data, (char**)types->data,
+                         NULL, NULL, 0, &status);
+    }
+    psFree(names);
+    psFree(types);
+    if (psFitsError(status, true, "Unable to create FITS table with %d columns and %ld rows",
+                    numCols, numRows)) {
+        psFree(columns);
+        return false;
+    }
+
+    // Write header
+    if (header && !psFitsWriteHeader(fits, header)) {
+        psError(psErrorCodeLast(), false, "Unable to write FITS header.\n");
+        psFree(columns);
+        return false;
+    }
+    if (extname && strlen(extname) > 0 && !psFitsSetExtName(fits, extname)) {
+        psError(psErrorCodeLast(), false, "Unable to write FITS header extension name.\n");
+        psFree(columns);
+        return false;
+    }
+
+    // cfitsio requires that we write the data by columns --- urgh!
+    for (long col = 1, i = 0; col <= numCols; col++, i++) {      // Fortran indexing
+        psMetadataItem *colItem = columns->data[i]; // Column
+        switch (colItem->type) {
+          case PS_DATA_VECTOR: {
+              psVector *vector = colItem->data.V; // Vector
+              int cfitsioType;                    // Data type for cfitsio
+              p_psFitsTypeToCfitsio(vector->type.type, NULL, NULL, &cfitsioType);
+              fits_write_col(fits->fd, cfitsioType, col, 1, 1, numRows, vector->data.U8, &status);
+              break;
+          }
+          case PS_DATA_ARRAY: {
+              psArray *array = colItem->data.V; // Array of strings
+              fits_write_col_str(fits->fd, col, 1, 1, numRows, (char**)array->data, &status);
+              break;
+          }
+          case PS_DATA_IMAGE: {
+              psImage *image = colItem->data.V;                                        // Image of interest
+              psDataType type = image->type.type;                                      // Type of data
+              psVector *vector = psVectorAlloc(image->numCols * image->numRows, type); // Vector from image
+              if (!p_psImageCopyToRawBuffer(vector->data.U8, image, type)) {
+                  psError(psErrorCodeLast(), false, "Unable to copy image to buffer");
+                  psFree(columns);
+                  return false;
+              }
+              int cfitsioType;            // Data type for cfitsio
+              p_psFitsTypeToCfitsio(type, NULL, NULL, &cfitsioType);
+              fits_write_col(fits->fd, cfitsioType, col, 1, 1, image->numRows * image->numCols,
+                             vector->data.U8, &status);
+              break;
+          }
+          default:
+            psAbort("Unrecognised column type: %x", colItem->type);
+        }
+        // Check error status from writing column
+        if (psFitsError(status, true, "Unable to write column %ld of FITS table", col)) {
+            psFree(columns);
+            return false;
+        }
+    }
+    psFree(columns);
+
+    // This forces a re-scan of the header to ensure everything's kosher.  We found this occassionally
+    // necessary for compressed images, which are tables, so perhaps it helps here too.  I guess it can't
+    // hurt.
+    ffrdef(fits->fd, &status);
+    if (psFitsError(status, true, "Could not re-scan HDU.")) {
+        return false;
+    }
+
+    return true;
+}
Index: /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.h
===================================================================
--- /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.h	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/fits/psFitsTable.h	(revision 28304)
@@ -62,4 +62,21 @@
 );
 
+/** Read all table columns.
+ *
+ * String columns are read into arrays, number columns are read into vectors.
+ */
+psMetadata *psFitsReadTableAllColumns(const psFits *fits // FITS file pointer
+                                      );
+
+/** Write all table columns.
+ *
+ * Uses the same format as for psFitsReadTableAllColumns.
+ */
+bool psFitsWriteTableAllColumns(
+                                psFits *fits, // FITS file pointer
+                                psMetadata *header, // Header to write, or NULL
+                                const psMetadata *table, // Table to write
+                                const char *extname      // Extension name, or NULL
+                                );
 
 /** Reads a whole FITS table.  The current HDU type must be either
Index: /branches/czw_branch/20100519/psLib/src/imageops/psImageConvolve.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/imageops/psImageConvolve.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/imageops/psImageConvolve.c	(revision 28304)
@@ -1736,4 +1736,5 @@
         psThreadTaskRemove("PSLIB_IMAGE_SMOOTHMASK_SCANROWS");
         psThreadTaskRemove("PSLIB_IMAGE_SMOOTHMASK_SCANCOLS");
+        psThreadTaskRemove("PSLIB_IMAGE_SMOOTHMASK_PIXELS");
     }
     threaded = set;
Index: /branches/czw_branch/20100519/psLib/src/imageops/psImageCovariance.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/imageops/psImageCovariance.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/imageops/psImageCovariance.c	(revision 28304)
@@ -571,8 +571,10 @@
 
     psKernel *out = psKernelAlloc(xMinOut, xMaxOut, yMinOut, yMaxOut); // Output covariance
+    double outSum = 0.0;                                               // Sum of covariance
     for (int y = yMinOut; y <= yMaxOut; y++) {
         float yIn = y * scale + 0.5 - yMinIn + 1; // Position on input image (not the kernel)
         for (int x = xMinOut; x <= xMaxOut; x++) {
             float xIn = x * scale + 0.5 - xMinIn + 1; // Position on input (not the kernel)
+
             double value;                                     // Value on output
             if (!psImageInterpolate(&value, NULL, NULL, xIn, yIn, interp)) {
@@ -580,9 +582,30 @@
                 return false;
             }
-            out->kernel[y][x] = value;
-        }
-    }
-
+            outSum += out->kernel[y][x] = value;
+        }
+    }
     psFree(interp);
+
+    // Problem: the interpolation has introduced power into the covariance matrix that shouldn't be there.  We
+    // can't scale the sum of the matrix because that would throw off the central value and affect the noise
+    // calculation for this image.  But we can't scale just by the central value because that would throw off
+    // the noise calculation for convolutions of this image.  We choose to scale by the sum of the non-central
+    // elements.  This is almost having the best of both worlds.
+
+    double inSum = 0.0;                 // Sum of covariance
+    for (int y = yMinIn; y <= yMaxIn; y++) {
+        for (int x = xMinIn; x <= xMaxIn; x++) {
+            inSum += in->kernel[y][x];
+        }
+    }
+
+    float norm = (inSum - in->kernel[0][0]) / (outSum - out->kernel[0][0]) / PS_SQR(scale); // Renormalisation
+    for (int y = yMinOut; y <= yMaxOut; y++) {
+        for (int x = xMinOut; x <= xMaxOut; x++) {
+            if (x != 0 && y != 0) {
+                out->kernel[y][x] *= norm;
+            }
+        }
+    }
 
     return out;
Index: /branches/czw_branch/20100519/psLib/src/sys/psAbort.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/sys/psAbort.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/sys/psAbort.c	(revision 28304)
@@ -23,4 +23,5 @@
 #include <stdarg.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "psAbort.h"
@@ -47,4 +48,5 @@
 
     // Call system abort function to terminate program execution
+    fsync(psLogGetDestination());
     abort();
 }
@@ -71,4 +73,5 @@
 
     // Call system abort function to terminate program execution
+    fsync(psLogGetDestination());
     abort();
 }
Index: /branches/czw_branch/20100519/psLib/src/sys/psThread.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/sys/psThread.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/sys/psThread.c	(revision 28304)
@@ -21,5 +21,10 @@
 #define TASK_BUCKETS 8                  // Number of hash buckets for task list
 
+// Mutex covers:
+// * pending queue
+// * done queue
+// * thread->busy states
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; // Mutex for locking threads
+
 static psList *pending = NULL;          // queue of pending jobs
 static psList *done = NULL;             // queue of done jobs
@@ -28,5 +33,4 @@
 static psArray *tsd = NULL;             // Thread-specific data
 
-
 /***** basic thread functions *****/
 
@@ -193,16 +197,16 @@
         // request a new job, if there are none available, sleep a bit
         // we have to lock here so the job queue cannot be empty yet no threads busy
+        psThreadJob *job = NULL;        // Job to process
         psThreadLock();
-        psThreadJob *job = NULL;        // Job to process
         while ((job = psThreadJobGetPending()) == NULL) {
+            // Unlock while sleeping, then lock to read the pending queue again
             psThreadUnlock();
             usleep(THREAD_WAIT);
-            psThreadLock(); // XXX ???
+            psThreadLock();
         }
         self->busy = true;
+        psThreadUnlock();
 
         psThreadTask *task = psHashLookup(tasks, job->type); // Task to execute job
-        psThreadUnlock();
-
         psAssert(task, "Couldn't find thread task %s", job->type);
         psAssert(job->args->n == task->nArgs, "invalid number of arguments to %s (%ld supplied, expected %d)", task->type, job->args->n, task->nArgs);
@@ -254,13 +258,11 @@
 }
 
-// Harvest jobs from the
+// Harvest jobs from the done list
 static void psThreadJobHarvest(void)
 {
-    psThreadLock();
     psThreadJob *job;           // Job from done queue
     while ((job = psThreadJobGetDone())) {
         psFree(job);
     }
-    psThreadUnlock();
     return;
 }
@@ -273,4 +275,5 @@
         // Ensure everything is harvested, if requested
         if (harvest) {
+            // No threads, no no need to lock
             psThreadJobHarvest();
         }
@@ -287,5 +290,7 @@
         }
 
-        // Harvest jobs, if requested
+        psThreadLock();
+
+        // Harvest jobs in the background, if requested
         if (harvest) {
             psThreadJobHarvest();
@@ -293,5 +298,4 @@
 
         // are all threads idle?
-        psThreadLock();
         for (int i = 0; i < pool->n; i++) {
             psThread *thread = pool->data[i];
@@ -303,10 +307,10 @@
 
         if (!pending || !pending->head) {
-            // Nothing in the queue
-            psThreadUnlock();
+            // Nothing in the queue and nothing more to add
             // Ensure everything is harvested, if requested
             if (harvest) {
                 psThreadJobHarvest();
             }
+            psThreadUnlock();
             return true;
         }
Index: /branches/czw_branch/20100519/psLib/src/types/psTree.c
===================================================================
--- /branches/czw_branch/20100519/psLib/src/types/psTree.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/src/types/psTree.c	(revision 28304)
@@ -342,6 +342,6 @@
         fprintf(fptr, " ");
     }
-    fprintf(fptr, "(");
     for (int i = 0; i < node->num; i++) {
+        fprintf(fptr, "%ld=(",node->contents[i]);
         psF64 *coords = tree->data->F64[node->contents[i]]; // Coordinates
         for (int j = 0; j < dim; j++) {
@@ -351,8 +351,5 @@
             }
         }
-        fprintf(fptr, ")");
-        if (i < node->num - 1) {
-            fprintf(fptr, " (");
-        }
+        fprintf(fptr, ") ");
     }
     fprintf(fptr, "\n");
@@ -433,11 +430,10 @@
         switch (dim) {
           case 2: {
-              // Haversine formula
+              // Haversine formula, modulo a factor of 1/2
               double dphi = coords->data.F64[1] - tree->data->F64[index][1];
-              double sindphi = sin(dphi / 2.0);
+              double haverPhi = 1.0 - cos(dphi);
               double dlambda = coords->data.F64[0] - tree->data->F64[index][0];
-              double sindlambda = sin(dlambda / 2.0);
-              return PS_SQR(sindphi) +
-                  cos(coords->data.F64[1]) * cos(tree->data->F64[index][1]) * PS_SQR(sindlambda);
+              double haverLambda = 1.0 - cos(dlambda);
+              return haverPhi + cos(coords->data.F64[1]) * cos(tree->data->F64[index][1]) * haverLambda;
           }
           default:
@@ -456,37 +452,43 @@
     int dim = tree->dim;                // Dimensionality
     double distance = 0.0;              // Distance to box
-    for (int i = 0; i < dim; i++) {
-        double minDiff = tree->min->F64[index][i] - coords->data.F64[i];
-        if (minDiff > 0) {
-            switch (tree->type) {
-              case PS_TREE_EUCLIDEAN:
+    switch (tree->type) {
+      case PS_TREE_EUCLIDEAN:
+        for (int i = 0; i < dim; i++) {
+            double minDiff = tree->min->F64[index][i] - coords->data.F64[i];
+            if (minDiff > 0) {
                 distance += PS_SQR(minDiff);
-                break;
-              case PS_TREE_SPHERICAL: {
-                  double sinDiff = sin(minDiff / 2.0);
-                  distance += PS_SQR(sinDiff);
-                  break;
-              }
-              default:
-                psAbort("Unrecognised type: %x", tree->type);
-            }
-            continue;
-        }
-        double maxDiff = coords->data.F64[i] - tree->max->F64[index][i];
-        if (maxDiff > 0) {
-            switch (tree->type) {
-              case PS_TREE_EUCLIDEAN:
+                continue;
+            }
+            double maxDiff = coords->data.F64[i] - tree->max->F64[index][i];
+            if (maxDiff > 0) {
                 distance += PS_SQR(maxDiff);
-                break;
-              case PS_TREE_SPHERICAL: {
-                  double sinDiff = sin(maxDiff / 2.0);
-                  distance += PS_SQR(sinDiff);
-                  break;
-              }
-              default:
-                psAbort("Unrecognised type: %x", tree->type);
-            }
-            continue;
-        }
+                continue;
+            }
+        }
+        break;
+      case PS_TREE_SPHERICAL: {
+          double ra = coords->data.F64[0], dec = coords->data.F64[1];                 // Coords of interest
+          double raMin = tree->min->F64[index][0], raMax = tree->max->F64[index][0]; // RA bounds
+          double decMin = tree->min->F64[index][1], decMax = tree->max->F64[index][1]; // Dec bounds
+
+          // Haversine formula, modulo a factor of 1/2
+          // This seems to deal with the wrap at RA=0=2pi, probably ascending the tree and descending on the
+          // other side of the wrap.
+          if (ra < raMin || ra > raMax) {
+              double ra1 = cos(ra - raMin), ra2 = cos(ra - raMax); // Options for RA distance
+              double raDist = PS_MAX(ra1, ra2);                    // Will give the smallest distance
+              double dec0 = (fabs(dec - decMin) < fabs(dec - decMax)) ? decMin : decMax; // Closest Dec limit
+              distance += cos(dec0) * cos(dec) * (1.0 - raDist);
+          }
+
+          if (dec < decMin || dec > decMax) {
+              double dec1 = cos(dec - decMin), dec2 = cos(dec - decMax); // Options for Dec distance
+              distance += 1.0 - PS_MAX(dec1, dec2);
+          }
+
+          break;
+      }
+      default:
+        psAbort("Unrecognised type: %x", tree->type);
     }
     return distance;
@@ -604,9 +606,7 @@
         // Using the square of the distance as the distance measure
         return PS_SQR(radius);
-      case PS_TREE_SPHERICAL: {
-          // Using a rearrangement of the Haversine formula
-          double sindist = sin(radius / 2.0);
-          return PS_SQR(sindist);
-      }
+      case PS_TREE_SPHERICAL:
+        // Using Haversine formula, modulo a factor of 1/2
+        return 1.0 - cos(radius);
       default:
         psAbort("Unrecognised type: %x", tree->type);
@@ -653,5 +653,5 @@
     long num = 0;                       // Number of points in circle
 
-    // This is essentially the same as psTreeNearest, except we're not allowed to prune
+    // This is essentially the same as psTreeNearest
 
     // Find the closest point in the leaf that contains the point of interest
@@ -667,4 +667,10 @@
         while (workIndex >= 0) {
             psTreeNode *node = work->data[workIndex];
+            if (treeBranchDistance(tree, node->index, coords) > distance) {
+                // No need to investigate
+                work->data[workIndex] = NULL;
+                workIndex--;
+                continue;
+            }
             if (node->left) {
                 // Branch node
@@ -696,5 +702,5 @@
 {
     for (int i = 0; i < leaf->num; i++) {
-        long index = leaf->contents[i]; // Index of point
+        psS64 index = leaf->contents[i]; // Index of point
         if (treeContentDistance(tree, index, coords) < distance) {
             psVectorAppend(result, index);
@@ -720,5 +726,5 @@
     psVector *result = psVectorAllocEmpty(4, PS_TYPE_S64); // Indices of points within match radius
 
-    // This is essentially the same as psTreeNearest, except we're not allowed to prune
+    // This is essentially the same as psTreeNearest, except pruning based on the search radius
 
     // Find the closest point in the leaf that contains the point of interest
@@ -734,4 +740,10 @@
         while (workIndex >= 0) {
             psTreeNode *node = work->data[workIndex];
+            if (treeBranchDistance(tree, node->index, coords) > distance) {
+                // No need to investigate
+                work->data[workIndex] = NULL;
+                workIndex--;
+                continue;
+            }
             if (node->left) {
                 // Branch node
@@ -801,4 +813,10 @@
         while (workIndex >= 0) {
             psTreeNode *node = work->data[workIndex];
+            if (treeBranchDistance(tree, node->index, coords) > distance) {
+                // No need to investigate
+                work->data[workIndex] = NULL;
+                workIndex--;
+                continue;
+            }
             if (node->left) {
                 // Branch node
Index: /branches/czw_branch/20100519/psLib/test/types/tap_psTree.c
===================================================================
--- /branches/czw_branch/20100519/psLib/test/types/tap_psTree.c	(revision 28303)
+++ /branches/czw_branch/20100519/psLib/test/types/tap_psTree.c	(revision 28304)
@@ -3,6 +3,22 @@
 #include "pstap.h"
 
-#define NUM 1000000                      // Number of points
+#define NUM 1000000                     // Number of points
 #define SPHERICAL_DISTANCE 3.0          // Distance of interest for spherical test
+#define SEED 0                          // Random seed
+
+static double distance(double ra1, double dec1, double ra2, double dec2)
+{
+#if 0
+    // Traditional formula
+    return acos(sin(dec1) * sin(dec2) + cos(dec1) * cos(dec2) * cos(ra1 - ra2));
+#else
+    // Haversine formula: used in psTree
+    double dphi = dec1 - dec2;
+    double sindphi = sin(dphi/2.0);
+    double dlambda = ra1 - ra2;
+    double sindlambda = sin(dlambda/2.0);
+    return 2.0 * asin(sqrt(PS_SQR(sindphi) + cos(dec1) * cos(dec2) * PS_SQR(sindlambda)));
+#endif
+}
 
 int main(int argc, char *argv[])
@@ -54,5 +70,5 @@
             ok(closest->data.F64[0] == x->data.F64[bestIndex] &&
                closest->data.F64[1] == y->data.F64[bestIndex],
-               "correst coords: %lf,%lf(%lf) vs %lf,%lf(%lf)",
+               "correct coords: %lf,%lf(%lf) vs %lf,%lf(%lf)",
                closest->data.F64[0], closest->data.F64[1],
                sqrt(PS_SQR(closest->data.F64[0]) + PS_SQR(closest->data.F64[1])),
@@ -77,8 +93,8 @@
         psVector *dec = psVectorAlloc(NUM, PS_TYPE_F64);
 
-        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 0);
+        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
         for (int i = 0; i < NUM; i++) {
             // Using http://mathworld.wolfram.com/SpherePointPicking.html
-            ra->data.F64[i] = psRandomUniform(rng);
+            ra->data.F64[i] = psRandomUniform(rng) * 2.0 * M_PI;
             dec->data.F64[i] = acos(2.0 * psRandomUniform(rng) - 1.0) - M_PI_2;
         }
@@ -92,6 +108,10 @@
 
             psVector *coords = psVectorAlloc(2, PS_TYPE_F64);
-            coords->data.F64[0] = psRandomUniform(rng);
+#if 0
+            coords->data.F64[0] = psRandomUniform(rng) * 2.0 * M_PI;
             coords->data.F64[1] = acos(2.0 * psRandomUniform(rng) - 1.0) - M_PI_2;
+#else
+            psVectorInit(coords, 0);
+#endif
 
             psVector *indices = psTreeAllWithin(tree, coords, DEG_TO_RAD(SPHERICAL_DISTANCE));
@@ -102,41 +122,46 @@
             ok(psVectorSortInPlace(indices), "sorted indices");
 
+#if 0
+            for (long i = 0; i < indices->n; i++) {
+                long index = indices->data.S64[i];
+                double dist = distance(coords->data.F64[0], coords->data.F64[1],
+                                       ra->data.F64[index], dec->data.F64[index]);
+                diag("%ld (%lf,%lf) is in the list (%lf vs %lf)",
+                     index, ra->data.F64[index], dec->data.F64[index], RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
+            }
+#endif
+
             bool allgood = true;        // All points in the appropriate place?
             double bestDistance = INFINITY; // Distance to best point
             long bestIndex = -1;        // Index of best point
+            long bad = 0;               // Number bad
             for (long i = 0, j = 0; i < NUM; i++) {
-#if 1
-                // Traditional formula
-                double dist = acos(sin(coords->data.F64[1]) * sin(dec->data.F64[i]) +
-                                   cos(coords->data.F64[1]) * cos(dec->data.F64[i]) *
-                                   cos(coords->data.F64[0] - ra->data.F64[i]));
-#else
-                // Haversine formula: used in psTree
-                double dphi = coords->data.F64[1] - dec->data.F64[i];
-                double sindphi = sin(dphi/2.0);
-                double dlambda = coords->data.F64[0] - ra->data.F64[i];
-                double sindlambda = sin(dlambda/2.0);
-                double dist = 2.0 * asin(sqrt(PS_SQR(sindphi) +
-                                              cos(coords->data.F64[1]) * cos(dec->data.F64[i]) *
-                                              PS_SQR(sindlambda)));
-#endif
-                                              if (dist < bestDistance) {
+                double dist = distance(coords->data.F64[0], coords->data.F64[1],
+                                       ra->data.F64[i], dec->data.F64[i]);
+                if (dist < bestDistance) {
                     bestDistance = dist;
                     bestIndex = i;
                 }
-                if (i == indices->data.S64[j]) {
+                if (j < indices->n && i == indices->data.S64[j]) {
                     j++;
                     if (dist > DEG_TO_RAD(SPHERICAL_DISTANCE)) {
-                        diag("%ld is in the list, but shouldn't be (%lf vs %lf)",
-                             i, RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
+                        diag("%ld (%lf,%lf) is in the list, but shouldn't be (%lf vs %lf)",
+                             i, ra->data.F64[i], dec->data.F64[i], RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
                         allgood = false;
+                        bad++;
+                    } else {
+#if 0
+                        diag("%ld (%lf,%lf) correctly identified in the list (%lf vs %lf)",
+                             i, ra->data.F64[i], dec->data.F64[i], RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
+#endif
                     }
                 } else if (dist <= DEG_TO_RAD(SPHERICAL_DISTANCE)) {
-                    diag("%ld is not in the list, but should be (%lf vs %lf)",
-                         i, RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
+                    diag("%ld (%lf,%lf) is not in the list, but should be (%lf vs %lf)",
+                         i, ra->data.F64[i], dec->data.F64[i], RAD_TO_DEG(dist), SPHERICAL_DISTANCE);
                     allgood = false;
+                    bad++;
                 }
             }
-            ok(allgood, "list is acurate");
+            ok(allgood, "list is accurate: %ld bad", bad);
             ok(bestIndex == closeIndex, "correct point: %ld vs %ld", closeIndex, bestIndex);
 
Index: /branches/czw_branch/20100519/psModules/src/camera/pmFPAfileIO.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/camera/pmFPAfileIO.c	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/camera/pmFPAfileIO.c	(revision 28304)
@@ -751,5 +751,5 @@
     file->filename = pmFPAfileName(file, view, config);
     if (!file->filename) {
-        psError(PS_ERR_IO, true, "Unable to determine filename");
+        psError(PS_ERR_IO, true, "Unable to determine filename for file %s", file->name);
         return false;
     }
Index: /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.c	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.c	(revision 28304)
@@ -8,4 +8,12 @@
 
 #include "pmConfigMask.h"
+
+// Structure to hold the properties of a mask value
+typedef struct {
+    char *badMaskName;                  // name for "bad" (i.e., mask me please) pixels
+    char *fallbackName;                 // Fallback name in case a bad mask name is not defined
+    psImageMaskType defaultMaskValue;   // Default value in case a bad mask name and its fallback are not defined
+    bool isBad; // include this value as part of the MASK.VALUE entry (generically bad)
+} pmConfigMaskInfo;
 
 static pmConfigMaskInfo masks[] = {
Index: /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.h
===================================================================
--- /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.h	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/config/pmConfigMask.h	(revision 28304)
@@ -20,12 +20,4 @@
 /// @{
 
-// structure to hold the properties of a mask value
-typedef struct {
-    char *badMaskName;			// name for "bad" (i.e., mask me please) pixels
-    char *fallbackName;			// Fallback name in case a bad mask name is not defined
-    psImageMaskType defaultMaskValue;	// Default value in case a bad mask name and its fallback are not defined
-    bool isBad;	// include this value as part of the MASK.VALUE entry (generically bad)
-} pmConfigMaskInfo;
-
 // pmConfigMaskSetInMetadata examines named mask values and set the bits for maskValue and
 // markValue.  Ensures that the below-named mask values are set, and calculates the mask value
@@ -33,6 +25,6 @@
 // name is not found, or the default values if the fallback name is not found.
 bool pmConfigMaskSetInMetadata(psImageMaskType *outMaskValue, // Value of MASK.VALUE, returned
-			       psImageMaskType *outMarkValue, // Value of MARK.VALUE, returned
-			       psMetadata *source  // Source of mask bits
+                               psImageMaskType *outMarkValue, // Value of MARK.VALUE, returned
+                               psMetadata *source  // Source of mask bits
   );
 
@@ -40,9 +32,9 @@
 // Get a mask value by name(s)
 psImageMaskType pmConfigMaskGetFromMetadata(psMetadata *source, // Source of masks
-					    const char *masks // Mask values to get
+                                            const char *masks // Mask values to get
   );
 
 
-// lookup an image mask value by name from a psMetadata, without requiring the entry to 
+// lookup an image mask value by name from a psMetadata, without requiring the entry to
 // be of type psImageMaskType, but verifying that it will fit in psImageMaskType
 psImageMaskType psMetadataLookupImageMaskFromGeneric (bool *status, const psMetadata *md, const char *name);
@@ -50,5 +42,5 @@
 // Remove from the header keywords starting with the provided string
 int pmConfigMaskRemoveHeaderKeywords(psMetadata *header, // Header from which to remove keywords
-				     const char *start // Remove keywords that start with this string
+                                     const char *start // Remove keywords that start with this string
   );
 
Index: /branches/czw_branch/20100519/psModules/src/detrend/pmGainTweak.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/detrend/pmGainTweak.c	(revision 28304)
+++ /branches/czw_branch/20100519/psModules/src/detrend/pmGainTweak.c	(revision 28304)
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include <pslib.h>
+
+#include "pmFPA.h"
+
+#include "pmGainTweak.h"
+
+bool pmGainTweak(const pmCell *cell)
+{
+    PS_ASSERT_PTR_NON_NULL(cell, false);
+    pmChip *chip = cell->parent;
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+
+    int numCells = chip->cells;         // Number of cells
+    psVector *gains = psVectorAlloc(numCells, PS_TYPE_F32); // Gain for each cell
+    psVector *mask = psVectorAlloc(numCells, PS_TYPE_VECTOR_MASK); // Mask for gains
+    psVectorInit(mask, 0);
+    int numGood = 0;                    // Number of good gains
+
+   for (int i = 0; i < numCells; i++) {
+        pmCell *otherCell = chip->cells->data[i]; // A different cell
+        if (otherCell == cell) {
+            mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xFF;
+            continue;
+        }
+        float gain = psMetadataLookupF32(NULL, otherCell->concepts, "CELL.GAIN"); // Gain for cell
+        gains->data.F32[i] = gain;
+        if (!isfinite(gains->data.F32[i])) {
+            mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xFF;
+        } else {
+            numGood++;
+        }
+   }
+
+   if (numGood == 0) {
+       psError(PM_ERR_DETREND, true, "No other cell gains available with which to tweak gain.");
+       psFree(gains);
+       psFree(mask);
+       return false;
+   }
+
+   psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); // Statistics
+   if (!psVectorStats(stats, gains, NULL, mask, 0xFF)) {
+       psError(psErrorCodeLast(), false, "Unable to determine target gain");
+       psFree(stats);
+       psFree(gains);
+       psFree(mask);
+       return false;
+   }
+   float target = stats->sampleMedian;  // Target gain
+   psFree(stats);
+   psFree(gains);
+   psFree(mask);
+
+   psMetadataItem *item = psMetadataLookup(cell->concepts, "CELL.GAIN");
+   item->data.F32 = target;
+
+   return true;
+}
Index: /branches/czw_branch/20100519/psModules/src/extras/pmVisual.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/extras/pmVisual.c	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/extras/pmVisual.c	(revision 28304)
@@ -86,20 +86,56 @@
 
 
+// ask the user to continue or not.  give up after 2 seconds.
+// XXX add option to turn on/off timeouts?
 bool pmVisualAskUser(bool *plotFlag)
 {
+    struct timeval timeout;
+    fd_set fdSet;
+    int status;
+
     char key[10];
     if (plotFlag) {
-	fprintf (stdout, "[c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) ");
+	fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) ");
     } else {
-	fprintf (stdout, "[c]ontinue? [a]bort all visual plots? (c) ");
-    }
-    if (!fgets(key, 8, stdin)) {
-        psWarning("Unable to read option");
-    }
-    if (plotFlag && (key[0] == 's')) {
-        *plotFlag = false;
-    }
-    if (key[0] == 'a') {
-        isVisual = false;
+	fprintf (stderr, "[p]ause? [c]ontinue? [a]bort all visual plots? (c) ");
+    }
+
+    /* Wait up to 1.0 second for a response, then continue */
+    timeout.tv_sec = 2;
+    timeout.tv_usec = 0;
+
+    FD_ZERO (&fdSet);
+    FD_SET (STDIN_FILENO, &fdSet);
+
+    status = select (1, &fdSet, NULL, NULL, &timeout);
+    if (status <= 0) {
+	fprintf (stderr, "\n");
+	return true; // if no data, give up
+    }
+
+    while (true) {
+	if (!fgets(key, 8, stdin)) {
+	    psWarning("Unable to read option");
+	}
+	switch (key[0]) {
+	  case 's':
+	    if (plotFlag) *plotFlag = false;
+	    *plotFlag = false;
+	    return true;
+	  case 'a':
+	    isVisual = false;
+	    return true;
+	  case 'c':
+	  case '\n':
+	    return true;
+	  default:
+	    break;
+	}
+	
+	if (plotFlag) {
+	    fprintf (stderr, "[c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) ");
+	} else {
+	    fprintf (stderr, "[c]ontinue? [a]bort all visual plots? (c) ");
+	}
     }
     return true;
Index: /branches/czw_branch/20100519/psModules/src/imcombine/pmSubtraction.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/imcombine/pmSubtraction.c	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/imcombine/pmSubtraction.c	(revision 28304)
@@ -32,4 +32,5 @@
 #define MIN_SAMPLE_STATS    7           // Minimum number to use sample statistics; otherwise use quartiles
 #define USE_KERNEL_ERR                  // Use kernel error image?
+#define NUM_COVAR_POS 5                 // Number of positions for covariance calculation
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1328,17 +1329,33 @@
     // This can be fairly involved, so we only do it for a single instance
     // Enable threads for covariance calculation, since we're not threading on top of it.
+    float position[NUM_COVAR_POS] = { -1.0, -0.5, 0.0, +0.5, +1.0 }; // Positions for covariance calculations
     oldThreads = psImageCovarianceSetThreads(true);
     if (kernels->mode == PM_SUBTRACTION_MODE_1 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) {
-        psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0, false); // Convolution kernel
-        psKernelTruncate(kernel, covarFrac);
-        out1->covariance = psImageCovarianceCalculate(kernel, ro1->covariance);
-        psFree(kernel);
+        psArray *covars = psArrayAlloc(PS_SQR(NUM_COVAR_POS)); // Covariances
+        for (int y = 0, i = 0; y < NUM_COVAR_POS; y++) {
+            for (int x = 0; x < NUM_COVAR_POS; x++, i++) {
+                psKernel *kernel = pmSubtractionKernel(kernels, position[x], position[y],
+                                                       false); // Convolution kernel
+                psKernelTruncate(kernel, covarFrac);
+                covars->data[i] = psImageCovarianceCalculate(kernel, ro1->covariance);
+                psFree(kernel);
+            }
+        }
+        out1->covariance = psImageCovarianceAverage(covars);
+        psFree(covars);
     }
     if (kernels->mode == PM_SUBTRACTION_MODE_2 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) {
-        psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0,
-                                               kernels->mode == PM_SUBTRACTION_MODE_DUAL); // Conv. kernel
-        psKernelTruncate(kernel, covarFrac);
-        out2->covariance = psImageCovarianceCalculate(kernel, ro2->covariance);
-        psFree(kernel);
+        psArray *covars = psArrayAlloc(PS_SQR(NUM_COVAR_POS)); // Covariances
+        for (int y = 0, i = 0; y < NUM_COVAR_POS; y++) {
+            for (int x = 0; x < NUM_COVAR_POS; x++, i++) {
+                psKernel *kernel = pmSubtractionKernel(kernels, position[x], position[y],
+                                                       kernels->mode == PM_SUBTRACTION_MODE_DUAL); // Convolution kernel
+                psKernelTruncate(kernel, covarFrac);
+                covars->data[i] = psImageCovarianceCalculate(kernel, ro2->covariance);
+                psFree(kernel);
+            }
+        }
+        out2->covariance = psImageCovarianceAverage(covars);
+        psFree(covars);
     }
     psImageCovarianceSetThreads(oldThreads);
Index: /branches/czw_branch/20100519/psModules/src/objects/pmSourceMatch.c
===================================================================
--- /branches/czw_branch/20100519/psModules/src/objects/pmSourceMatch.c	(revision 28303)
+++ /branches/czw_branch/20100519/psModules/src/objects/pmSourceMatch.c	(revision 28304)
@@ -280,4 +280,9 @@
     psFree(boundsMaster);
 
+    if (!matches) {
+        psError(PM_ERR_OBJECTS, true, "No matches made.");
+        return NULL;
+    }
+
     if (cullSingles) {
         // Now cull the matches that contain only a single star
@@ -300,4 +305,10 @@
     }
 
+    if (matches->n == 0) {
+        psError(PM_ERR_OBJECTS, true, "No matches made.");
+        psFree(matches);
+        return NULL;
+    }
+
     return matches;
 }
@@ -311,5 +322,5 @@
     psArray *matches = pmSourceMatchSources(sourceArrays, radius, false); // Source matches
     if (!matches) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to match source lists.");
+        psError(psErrorCodeLast(), false, "Unable to match source lists.");
         return NULL;
     }
Index: /branches/czw_branch/20100519/psconfig/pscheckmods
===================================================================
--- /branches/czw_branch/20100519/psconfig/pscheckmods	(revision 28303)
+++ /branches/czw_branch/20100519/psconfig/pscheckmods	(revision 28304)
@@ -10,4 +10,5 @@
     exit 1;
 }
+# print "x: $x\n";
 
 $version = eval "\$$ARGV[0]::VERSION";
Index: /branches/czw_branch/20100519/psconfig/pscheckperl
===================================================================
--- /branches/czw_branch/20100519/psconfig/pscheckperl	(revision 28303)
+++ /branches/czw_branch/20100519/psconfig/pscheckperl	(revision 28304)
@@ -147,6 +147,12 @@
         vsystem ("make install");
     }
+    chdir $homedir;
 
-    chdir $homedir;
+    # we claim to have built the module; double-check that it can be found
+    system ("pscheckmods $module $modver");
+    if ($?) {
+        die "failed to find the module we just built: $module\n";
+    }
+    print "built $module\n\n";
 }
 if (!$build) {
Index: /branches/czw_branch/20100519/psconfig/psconfig.csh.in
===================================================================
--- /branches/czw_branch/20100519/psconfig/psconfig.csh.in	(revision 28303)
+++ /branches/czw_branch/20100519/psconfig/psconfig.csh.in	(revision 28304)
@@ -358,4 +358,5 @@
 set plibdir  = {$PSCONFDIR}/{$PSCONFIG}/lib
 set plib5dir = {$PSCONFDIR}/{$PSCONFIG}/lib/perl5
+set plibsite = {$PSCONFDIR}/{$PSCONFIG}/lib/perl5/site_perl
 set newpath = ""
 set pathlist = `echo $PERL5LIB | tr ':' '\n'`
@@ -378,7 +379,7 @@
 else
   if ("$newpath" == "") then
-    setenv PERL5LIB {$plibdir}:{$plib5dir}:
-  else
-    setenv PERL5LIB {$plibdir}:{$plib5dir}:{$newpath}
+    setenv PERL5LIB {$plibdir}:{$plib5dir}:{$plibsite}
+  else
+    setenv PERL5LIB {$plibdir}:{$plib5dir}:{$plibsite}:{$newpath}
   endif 
 endif 
Index: /branches/czw_branch/20100519/psphot/src/psphotReadout.c
===================================================================
--- /branches/czw_branch/20100519/psphot/src/psphotReadout.c	(revision 28303)
+++ /branches/czw_branch/20100519/psphot/src/psphotReadout.c	(revision 28304)
@@ -14,5 +14,5 @@
     // by the multiple threads, not the total time used by all threads.
     psTimerStart ("psphotReadout");
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     pmModelClassSetLimits(PM_MODEL_LIMITS_LAX);
 
@@ -26,5 +26,5 @@
     char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT");
     psAssert (breakPt, "configuration error: set BREAK_POINT");
-
+    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // set the photcode for this image
     if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
@@ -32,5 +32,5 @@
         return false;
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // Generate the mask and weight images, including the user-defined analysis region of interest
     if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {
@@ -40,9 +40,10 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // generate a background model (median, smoothed image)
     if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
+            printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
@@ -51,5 +52,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
     // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
@@ -58,5 +59,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // find the detections (by peak and/or footprint) in the image.
     if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1
@@ -65,5 +66,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // construct sources and measure basic stats (saved on detections->newSources)
     if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1
@@ -74,5 +75,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // find blended neighbors of very saturated stars (detections->newSources)
     if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {
@@ -80,5 +81,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
     if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
@@ -86,5 +87,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // classify sources based on moments, brightness.  if a PSF model has been loaded, the PSF
     // clump defined for it is used not measured (detections->newSources)
@@ -93,4 +94,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
+            printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
     if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1
@@ -101,5 +103,5 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
     // this step is skipped
@@ -115,16 +117,16 @@
     // XXX fix this in the new multi-input context
     // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // construct an initial model for each object, set the radius to fitRadius, set circular
     // fit mask (detections->newSources)
     psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // merge the newly selected sources into the existing list
     // NOTE: merge OLD and NEW
     psphotMergeSources (config, view, "PSPHOT.INPUT");
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
     psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // identify CRs and extended sources (only unmeasured sources are measured)
     psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)
@@ -132,36 +134,36 @@
         goto finish;
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // non-linear PSF and EXT fit to brighter sources
     // replace model flux, adjust mask as needed, fit, subtract the models (full stamp)
     psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // replace all sources
     psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // linear fit to include all sources (subtract again)
     // NOTE : apply to ALL sources (extended + psf)
     psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // if we only do one pass, skip to extended source analysis
     if (!strcasecmp (breakPt, "PASS1")) goto pass1finish;
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // NOTE: possibly re-measure background model here with objects subtracted / or masked
 
     // add noise for subtracted objects
     psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // find fainter sources
     // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections
     psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // remove noise for subtracted objects (ie, return to normal noise level)
     // NOTE: this needs to operate only on the OLD sources
     psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // define new sources based on only the new peaks
     // NOTE: new sources are saved on detections->newSources
     psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // set source type
     // NOTE: apply only to detections->newSources
@@ -170,21 +172,21 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // create full input models, set the radius to fitRadius, set circular fit mask
     // NOTE: apply only to detections->newSources
     psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // replace all sources so fit below applies to all at once
     // NOTE: apply only to OLD sources (which have been subtracted)
     psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // merge the newly selected sources into the existing list
     // NOTE: merge OLD and NEW
     // XXX check on free of sources...
     psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // NOTE: apply to ALL sources
     psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
 pass1finish:
 
@@ -192,13 +194,13 @@
     // NOTE: applies only to NEW (unmeasured) sources
     psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
     psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
 finish:
 
     // plot positive sources
     // psphotSourcePlots (readout, sources, recipe);
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // measure aperture photometry corrections
     if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
@@ -206,8 +208,10 @@
         return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     }
-
+        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     // calculate source magnitudes
-    psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
-
+    if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
+      psErrorStackPrint(stderr, "Unable to do magnitudes.");
+        psErrorClear();
+    }      
     if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1
         psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
@@ -219,9 +223,19 @@
 
     // replace background in residual image
-    psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1
-
+    if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1
+      psErrorStackPrint(stderr, "Unable to replace sky");
+      psErrorClear();
+
+/*       psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */
+/*       return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */
+    }
     // drop the references to the image pixels held by each source
-    psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1
-
+    if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1
+      psErrorStackPrint(stderr, "Unable to free source pixels");
+      psErrorClear();
+
+/*       psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */
+/*       return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */
+    }
     // create the exported-metadata and free local data
     return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
Index: /branches/czw_branch/20100519/psphot/src/psphotStackOptions.c
===================================================================
--- /branches/czw_branch/20100519/psphot/src/psphotStackOptions.c	(revision 28303)
+++ /branches/czw_branch/20100519/psphot/src/psphotStackOptions.c	(revision 28304)
@@ -40,6 +40,6 @@
     options->psfs        = psArrayAlloc(num);
     options->sourceLists = psArrayAlloc(num); // Individual lists of sources for matching
-    options->kernels     = psArrayAlloc(num); 
-    options->regions     = psArrayAlloc(num); 
+    options->kernels     = psArrayAlloc(num);
+    options->regions     = psArrayAlloc(num);
 
     options->inputMask   = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
@@ -77,22 +77,22 @@
     switch (options->convolveSource) {
       case PSPHOT_CNV_SRC_AUTO:
-	fileSrc = fileCnv ? fileCnv : fileRaw;
-	break;
+        fileSrc = fileCnv ? fileCnv : fileRaw;
+        break;
 
       case PSPHOT_CNV_SRC_RAW:
-	fileSrc = fileRaw;
-	break;
+        fileSrc = fileRaw;
+        break;
 
       case PSPHOT_CNV_SRC_CNV:
-	fileSrc = fileCnv;
-	break;
+        fileSrc = fileCnv;
+        break;
 
       default:
-	psAbort("impossible case");
+        psAbort("impossible case");
     }
     if (!fileSrc) {
-	psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %llx, raw : %llx)", (long long) fileCnv, (long long) fileRaw);
+        psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %p, raw : %p)", fileCnv, fileRaw);
     }
-    
+
     return fileSrc;
 }
Index: /branches/czw_branch/20100519/psphot/src/psphotVisual.c
===================================================================
--- /branches/czw_branch/20100519/psphot/src/psphotVisual.c	(revision 28303)
+++ /branches/czw_branch/20100519/psphot/src/psphotVisual.c	(revision 28304)
@@ -15,4 +15,6 @@
 # include <kapa.h>
 
+# define DEBUG 0
+
 bool pmVisualLimitsFromVectors (Graphdata *graphdata, psVector *xVec, psVector *yVec);
 
@@ -197,5 +199,5 @@
     pmReadout *backgnd;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
@@ -220,5 +222,5 @@
 bool psphotVisualShowSignificance (psImage *image, float min, float max) {
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
@@ -236,5 +238,5 @@
     KiiOverlay *overlay;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
@@ -275,5 +277,5 @@
     KiiOverlay *overlay;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
@@ -385,5 +387,5 @@
     psEllipseAxes axes;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
@@ -437,5 +439,5 @@
     KapaSection section;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (2);
@@ -753,5 +755,5 @@
 bool psphotVisualShowRoughClass (psArray *sources) {
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (1);
@@ -774,5 +776,5 @@
 bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) {
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (3);
@@ -840,5 +842,5 @@
     bool status;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (3);
@@ -992,5 +994,5 @@
     bool status;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (3);
@@ -1356,5 +1358,5 @@
     KapaSection section;  // put the positive profile in one and the residuals in another?
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (2);
@@ -1427,5 +1429,5 @@
     return true;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (1);
@@ -1568,5 +1570,5 @@
 bool psphotVisualShowSourceSize (pmReadout *readout, psArray *sources) {
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (1);
@@ -1595,5 +1597,5 @@
     KapaSection section;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (2);
@@ -2106,5 +2108,5 @@
 bool psphotVisualShowResidualImage (pmReadout *readout) {
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (1);
@@ -2122,5 +2124,5 @@
     float lineX[2], lineY[2];
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (2);
@@ -2240,5 +2242,5 @@
     Graphdata graphdata;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int myKapa = psphotKapaChannel (2);
@@ -2324,5 +2326,5 @@
     KiiOverlay *overlay;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!DEBUG && !pmVisualIsVisual()) return true;
 
     int kapa = psphotKapaChannel (1);
Index: /branches/czw_branch/20100519/pstamp/scripts/detectability_respond.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/detectability_respond.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/detectability_respond.pl	(revision 28304)
@@ -226,4 +226,5 @@
 my @psphot_Qfact= ();
 my @psphot_flux = ();
+my @psphot_error = ();
 
 foreach my $k (keys %image_list_hash) {
@@ -231,5 +232,5 @@
 	my $cmf = "$image_list_hash{$k}{OUTROOT}.$image_list_hash{$k}{CLASS_ID}.cmf";
 	
-	my ($tmp_Npix,$tmp_Qfact,$tmp_flux) = read_cmf_file($cmf,$image_list_hash{$k}{EXTENSION_BASE});
+	my ($tmp_Npix,$tmp_Qfact,$tmp_flux,$tmp_flux_error) = read_cmf_file($cmf,$image_list_hash{$k}{EXTENSION_BASE});
 	
 	push @rownums,        @{ $image_list_hash{$k}{ROWNUM} };
@@ -238,4 +239,5 @@
 	push @psphot_Qfact,   @{ $tmp_Qfact };
 	push @psphot_flux,    @{ $tmp_flux };
+	push @psphot_error,   @{ $tmp_flux_error };
     }
     else {
@@ -245,4 +247,5 @@
 	push @psphot_Qfact,   (map { 0.0 }  @{ $image_list_hash{$k}{ROWNUM} });
 	push @psphot_flux,    (map { 0.0 }  @{ $image_list_hash{$k}{ROWNUM} });
+	push @psphot_error,    (map { 0.0 }  @{ $image_list_hash{$k}{ROWNUM} });
     }	
 }
@@ -252,5 +255,5 @@
 		    $query{HEADER}{MJD_OBS}[0],$query{HEADER}{filter}[0],
 		    $query{HEADER}{obscode}[0],
-		    \@rownums, \@out_errors, \@psphot_Npix, \@psphot_Qfact, \@psphot_flux);
+		    \@rownums, \@out_errors, \@psphot_Npix, \@psphot_Qfact, \@psphot_flux, \@psphot_error);
 # print "Wrote response file $output\n";
 #
@@ -406,4 +409,5 @@
     my @tmp_Qfact = ();
     my @tmp_flux = ();
+    my @tmp_flux_err = ();
 
     my ($detect_F_col,$detect_N_col,$detect_flux_col,$detect_mag_col) = (-1, -1, -1, -1);
@@ -428,4 +432,5 @@
 	    { name => 'PSF_NPIX', type => '1J', writetype => TLONG },
 	    { name => 'PSF_INST_MAG', type => '1E', writetype => TDOUBLE },
+	    { name => 'PSF_INST_MAG_SIG', type => '1E', writetype => TDOUBLE },
 	    ];
     }
@@ -435,4 +440,5 @@
 	    { name => 'PSF_NPIX', type => '1J', writetype => TLONG },
 	    { name => 'PSF_INST_FLUX', type => '1E', writetype => TDOUBLE },
+	    { name => 'PSF_INST_FLUX_SIG', type => '1E', writetype => TDOUBLE },
 	    ];
     }
@@ -450,4 +456,5 @@
     $inFits->get_num_rows($numRows, $status) and check_fitsio($status);
 
+    my $correct_error = 0;
     foreach my $col (@$column_defs) {
 	my ($col_num,$col_type,$col_data);
@@ -469,10 +476,22 @@
 	    @tmp_flux = map { $_ = 10**(-0.4 * $_) } @{ $col_data };
 	}
+	elsif ($col->{name} eq 'PSF_INST_MAG_SIG') {
+	    @tmp_flux_err = map { $_ = $_ / (2.5 * log10(exp(1))) } @{ $col_data };
+	    $correct_error = 1;
+	}
 	elsif ($col->{name} eq 'PSF_INST_FLUX') {
 	    @tmp_flux = @{ $col_data };
 	}
+	elsif ($col->{name} eq 'PSF_INST_FLUX_SIG') {
+	    @tmp_flux_err = @{ $col_data };
+	}
+    }
+    if ($correct_error) {
+	for (my $c = 0; $c <= $#tmp_flux_err; $c++) {
+	    $tmp_flux_err[$c] = $tmp_flux_err[$c] * $tmp_flux[$c];
+	}
     }
     $inFits->close_file( $status ) and check_fitsio($status);    
-    return(\@tmp_Npix, \@tmp_Qfact, \@tmp_flux);
+    return(\@tmp_Npix, \@tmp_Qfact, \@tmp_flux, \@tmp_flux_err);
 }
 
@@ -490,4 +509,5 @@
     my $psphot_Qfact_ref = shift;
     my $psphot_flux_ref = shift;
+    my $psphot_error_ref = shift;
     my $status = 0;
 
@@ -504,4 +524,6 @@
 	# flux of the target source
 	{ name => 'TARGET_FLUX', type => 'D', writetype => TDOUBLE },
+	# error in the flux of the target source
+	{ name => 'TARGET_FLUX_SIG', type => 'D', writetype => TDOUBLE },
 	];
     
@@ -543,6 +565,10 @@
 	push @{$colData{'DETECT_F'}},    ${ $psphot_Qfact_ref }[$i];
 	push @{$colData{'TARGET_FLUX'}}, ${ $psphot_flux_ref }[$i];
+	push @{$colData{'TARGET_FLUX_SIG'}}, ${ $psphot_error_ref }[$i];
 	unless (defined(${ $colData{'TARGET_FLUX'}}[-1])) {
 	    $colData{'TARGET_FLUX'}[-1] = 0.0;
+	}
+	unless (defined(${ $colData{'TARGET_FLUX_SIG'}}[-1])) {
+	    $colData{'TARGET_FLUX_SIG'}[-1] = 0.0;
 	}
     }
Index: /branches/czw_branch/20100519/pstamp/scripts/pstamp_checkdependent.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstamp_checkdependent.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstamp_checkdependent.pl	(revision 28304)
@@ -299,6 +299,15 @@
         my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id";
         my $data = runToolAndParse($command, $verbose);
-        my_die("failed to find warpSkyCelllMap for warpRun $warp_id skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR)
-            if !$data or scalar @$data == 0;
+        if (!$data or scalar @$data == 0) {
+            # This happens if the chipProcessedImfile disappears which happened when earlier
+            # versions of chiptool -revertprocessedimfile didn't check the chipRun.state before
+            # deleing the row. 
+            # Fault the jobs so that the Request can finish ...
+            faultJobs('stop', undef, undef, $PSTAMP_GONE);
+            # ... and fault the dependent so that we have a record of the error
+            my_die("failed to find warpSkyCelllMap for warpRun $warp_id skycell_id $skycell_id",
+                $PSTAMP_GONE);
+        }
+
 
         my $chips_ready = 1;
Index: /branches/czw_branch/20100519/pstamp/scripts/pstamp_finish.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstamp_finish.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstamp_finish.pl	(revision 28304)
@@ -76,5 +76,5 @@
 if ($product eq "NULL") {
     # nothing more to do
-    stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
+    my_die("product is NULL!", $req_id, $PS_EXIT_PROG_ERROR);
 }
 
@@ -92,19 +92,14 @@
 
         if (!mkdir $outdir) {
-            print STDERR "cannot create output directory $outdir";
-            stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
+            my_die("cannot create output directory $outdir",$req_id, $PS_EXIT_UNKNOWN_ERROR);
         }
 
 
     } elsif (! -d $outdir ) {
-        # XXX TODO: fault the request so we pstamp_finish doesn't keep trying to process the
-        # request
-        print STDERR "output directory $outdir exists but is not a directory";
-        stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
+        my_die("output directory $outdir exists but is not a directory", $req_id, $PS_EXIT_UNKNOWN_ERROR);
     }
 
     if (! -e $req_file ) {
-        print STDERR "request file $req_file is missing\n";
-        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
+        my_die("request file $req_file is missing", $req_id, $PS_EXIT_CONFIG_ERROR);
     }
 
@@ -115,6 +110,5 @@
         # Since a request got queued, the request file must have been readable at some
         # point 
-        print STDERR "failed to read request_file $req_file" ;
-        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
+        my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR);
     }
 
@@ -151,15 +145,7 @@
         my $output = join "", @$stdout_buf;
         if (!$output) {
-            if ($verbose) {
-                print STDERR "Request $req_id produced no jobs.\n"
-            }
             # This should not happen. A fake job should have been entered
-            stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
+            my_die("Request $req_id produced no jobs", $req_id, $PS_EXIT_PROG_ERROR);
         } else {
-if (0) {
-            my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
-
-            my $jobs = parse_md_list($metadata);
-}
             my $jobs = parse_md_fast($mdcParser, $output);
 
@@ -181,5 +167,5 @@
             # this request had a duplicate request name yet the parser didn't give
             # it an "ERROR style name.
-            stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
+            my_die("duplicate request not given a request name", $req_id, $PS_EXIT_PROG_ERROR);
         }
         my ($row, $req_info, $project) = get_request_info($rows, $rownum);
@@ -187,9 +173,7 @@
         my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
         my $image_db = $proj_hash->{dbname};
-        if (!$image_db) {
-            carp("failed to find imagedb for project: $project");
-            if (!$fault) {
-                stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
-            }
+        if (!$image_db and !$fault) {
+            # if project isn't resolvable, the paser should have faulted this job
+            my_die("failed to find imagedb for project $project", $req_id, $PS_EXIT_CONFIG_ERROR);
         }
 
@@ -273,6 +257,6 @@
                 run(command => $command, verbose => $verbose);
             unless ($success) {
-                print STDERR "Unable to perform $command error code: $error_code\n";
                 $request_fault = $error_code >> 8;
+                my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault);
             }
         }
@@ -282,19 +266,15 @@
         my $command = "$dsreg --list $reglist_name --add $fileset --product $product --type PSRESULTS";
         $command .= " --link --datapath $outdir --ps0 $req_id";
-# XXX: let dsreg and config handle resolving dbname and dbserver
-#        $command .= " --dbname $dbname" if $dbname;
 
         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
             run(command => $command, verbose => $verbose);
         unless ($success) {
-            #die("Unable to perform $command error code: $error_code");
-            print STDERR "Unable to perform $command error code: $error_code\n";
             $request_fault = $error_code >> 8;
-            # fall through to stop the request
+            my_die("Unable to perform $command error code: $error_code\n", $req_id, $request_fault);
         }
     }
     # set the request's state to stop
     {
-        my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop -set_fault $request_fault";
+        my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop";
         $command   .= " -dbname $dbname" if $dbname;
         $command   .= " -dbserver $dbserver" if $dbserver;
@@ -308,9 +288,12 @@
 }
 
-sub stop_request_and_exit {
+sub my_die {
+    my $msg = shift;
     my $req_id = shift;
     my $fault  = shift;
 
-    my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop -set_fault $fault";
+    carp($msg);
+
+    my $command = "$pstamptool -updatereq -req_id $req_id -set_fault $fault";
     $command   .= " -dbname $dbname" if $dbname;
     $command   .= " -dbserver $dbserver" if $dbserver;
@@ -445,9 +428,4 @@
                 return undef;
             }
-if (0) {
-            my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
-
-            my $exposures = parse_md_list($metadata);
-}
             my $exposures = parse_md_fast($mdcParser, $output);
             my $numExp = @$exposures;
Index: /branches/czw_branch/20100519/pstamp/scripts/pstamp_insert_request.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstamp_insert_request.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstamp_insert_request.pl	(revision 28304)
@@ -114,31 +114,25 @@
 
 exit 0;
-
-# Temporary hack
-# webrequest number is stored in a file in the current directory
-#
-# get this number from the database
+# Ask the database for the next web request number
 sub get_webreq_num
 {
-    my $filename = "$workdir/webreq_num.txt";
-    if (! open IN, "+< $filename" ) {
-        my $initial_num = 1;
-        open IN, "> $filename" or die "can't open $filename";
-        print IN "$initial_num\n" or die "failed to initialize $filename";
-        close IN;
-        return $initial_num;
+    my $command = "$pstamptool -getwebrequestnum";
+    $command .= " -dbname $dbname" if $dbname;
+    $command .= " -dbserver $dbserver" if $dbserver;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        print STDERR @$stderr_buf;
+        die("Unable to perform pstamptool -getwebrequestnum: $error_code");
+    }
+    my $webreq_num = ${$stdout_buf}[0];
+    chomp $webreq_num;
+
+    if (!$webreq_num) {
+        die("pstamptool -getwebreqnum returned no value");
     }
 
-    my $webreq_num = <IN>;
-    chomp $webreq_num;
+    # print STDERR "webreq_num $webreq_num\n";
 
-    print STDERR "$webreq_num\n" if $verbose;
-
-    my $next = $webreq_num + 1;
-    truncate IN, 0;
-    seek IN, 0, 0;
-    print IN "$next\n";
-
-    close IN;
     return $webreq_num;
 }
Index: /branches/czw_branch/20100519/pstamp/scripts/pstamp_parser_run.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstamp_parser_run.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstamp_parser_run.pl	(revision 28304)
@@ -198,5 +198,5 @@
 $parse_cmd .= " --verbose" if $verbose;
 
-my $newState = "run";
+my $newState;
 my $fault;
 {
@@ -224,7 +224,8 @@
     }
 
-    unless ($success) {
+    if ($success) {
+        $newState = 'run';
+    } else {
         $fault = $error_code >> 8;
-#        $newState = "stop";
     }
 }
@@ -234,5 +235,6 @@
 #
 {
-    my $command = "$pstamptool -updatereq -req_id $req_id -set_state $newState";
+    my $command = "$pstamptool -updatereq -req_id $req_id";
+    $command   .= " -set_state $newState" if $newState;
     $command   .= " -set_outdir $outdir";
     $command   .= " -set_reqType $reqType" if $reqType;
Index: /branches/czw_branch/20100519/pstamp/scripts/pstamp_webrequest.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstamp_webrequest.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstamp_webrequest.pl	(revision 28304)
@@ -23,5 +23,5 @@
 
 my $host = hostname();
-my $verbose = 0;
+my $verbose = 1;
 my $dbname;
 my $dbserver;
@@ -152,29 +152,25 @@
 exit 0;
 
-# Temporary hack
-# webrequest number is stored in a file in the current directory
-#
+# Ask the database for the next web request number
 sub get_webreq_num
 {
-    my $filename = "webreq_num.txt";
-    if (! open IN, "+< $filename" ) {
-        my $initial_num = 1;
-        open IN, "> $filename" or die "can't open $filename";
-        print IN "$initial_num\n" or die "failed to initialize $filename";
-        close IN;
-        return $initial_num;
+    my $command = "$pstamptool -getwebrequestnum";
+    $command .= " -dbname $dbname" if $dbname;
+    $command .= " -dbserver $dbserver" if $dbserver;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        print STDERR @$stderr_buf;
+        die("Unable to perform pstamptool -getwebrequestnum: $error_code");
+    }
+    my $webreq_num = ${$stdout_buf}[0];
+    chomp $webreq_num;
+
+    if (!$webreq_num) {
+        die("pstamptool -getwebreqnum returned no value");
     }
 
-    my $webreq_num = <IN>;
-    chomp $webreq_num;
+    # print STDERR "webreq_num $webreq_num\n";
 
-    print STDERR "$webreq_num\n" if $verbose;
-
-    my $next = $webreq_num + 1;
-    truncate IN, 0;
-    seek IN, 0, 0;
-    print IN "$next\n";
-
-    close IN;
     return $webreq_num;
 }
Index: /branches/czw_branch/20100519/pstamp/scripts/pstampparse.pl
===================================================================
--- /branches/czw_branch/20100519/pstamp/scripts/pstampparse.pl	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/scripts/pstampparse.pl	(revision 28304)
@@ -361,5 +361,4 @@
     my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
     if (!$proj_hash) {
-        print STDERR "project $project not found\n" ;
         foreach $row (@$rowList) {
             insertFakeJobForRow($row, 1, $PSTAMP_UNKNOWN_PRODUCT);
@@ -829,12 +828,23 @@
             run(command => $command, verbose => $verbose);
         unless ($success) {
-            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
-        }
-        my $output = join "", @$stdout_buf;
-        chomp $output;
-        $dep_id = $output;
-        #
-        # XXX: need to fault the request or something
-        my_die("pstamptool -getdependent returned invalid dep_id", $PS_EXIT_PROG_ERROR) if !$dep_id;
+            my $fault = $error_code >> 8;
+            print STDERR "$command failed with fault $fault\n";
+            if ($fault >= 10) {
+                $$r_dep_id = 0;
+                $$r_fault = $fault;
+                $$r_jobState = 'stop';
+                return;
+            }
+            # for now just die. Later pstamptool will return the whole dependent so we can
+            # examine the fault code
+            my_die("$command failed with unexpected fault value: $fault", $PS_EXIT_UNKNOWN_ERROR);
+        } else {
+            my $output = join "", @$stdout_buf;
+            chomp $output;
+            $dep_id = $output;
+            #
+            # XXX: need to fault the request or something
+            my_die("pstamptool -getdependent returned invalid dep_id", $PS_EXIT_PROG_ERROR) if !$dep_id;
+        }
     } else {
         print STDERR "skipping $command\n";
Index: /branches/czw_branch/20100519/pstamp/src/pstamp.h
===================================================================
--- /branches/czw_branch/20100519/pstamp/src/pstamp.h	(revision 28303)
+++ /branches/czw_branch/20100519/pstamp/src/pstamp.h	(revision 28304)
@@ -9,4 +9,5 @@
 typedef enum {
         PSTAMP_SUCCESS          = 0,
+	PSTAMP_FIRST_ERROR_CODE = 10,
 	PSTAMP_SYSTEM_ERROR     = 10,
 	PSTAMP_NOT_IMPLEMENTED  = 11,
Index: /branches/czw_branch/20100519/pswarp/src/pswarpMaskStats.c
===================================================================
--- /branches/czw_branch/20100519/pswarp/src/pswarpMaskStats.c	(revision 28303)
+++ /branches/czw_branch/20100519/pswarp/src/pswarpMaskStats.c	(revision 28304)
@@ -2,7 +2,13 @@
 #include <ppStats.h>
 
-bool pswarpMaskStats(const pmReadout *readout, psMetadata *stats, const pmConfig *config) {
+bool pswarpMaskStats(const pmReadout *readout, psMetadata *stats, const pmConfig *config)
+{
   PS_ASSERT_PTR_NON_NULL(readout, false);
   PS_ASSERT_PTR_NON_NULL(config, false);
+
+  if (!stats || !readout || !readout->data_exists) {
+    // Nothing to process
+    return(true);
+  }
 
   bool status;
@@ -19,27 +25,22 @@
   psS32 Npix_advisory = 0;
 
-  if (!readout || !readout->data_exists) {
-    // Nothing to process
-    return(true);
-  }
-  psWarning("pswarpMaskStats: %d %d %d %d\n",staticMaskVal,magicMaskVal,dynamicMaskVal,advisoryMaskVal);
   psImage *mask = readout->mask;  // Mask of interest;
   if (!pmSingleImageMaskStats(mask,&Npix_valid,&Npix_static,&Npix_magic,
-			      &Npix_dynamic,&Npix_advisory,
-			      staticMaskVal,magicMaskVal,
-			      dynamicMaskVal,advisoryMaskVal)) {
+                              &Npix_dynamic,&Npix_advisory,
+                              staticMaskVal,magicMaskVal,
+                              dynamicMaskVal,advisoryMaskVal)) {
     psError(PS_ERR_UNKNOWN, false, "Unable to calculate masks for readout.");
     return(false);
   }
   psMetadataAddS32(stats, PS_LIST_TAIL,"MASKFRAC_NPIX", 0,
-		   "Number of valid pixels", Npix_valid);
+                   "Number of valid pixels", Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_STATIC", 0,
-		   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
+                   "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_DYNAMIC", 0,
-		   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
+                   "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", 0,
-		   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
+                   "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);
   psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_ADVISORY", 0,
-		   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
+                   "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);
   return(true);
 }
Index: /branches/czw_branch/20100519/tools/czartool.pl
===================================================================
--- /branches/czw_branch/20100519/tools/czartool.pl	(revision 28303)
+++ /branches/czw_branch/20100519/tools/czartool.pl	(revision 28304)
@@ -11,11 +11,12 @@
 use File::Temp qw(tempfile);
 
-my @states = ("full", "new", "drop", "wait", "fault");
+my @states = ("full", "new", "drop", "wait");
 my $db = connectToDb();
 
 if (!$db) {die;}
 
-my @stdscienceLabels = `getLabels.pl -s stdscience`;
-my @distributionLabels = `getLabels.pl -s distribution`;
+my @stdscienceLabels = `czartool_getLabels.pl -s stdscience`;
+my @distributionLabels = `czartool_getLabels.pl -s distribution`;
+my @publishingLabels = `czartool_getLabels.pl -s publishing`;
 
 checkAllLabels("new");
@@ -32,5 +33,5 @@
 sub printInstructions {
 
-    print "\n### Enter: (s)ervers (f)ull (n)ew (d)rop (w)ait (q)uit (l)abel, or label number from table above: ";
+    print "| Usage: (s)ervers, (l)abels, (q)uit, or label number from table above: ";
 }
 
@@ -48,11 +49,7 @@
 
         if ($key eq "s") {checkServers();}
-        elsif ($key eq "f") {checkAllLabels("full");}
-        elsif ($key eq "n") {checkAllLabels("new");}
-        elsif ($key eq "d") {checkAllLabels("drop");}
-        elsif ($key eq "w") {checkAllLabels("wait");}
-        elsif ($key eq "l") {labelDetails();}
+        elsif ($key eq "l") {checkAllLabels("new");}
         elsif ($key eq "u") {serverStatus("stdscience");}
-        elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[$key.$key2]);}
+        elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[($key.$key2)-1]);}
         printInstructions();
 
@@ -135,5 +132,5 @@
 sub checkServers {
 
-    my @servers = ("addstar", "cleanup", "detrend", "distribution", "pstamp", "publishing", "registration", "replication", "stdscience", "summitcopy");
+    my @servers = ("addstar", "cleanup", "detrend", "distribution", "pstamp", "update", "publishing", "registration", "replication", "stdscience", "summitcopy");
     printf("\n+-----------------------------------------------+\n");
     printf("|                      Servers                  |\n");
@@ -144,5 +141,5 @@
     foreach $server (@servers) {
 
-        my @results = `checkServer.pl -s $server`;
+        my @results = `czartool_checkServer.pl -s $server`;
 
         printf("| %12s ", $server);
@@ -194,13 +191,13 @@
         chomp($label);
         printf("| %10s ", $state);
-        printf("| %5d ", checkLabel($label, "chipRun", $state, "chip"));
-        printf("| %5d ", checkLabel($label, "camRun", $state, "cam"));
-        printf("| %5d ", checkLabel($label, "fakeRun", $state, "fake"));
-        printf("| %5d ", checkLabel($label, "warpRun", $state, "warp"));
-        printf("| %5d ", checkLabel($label, "stackRun", $state, "stack"));
-        printf("| %5d ", checkLabel($label, "diffRun", $state, "diff"));
-        printf("| %5d ", checkLabel($label, "magicRun", $state, "magic"));
-        printf("| %6d ", checkLabel($label, "magicDSRun", $state, "magicDS"));
-        printf("| %5d ", checkLabel($label, "distRun", $state, "dist"));
+        printf("| %5s ", getStateAndFaults($label, "chipRun", $state, "chip"));
+        printf("| %5s ", getStateAndFaults($label, "camRun", $state, "cam"));
+        printf("| %5s ", getStateAndFaults($label, "fakeRun", $state, "fake"));
+        printf("| %5s ", getStateAndFaults($label, "warpRun", $state, "warp"));
+        printf("| %5s ", getStateAndFaults($label, "stackRun", $state, "stack"));
+        printf("| %5s ", getStateAndFaults($label, "diffRun", $state, "diff"));
+        printf("| %5s ", getStateAndFaults($label, "magicRun", $state, "magic"));
+        printf("| %6s ", getStateAndFaults($label, "magicDSRun", $state, "magicDS"));
+        printf("| %5s ", getStateAndFaults($label, "distRun", $state, "dist"));
         printf("|\n");
         $i++;
@@ -219,28 +216,34 @@
     my ($state) = @_;
 #print time, $/;
-    printf("\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
-    printf("|                                                                           %10s (any faults are shown in parentheses)                                                  |\n", $state);
-    printf("+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
-    printf("| no  |              label               | distributing? |    chip    |    cam     |    fake    |    warp    |   stack    |    diff    |   magic    |  destreak  |    dist    |\n");
-    printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
+    printf("\n+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
+    printf("|                                                                                  %10s (any faults are shown in parentheses)                                                           |\n", $state);
+    printf("+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
+    printf("| no  |              label               | distributing? |  publishing?  |    chip    |    cam     |    fake    |    warp    |   stack    |    diff    |   magic    |  destreak  |    dist    |\n");
+    printf("+-----+----------------------------------+---------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
 
     my $stdsLabel;
     my $distLabel;
-    my $i=0;
+    my $pubLabel;
+    my $i=1;
     my $distributing;
+    my $publishing;
     foreach $stdsLabel (@stdscienceLabels) {
 
-    $distributing = 0;
+        $distributing = 0;
+        chomp($stdsLabel);
         foreach $distLabel (@distributionLabels) {
-            chomp($stdsLabel);
             chomp($distLabel);
             if ($stdsLabel eq $distLabel) { $distributing = 1; last;}
-
-
         }
-        chomp($stdsLabel);
+
+        foreach $pubLabel (@publishingLabels) {
+            chomp($pubLabel);
+            if ($stdsLabel eq $pubLabel) { $publishing = 1; last;}
+        }
+
         printf("| %3d ", $i);
         printf("| %32s ", $stdsLabel);
         printf("| %10s    ", $distributing ? "yes" : "NO" );
+        printf("| %10s    ", $publishing ? "yes" : "NO" );
         printf("| %10s ", getStateAndFaults($stdsLabel, "chipRun", $state, "chip"));
         printf("| %10s ", getStateAndFaults($stdsLabel, "camRun", $state, "cam"));
@@ -256,5 +259,5 @@
     }
 
-    printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
+    printf("+-----+----------------------------------+---------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
 
 }
Index: /branches/czw_branch/20100519/tools/neb-reverse
===================================================================
--- /branches/czw_branch/20100519/tools/neb-reverse	(revision 28304)
+++ /branches/czw_branch/20100519/tools/neb-reverse	(revision 28304)
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use DBI;
+use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock'; # Socket for mysql
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+
+my ($db_host, $db_name, $db_user, $db_pw); # Database details
+my @files;                                 # Files of interest
+
+GetOptions(
+    'dbhost=s' => \$db_host, # Database host name
+    'dbname=s' => \$db_name, # Database name
+    'dbuser=s' => \$db_user, # Database user
+    'dbpass=s' => \$db_pw, # Database p/w
+    'file=s' => \@files,  # Files of interest
+    ) or die "Unable to parse arguments.\n";
+die "Unknown option: @ARGV\n" if @ARGV;
+die "Required options: --dbhost --dbname --dbuser --dbpass --file\n"
+    unless defined $db_host
+    and defined $db_name
+    and defined $db_user
+    and defined $db_pw
+    and scalar @files > 0;
+
+
+# Database connection
+my $db = DBI->connect( "DBI:mysql:database=$db_name;host=$db_host;mysql_socket=" . DB_SOCKET(),
+                       $db_user,
+                       $db_pw,
+                       { RaiseError => 1, AutoCommit => 1 }
+                       ) or die "Unable to connect to database: $DBI::errstr";
+
+foreach my $file (@files) {
+    my $sql = "SELECT CONCAT('neb://any/', ext_id) FROM storage_object JOIN instance USING(so_id) WHERE uri = 'file://$file'";
+    my $results = $db->selectcol_arrayref( $sql ) or die "Unable to execute SQL: $DBI::errstr";
+    print "$$results[0]\n";
+}
