Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33297)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h	(revision 33298)
@@ -151,5 +151,6 @@
 double AreaXmin, AreaXmax, AreaYmin, AreaYmax;
 
-int ImagSelect, ImagMin, ImagMax;
+int ImagSelect;
+double ImagMin, ImagMax;
 
 int DophotSelect, DophotValue;
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c	(revision 33297)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c	(revision 33298)
@@ -302,4 +302,5 @@
 
   int N;
+  double trange;
 
   // by definition, the client is not parallel 
@@ -307,9 +308,4 @@
   PARALLEL_MANUAL = FALSE;
   PARALLEL_SERIAL = FALSE;
-
-  if ((N = get_argument (argc, argv, "-v"))) {
-    VERBOSE = TRUE;
-    remove_argument (N, &argc, argv);
-  }
 
   HOST_ID = 0;
@@ -382,4 +378,96 @@
   }
 
+  VERBOSE = VERBOSE2 = FALSE;
+  if ((N = get_argument (argc, argv, "-v"))) {
+    VERBOSE = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+  if ((N = get_argument (argc, argv, "-vv"))) {
+    VERBOSE2 = VERBOSE = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  RESET = FALSE;
+  if ((N = get_argument (argc, argv, "-reset"))) {
+    remove_argument (N, &argc, argv);
+    RESET = TRUE;
+  }
+
+  /* define time */
+  TimeSelect = FALSE;
+  if ((N = get_argument (argc, argv, "-time"))) {
+    remove_argument (N, &argc, argv);
+    if (!ohana_str_to_time (argv[N], &TSTART)) { 
+      fprintf (stderr, "ERROR: syntax error\n");
+      return (FALSE);
+    }
+    remove_argument (N, &argc, argv);
+    if (!ohana_str_to_dtime (argv[N], &trange)) { 
+      if (!ohana_str_to_time (argv[N], &TSTOP)) { 
+	fprintf (stderr, "ERROR: syntax error\n");
+	return (FALSE);
+      }
+    } else {
+      if (trange < 0) {
+	trange = fabs (trange);
+	TSTOP = TSTART;
+	TSTART -= trange;
+      } else {
+	TSTOP = TSTART + trange;
+      }
+    }
+    remove_argument (N, &argc, argv);
+    TimeSelect = TRUE;
+  }
+
+
+  MIN_ERROR = 0.001;
+  if ((N = get_argument (argc, argv, "-minerror"))) {
+    remove_argument (N, &argc, argv);
+    MIN_ERROR = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    /* require MIN_ERROR > 0 */
+  }  
+
+  AreaSelect = FALSE;
+  if ((N = get_argument (argc, argv, "-area"))) {
+    remove_argument (N, &argc, argv);
+    AreaXmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    AreaXmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    AreaYmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    AreaYmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    AreaSelect = TRUE;
+  }
+
+  ImagSelect = FALSE;
+  if ((N = get_argument (argc, argv, "-instmag"))) {
+    remove_argument (N, &argc, argv);
+    ImagMin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    ImagMax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    ImagSelect = TRUE;
+  }
+
+  DophotSelect = FALSE;
+  if ((N = get_argument (argc, argv, "-dophot"))) {
+    remove_argument (N, &argc, argv);
+    DophotValue = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    DophotSelect = TRUE;
+  }
+
+  MaxDensityUse = FALSE;
+  if ((N = get_argument (argc, argv, "-max-density"))) {
+    remove_argument (N, &argc, argv);
+    MaxDensityValue = atof(argv[N]);
+    remove_argument (N, &argc, argv);
+    MaxDensityUse = TRUE;
+  }
+
   if (argc != 2) relphot_client_usage ();
 
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 33297)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c	(revision 33298)
@@ -101,4 +101,8 @@
   // load the list of hosts
   HostTable *table = HostTableLoad (CATDIR, sky->hosts);
+  if (!table) {
+    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
+    exit (1);
+  }    
 
   int i;
@@ -108,7 +112,34 @@
     snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname);
 
+    // options / arguments that can affect relphot_client -load:
+    // VERBOSE, VERBOSE2
+    // RESET (-reset)
+    // TimeSelect -time
+    // DophotSelect
+    // (note that psfQual is applied rigidly at 0.85, as is the galaxy test)
+    // MAG_LIM
+    // SIGMA_LIM
+    // ImagSelect, ImagMin, ImagMax
+    // MaxDensityUse, MaxDensityValue
+
     char command[1024];
-    snprintf (command, 1024, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s", 
-	      PhotcodeList, catalogFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname);
+    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);
+
+    char tmpline[1024];
+    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
+    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     strcpy (command, tmpline); }
+    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     strcpy (command, tmpline); }
+    if (DophotSelect)  { snprintf (tmpline, 1024, "%s -dophot %d",      command, DophotValue);       strcpy (command, tmpline); }
+    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  strcpy (command, tmpline); }
+    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   strcpy (command, tmpline); }
+    if (TimeSelect) { 
+      char *tstart = ohana_sec_to_date (TSTART);
+      char *tstop  = ohana_sec_to_date (TSTOP);
+      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop); 
+      free (tstart);
+      free (tstop);
+      strcpy (command, tmpline); 
+    }
 
     fprintf (stderr, "command: %s\n", command);
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 33297)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c	(revision 33298)
@@ -134,6 +134,29 @@
 
     char command[1024];
-    snprintf (command, 1024, "relphot_client %s -update %s -hostID %d -D CATDIR %s -hostdir %s", 
-	      PhotcodeList, imageFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname);
+    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);
+
+    // options & configs which affect relphot_client -update 
+    // VERBOSE, VERBOSE2
+    // RESET
+    // TimeSelect
+    // AreaSelect
+    // STATMODE
+    // STAR_TOOFEW
+    // MIN_ERROR
+    
+    char tmpline[1024];
+    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    			    strcpy (command, tmpline); }
+    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     			    strcpy (command, tmpline); }
+    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     			    strcpy (command, tmpline); }
+    if (AreaSelect)    { snprintf (tmpline, 1024, "%s -area %f %f %f %f", command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
+    if (TimeSelect) { 
+      char *tstart = ohana_sec_to_date (TSTART);
+      char *tstop  = ohana_sec_to_date (TSTOP);
+      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop); 
+      free (tstart);
+      free (tstop);
+      strcpy (command, tmpline); 
+    }
 
     fprintf (stderr, "command: %s\n", command);
