Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33364)
@@ -81,4 +81,5 @@
 char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
 char   CameraConfig[MAX_PATH_LENGTH];
+char   CAMERA[64];    /* eg, gpc1 */
 char   SKY_TABLE[MAX_PATH_LENGTH];
 int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
@@ -256,5 +257,5 @@
 int           reload_catalogs_parallel PROTO((SkyList *sky));
 int           reload_images       PROTO((FITS_DB *db));
-int           setExclusions       PROTO((Catalog *catalog, int Ncatalog));
+int           setExclusions       PROTO((Catalog *catalog, int Ncatalog, int verbose));
 void          setMcal             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
 void          setMcalFinal        PROTO((void));
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c	(revision 33364)
@@ -98,5 +98,5 @@
       measure[i].photcode = photcode[i];
     }
-    fprintf (stderr, "loaded data for %lld measures\n", (long long) Nrow);
+    // fprintf (stderr, "loaded data for %lld measures\n", (long long) Nrow);
 
     free (dR      );
@@ -535,4 +535,5 @@
 
   for (i = 0; i < catalogs->NCATALOG; i++) {
+    dvo_catalog_init (&catalogs->catalog[i], TRUE);
     catalogs->catIDs[i] = 0;
     catalogs->NAVERAGE[i] = 100;
@@ -609,15 +610,15 @@
     if (catalogs->Ncatalog >= catalogs->NCATALOG) {
       catalogs->NCATALOG += 16;
-      fprintf (stderr, "realloc catalogs->catalog: old: %llx  ", (long long) catalogs->catalog);
+      // fprintf (stderr, "realloc catalogs->catalog: old: %llx  ", (long long) catalogs->catalog);
       REALLOCATE (catalogs->catalog, Catalog, catalogs->NCATALOG);
-      fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->catalog, (long long) (catalogs->catalog + sizeof(Catalog)*catalogs->NCATALOG));
-
-      fprintf (stderr, "realloc catalogs->NAVERAGE: old: %llx  ", (long long) catalogs->NAVERAGE);
+      // fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->catalog, (long long) (catalogs->catalog + sizeof(Catalog)*catalogs->NCATALOG));
+
+      // fprintf (stderr, "realloc catalogs->NAVERAGE: old: %llx  ", (long long) catalogs->NAVERAGE);
       REALLOCATE (catalogs->NAVERAGE, off_t,  catalogs->NCATALOG);
-      fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->NAVERAGE, (long long) (catalogs->NAVERAGE + sizeof(off_t)*catalogs->NCATALOG));
-
-      fprintf (stderr, "realloc catalogs->NMEASURE: old: %llx  ", (long long) catalogs->NMEASURE);
+      // fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->NAVERAGE, (long long) (catalogs->NAVERAGE + sizeof(off_t)*catalogs->NCATALOG));
+
+      // fprintf (stderr, "realloc catalogs->NMEASURE: old: %llx  ", (long long) catalogs->NMEASURE);
       REALLOCATE (catalogs->NMEASURE, off_t,  catalogs->NCATALOG);
-      fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->NMEASURE, (long long) (catalogs->NMEASURE + sizeof(off_t)*catalogs->NCATALOG));
+      // fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->NMEASURE, (long long) (catalogs->NMEASURE + sizeof(off_t)*catalogs->NCATALOG));
 
       REALLOCATE (catalogs->catIDs,   int,   catalogs->NCATALOG);
@@ -625,5 +626,5 @@
       int j;
       for (j = catalogs->NCATALOG - 16; j < catalogs->NCATALOG; j++) {
-	// XXX call the catalog init function in libdvo?
+	dvo_catalog_init (&catalogs->catalog[j], TRUE);
 	catalogs->catIDs[j] = 0;
 	catalogs->NAVERAGE[j] = 100;
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ConfigInit.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ConfigInit.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ConfigInit.c	(revision 33364)
@@ -40,5 +40,7 @@
   free (tmpcatdir);
 
-  GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
+  GetConfig (config, "CAMERA",                  "%s",  0, CAMERA);
+
+  GetConfig (config, "GSCFILE",                 "%s",  0, GSCFILE);
   ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
   ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageSubset.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageSubset.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageSubset.c	(revision 33364)
@@ -142,5 +142,4 @@
     tzero[i]   = image[i].tzero;
     trate[i]   = image[i].trate;
-    fprintf (stderr, "time: %d, trate: %d\n", image[i].tzero, image[i].trate);
   }
 
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c	(revision 33364)
@@ -697,4 +697,7 @@
       list[n] = pow (10.0, 0.01*Xm);
       dlist[n] = 1;
+      if (list[n] > 100000) {
+	fprintf (stderr, "!");
+      }
       n++;
     }
@@ -733,4 +736,8 @@
 
       dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dM;
+      if (isnan(dM)) continue;
+      if (dM > 100) {
+	fprintf (stderr, ".");
+      }
       list[n] = dM;
       dlist[n] = 1;
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/bcatalog.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/bcatalog.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/bcatalog.c	(revision 33364)
@@ -42,5 +42,5 @@
   off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
   float mag;
-  int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf;
+  int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf, Nnan;
 
   int Nsecfilt = GetPhotcodeNsecfilt ();
@@ -56,5 +56,5 @@
   Nmeasure = Naverage = 0;
 
-  Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = 0;
+  Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = Nnan = 0;
 
   // copy the following fields to the subcatalog:
@@ -83,4 +83,5 @@
 	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].M  = NAN;
 	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].dM = NAN;
+	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].Xm = NAN_S_SHORT;
 	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~ID_STAR_FEW;
 	subcatalog[0].secfilt[Nsecfilt*Naverage+Nsec].flags &= ~ID_STAR_POOR;
@@ -117,4 +118,5 @@
       // skip garbage measurements
       if (catalog[0].measure[offset].psfQual < 0.85) { Npsfqf ++; continue; }
+      if (isnan(catalog[0].measure[offset].M)) { Nnan ++; continue; }
 
       // check for galaxies
@@ -196,6 +198,6 @@
     fprintf (stderr, "using "OFF_T_FMT" stars ("OFF_T_FMT" measures) of "OFF_T_FMT" for catalog %s\n", 
 	     subcatalog[0].Naverage,  subcatalog[0].Nmeasure,  i, catalog[0].filename);
-    fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few, %d psfqf, %d galaxies\n", 
-	     Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Npsfqf, Ngalaxy);
+    fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few, %d psfqf, %d Nnan, %d galaxies\n", 
+	     Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Npsfqf, Nnan, Ngalaxy);
   }
   return (TRUE);
@@ -269,4 +271,7 @@
       tmpcatalog.measureT[Nmeasure].averef = i;
       Nmeasure ++;
+    }
+    for (j = 0; j < Nsecfilt; j++) {
+      tmpcatalog.secfilt[i*Nsecfilt + j] = subcatalog[0].secfilt[ave*Nsecfilt + j];
     }
   }
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c	(revision 33364)
@@ -132,6 +132,6 @@
 
     char command[1024];
-    snprintf (command, 1024, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D MAG_LIM %f -D SIGMA_LIM %f", 
-	      PhotcodeList, catalogFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, MAG_LIM, SIGMA_LIM);
+    snprintf (command, 1024, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f", 
+	      PhotcodeList, catalogFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA, MAG_LIM, SIGMA_LIM);
 
     char tmpline[1024];
@@ -210,4 +210,13 @@
   BrightCatalogSplitFree (catalogs);
 
+  int Nmeasure = 0;
+  int Naverage = 0;
+  for (i = 0; i < catalogs->Ncatalog; i++) {
+    Nmeasure += catalogs->catalog[i].Nmeasure;
+    Naverage += catalogs->catalog[i].Naverage;
+  }
+
+  fprintf (stderr, "loaded %d catalogs, using a total of %d stars (%d measures)\n", catalogs->Ncatalog, Naverage, Nmeasure);
+
   return (catalog);
 }      
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c	(revision 33364)
@@ -139,6 +139,6 @@
 
     char command[1024];
-    snprintf (command, 1024, "relphot_client %s -update %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D STAR_TOOFEW %d -minerror %f", 
-	      PhotcodeList, imageFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, STAR_TOOFEW, MIN_ERROR);
+    snprintf (command, 1024, "relphot_client %s -update %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f", 
+	      PhotcodeList, imageFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR);
 
     // options & configs which affect relphot_client -update 
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c	(revision 33364)
@@ -88,5 +88,5 @@
   SAVEPLOT = FALSE;
 
-  setExclusions (catalog, Ncatalog);
+  setExclusions (catalog, Ncatalog, TRUE);
 
   global_stats (catalog, Ncatalog, flatcorr);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setExclusions.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setExclusions.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setExclusions.c	(revision 33364)
@@ -6,5 +6,5 @@
 // and uses the bits read from disk as the test
 
-int setExclusions (Catalog *catalog, int Ncatalog) {
+int setExclusions (Catalog *catalog, int Ncatalog, int verbose) {
 
   off_t i, j, k, m, Narea, Nnocal, Ngood;
@@ -59,7 +59,7 @@
     }
   }
-  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);
+  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/eam_branches/ipp-20111122/Ohana/src/relphot/src/setMrelFinal.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setMrelFinal.c	(revision 33363)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setMrelFinal.c	(revision 33364)
@@ -51,5 +51,5 @@
 
   // this sets flags in the measureT element, not the measure element
-  setExclusions (catalog, 1);  /* mark by area */
+  setExclusions (catalog, 1, VERBOSE);  /* mark by area */
 
   /* set catalog[0].found[i] = FALSE */
