Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/include/checkastro.h
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/include/checkastro.h	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/include/checkastro.h	(revision 36794)
@@ -83,11 +83,7 @@
 
 float MinBadQF;
-float MaxMeanOffset;
 
 int TimeSelect;
 time_t TSTART, TSTOP;
-
-int FlagOutlier;
-int    CLIP_THRESH;
 
 SkyRegion UserPatch;
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ConfigInit.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ConfigInit.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ConfigInit.c	(revision 36794)
@@ -19,6 +19,7 @@
 
   // set defaults for all of these if they are not used by parallel / remote clients
-  // if (!ScanConfig (config, "RELASTRO_SIGMA_LIM",         "%lf", 0, &SIGMA_LIM))       SIGMA_LIM = 0.01; 
-  
+  if (!ScanConfig (config, "RELASTRO_SIGMA_LIM",         "%lf", 0, &SIGMA_LIM))       SIGMA_LIM = 0.01; 
+  if (!ScanConfig (config, "RELASTRO_SRC_MEAS_TOOFEW",   "%d",  0, &SRC_MEAS_TOOFEW)) SRC_MEAS_TOOFEW = 3;
+
   // force CATDIR to be absolute (so parallel mode will work)
   GetConfig (config, "CATDIR",                 "%s",  0, CATDIR);
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ImageOps.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ImageOps.c	(revision 36794)
@@ -130,4 +130,13 @@
   }
 
+  BuildChipMatch (image, Nimage);
+
+  char output[128];
+  snprintf (output, 128, "checkastrom.%+3.0f.%+3.0f.%03.0f.%03.0f.dat", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
+  FILE *f = fopen (output, "w");
+  if (!f) {
+    fprintf (stderr, "problem opening %s for output\n", output);
+  }
+
   // watch for chips with few stars
   int Nfew = 0;
@@ -139,11 +148,21 @@
     name = GetPhotcodeNamebyCode (image[i].photcode);
 
-    if (VERBOSE2) {
-      char *date = ohana_sec_to_date(image[i].tzero);
-      fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" total and "OFF_T_FMT" ref of %d measures (%s, %s)\n",  
-	       i,  image[i].imageID, image[i].name, N_onImage[i], Nref_onImage[i], image[i].nstar,
-	       date, name);
-      free (date);
-    }
+    off_t myMosaic = FindMosaicForImage (image, Nimage, i);
+
+    /* only check exposure center */
+    double Rexp = NAN, Dexp = NAN, Rccd = NAN, Dccd = NAN;
+
+    if (myMosaic) {
+      myMosaic --;
+      XY_to_RD (&Rccd, &Dccd, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
+      XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &image[myMosaic].coords);
+    }
+
+    char *date = ohana_sec_to_date(image[i].tzero);
+    FILE *outfile = f ? f : stderr;
+    fprintf (outfile, "%d %s : %10.6f %10.6f : %10.6f %10.6f "OFF_T_FMT" "OFF_T_FMT" %d %s %s\n",  
+	     image[i].imageID, image[i].name, Rccd, Dccd, Rexp, Dexp, N_onImage[i], Nref_onImage[i], image[i].nstar,
+	     date, name);
+    free (date);
 
     if (N_onImage[i] < 20) {
@@ -154,4 +173,5 @@
     } 
   }
+  if (f) { fclose (f); }
   fprintf (stderr, OFF_T_FMT" total images, %d with < 20 measurements, %d with < 15\n", Nimage, Nfew, Nbad);
 }
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/args.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/args.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/args.c	(revision 36794)
@@ -189,11 +189,4 @@
   }
 
-  MaxMeanOffset = 10.0;
-  if ((N = get_argument (argc, argv, "-max-mean-offset"))) {
-    remove_argument (N, &argc, argv);
-    MaxMeanOffset = atof (argv[N]);
-    remove_argument (N, &argc, argv);
-  }
-
   if (argc != 1) usage ();
   return TRUE;
@@ -371,31 +364,6 @@
 
 void usage () {
-  fprintf (stderr, "ERROR: USAGE: checkastro -images -update-simple [options]\n");
-  fprintf (stderr, "       OR:    checkastro -images -update-chips [options]\n");
-  fprintf (stderr, "       OR:    checkastro -images -update-mosaic [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-regions -update-simple [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-regions -update-chips [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-regions -update-mosaic [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-images -update-simple [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-images -update-chips [options]\n");
-  fprintf (stderr, "       OR:    checkastro -parallel-images -update-mosaic [options]\n");
-  fprintf (stderr, "       OR:    checkastro -update-objects [options]\n");
-  fprintf (stderr, "       OR:    checkastro -high-speed [options]\n");
-  fprintf (stderr, "       OR:    checkastro -hpm [options]\n");
-  fprintf (stderr, "       OR:    checkastro -merge-source [options]\n\n");
-
-  fprintf (stderr, "  specify one of the following modes: \n");
-  fprintf (stderr, "  -update-objects\n");
-  fprintf (stderr, "    -pm\n");
-  fprintf (stderr, "    -par\n");
-  fprintf (stderr, "    -pmpar\n");
-  fprintf (stderr, "  -update-simple\n");
-  fprintf (stderr, "  -update-chips\n");
-  fprintf (stderr, "  -update-mosaics\n");
-  fprintf (stderr, "  -high-speed (code[,code,code]) (code[,code,code]) (radius) (output catdir)\n");
-  fprintf (stderr, "  -hpm (radius) (output catdir)\n");
-  fprintf (stderr, "  -merge-source (objID) (catID) into (objID) (catID)\n\n");
-
-  fprintf (stderr, " additional options: \n");
+  fprintf (stderr, "ERROR: USAGE: checkastro [options]\n");
+  fprintf (stderr, " options: \n");
   fprintf (stderr, "  -region RA RA DEC DEC\n");
   fprintf (stderr, "  -catalog (ra) (dec)\n\n");
@@ -403,12 +371,7 @@
   fprintf (stderr, "  +photcode (code)[,code,code...]\n");
   fprintf (stderr, "  -photcode (code)[,code,code...]\n");
-  fprintf (stderr, "  -plot\n");
-  fprintf (stderr, "  -plotdelay (seconds)\n");
-  fprintf (stderr, "  -statmode (mode)\n");
-  fprintf (stderr, "  -reset\n");
-  fprintf (stderr, "  -nloop (N) : number of image-fit iterations\n");
-  fprintf (stderr, "  -update : apply new fit to database\n");
-  fprintf (stderr, "  -params\n");
-  fprintf (stderr, "  -plrange\n");
+  fprintf (stderr, "  -reset-to-photcode (code)[,code,code...]\n");
+  fprintf (stderr, "  -max-density (rho)\n");
+  fprintf (stderr, "  -minerror\n");
   fprintf (stderr, "  -minerror\n");
   fprintf (stderr, "  -instmag min max\n\n");
@@ -417,4 +380,8 @@
   fprintf (stderr, "  -photflagpoor\n");
   fprintf (stderr, "  -v\n");
+  fprintf (stderr, "  -vv\n");
+  fprintf (stderr, "  -parallel\n");
+  fprintf (stderr, "  -parallel-manual\n");
+  fprintf (stderr, "  -parallel-serial\n");
   fprintf (stderr, "  \n");
   exit (2);
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/bcatalog.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/bcatalog.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/bcatalog.c	(revision 36794)
@@ -37,8 +37,5 @@
   /* exclude stars not in range or with too few measurements */
   for (i = 0; i < catalog[0].Naverage; i++) {
-    if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) {
-      continue;
-      // XXX can't (easily) count this for a given chip
-    }
+    if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) continue;
     
     /* start with all stars good */
@@ -278,5 +275,6 @@
     
     // if we are resetting to a given photcode, we need to have that photcode...
-    if (NphotcodesReset) {
+    // XXX this is not relevant for the check...
+    if (FALSE && NphotcodesReset) {
       int k;
       int foundReset = FALSE;
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/load_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/load_catalogs.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/load_catalogs.c	(revision 36794)
@@ -128,7 +128,10 @@
     if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     strcpy (command, tmpline); }
+    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   strcpy (command, tmpline); }
+    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  strcpy (command, tmpline); }
 
     if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
     if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
+    if (PHOTCODE_RESET_LIST) { snprintf (tmpline, 1024, "%s -reset-to-photcode %s", command, PHOTCODE_RESET_LIST); strcpy (command, tmpline); }
     if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                     strcpy (command, tmpline); }
     if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);     strcpy (command, tmpline); }
Index: /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/select_images.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/select_images.c	(revision 36793)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/select_images.c	(revision 36794)
@@ -100,11 +100,11 @@
 
     // check that this image is even in range of the searched region
-    if (Dexp - 1.5 > DmaxSkyRegion) continue;
-    if (Dexp + 1.5 < DminSkyRegion) continue;
+    if (Dexp + 1.5 > UserPatch.Dmax) continue;
+    if (Dexp - 1.5 < UserPatch.Dmin) continue;
     
     // the sky region RA is defined to be 0 - 360.0
     if ((Dexp < 88) && (Dexp > -88)) {
-      if (Rexp - 1.5/cos(Dexp*RAD_DEG) > RmaxSkyRegion) continue;
-      if (Rexp + 1.5/cos(Dexp*RAD_DEG) < RminSkyRegion) continue;
+      if (Rexp + 1.5/cos(Dexp*RAD_DEG) > UserPatch.Rmax) continue;
+      if (Rexp - 1.5/cos(Dexp*RAD_DEG) < UserPatch.Rmin) continue;
     }
 
