Index: /branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/skyregion_ops.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/skyregion_ops.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/skyregion_ops.c	(revision 34873)
@@ -11,5 +11,5 @@
 char *filebasename_ptr (char *name) {
  
-  char *c, *file;
+  char *c;
 
   c = strrchr (name, '/');
@@ -21,6 +21,5 @@
 SkyList *SkyRegionByCPT (SkyTable *table, char *filename) {
   
-  int i, Ns, Ne, No;
-  SkyRegion *region;
+  int i;
   SkyList *list;
 
@@ -44,12 +43,16 @@
 
   for (i = 0; i < table[0].Nregions; i++) {
-    char *regbase = filebasename_ptr (table[0].region[i].name);
+    char *regbase = filebasename_ptr (table[0].regions[i].name);
     if (strncmp (regbase, tgtbase, Ntgtbase)) continue;
 
-    list[0].regions[0] = &table[0].region[i];
+    list[0].regions[0] = &table[0].regions[i];
     list[0].filename[0] = table[0].filename[i];
     list[0].Nregions = 1;
     return (list);
   }
+  
+  free (list[0].regions);
+  free (list[0].filename);
+  free (list);
   return NULL;
 }
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h	(revision 34873)
@@ -23,4 +23,5 @@
 int          PARALLEL_SERIAL;
 char        *UPDATE_CATFORMAT;
+char        *SINGLE_CPT;
 
 SkyRegion    UserPatch;
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot.h
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot.h	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot.h	(revision 34873)
@@ -25,4 +25,5 @@
 char        *HOSTDIR;
 char        *IMAGES;
+char        *SINGLE_CPT;
 int          VERBOSE;
 int          RESET;
@@ -34,4 +35,6 @@
 int          PARALLEL_SERIAL;
 int          IMAGES_ONLY;
+
+SkyRegion    UserPatch;
 
 /***** prototypes ****/
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot_client.h
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot_client.h	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setphot_client.h	(revision 34873)
@@ -78,4 +78,6 @@
 time_t 	     TSTOP;
 PhotCode    *photcode;
+
+SkyRegion    UserPatch;
 
 enum {black, white, red, orange, yellow, green, blue, indigo, violet};
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setposangle.h
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setposangle.h	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setposangle.h	(revision 34873)
@@ -25,4 +25,5 @@
 char        *HOSTDIR;
 char        *IMAGES;
+char        *SINGLE_CPT;
 int          VERBOSE;
 int          RESET;
@@ -31,4 +32,6 @@
 int          PARALLEL_MANUAL;
 int          PARALLEL_SERIAL;
+
+SkyRegion    UserPatch;
 
 /***** prototypes ****/
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c	(revision 34873)
@@ -49,4 +49,11 @@
   int N;
 
+  SINGLE_CPT = NULL;
+  if ((N = get_argument (argc, argv, "-cpt"))) {
+    remove_argument (N, &argc, argv);
+    SINGLE_CPT = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   /* specify portion of the sky : allow default of all sky? */
   UserPatch.Rmin = 0;
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot.c	(revision 34873)
@@ -49,4 +49,28 @@
   if ((N = get_argument (argc, argv, "-reset"))) {
     RESET = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  SINGLE_CPT = NULL;
+  if ((N = get_argument (argc, argv, "-cpt"))) {
+    remove_argument (N, &argc, argv);
+    SINGLE_CPT = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
+  // region of interest
+  UserPatch.Rmin = 0;
+  UserPatch.Rmax = 360;
+  UserPatch.Dmin = -90;
+  UserPatch.Dmax = +90;
+  if ((N = get_argument (argc, argv, "-region"))) {
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmax = atof (argv[N]);
     remove_argument (N, &argc, argv);
   }
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot_client.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setphot_client.c	(revision 34873)
@@ -36,4 +36,21 @@
   if ((N = get_argument (argc, argv, "-reset"))) {
     RESET = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  // region of interest
+  UserPatch.Rmin = 0;
+  UserPatch.Rmax = 360;
+  UserPatch.Dmin = -90;
+  UserPatch.Dmax = +90;
+  if ((N = get_argument (argc, argv, "-region"))) {
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmax = atof (argv[N]);
     remove_argument (N, &argc, argv);
   }
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setposangle.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setposangle.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setposangle.c	(revision 34873)
@@ -170,4 +170,21 @@
   }
 
+  // region of interest
+  UserPatch.Rmin = 0;
+  UserPatch.Rmax = 360;
+  UserPatch.Dmin = -90;
+  UserPatch.Dmax = +90;
+  if ((N = get_argument (argc, argv, "-region"))) {
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Rmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmin = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+    UserPatch.Dmax = atof (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   HOST_ID = 0;
   if ((N = get_argument (argc, argv, "-hostID"))) {
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setastrom.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setastrom.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setastrom.c	(revision 34873)
@@ -20,5 +20,10 @@
 
   // determine the populated SkyRegions overlapping the requested area (default depth)
-  skylist = SkyListByPatch (sky, -1, &UserPatch);
+  if (SINGLE_CPT) {
+      skylist = SkyRegionByCPT (sky, SINGLE_CPT);
+  } else {
+      skylist = SkyListByPatch (sky, -1, &UserPatch);
+  }
+  myAssert (skylist, "ooops!");
 
   // update measurements for each populated catalog
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setphot.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setphot.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setphot.c	(revision 34873)
@@ -4,5 +4,4 @@
 int update_dvo_setphot (Image *image, off_t Nimage, FlatCorrectionTable *flatcorr) {
 
-  SkyRegion UserPatch;
   SkyTable *sky = NULL;
   SkyList *skylist = NULL;
@@ -34,9 +33,10 @@
 
   // determine the populated SkyRegions overlapping the requested area (default depth)
-  UserPatch.Rmin = 0;
-  UserPatch.Rmax = 360;
-  UserPatch.Dmin = -90;
-  UserPatch.Dmax = +90;
-  skylist = SkyListByPatch (sky, -1, &UserPatch);
+  if (SINGLE_CPT) {
+      skylist = SkyRegionByCPT (sky, SINGLE_CPT);
+  } else {
+      skylist = SkyListByPatch (sky, -1, &UserPatch);
+  }
+  myAssert (skylist, "ooops!");
 
   // update measurements for each populated catalog
@@ -110,6 +110,7 @@
 
     char command[1024];
-    snprintf (command, 1024, "setphot_client -hostID %d -catdir %s -hostdir %s -images %s", 
-	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile);
+    snprintf (command, 1024, "setphot_client -hostID %d -catdir %s -hostdir %s -images %s -region %f %f %f %f", 
+	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile, 
+	      UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
 
     fprintf (stderr, "command: %s\n", command);
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setposangle.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setposangle.c	(revision 34872)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/update_dvo_setposangle.c	(revision 34873)
@@ -3,5 +3,4 @@
 int update_dvo_setposangle (ImageSubset *image, off_t Nimage) {
 
-  SkyRegion UserPatch;
   SkyTable *sky = NULL;
   SkyList *skylist = NULL;
@@ -36,8 +35,8 @@
 
   // determine the populated SkyRegions overlapping the requested area (default depth)
-  if (!SINGLE_CPT) {
+  if (SINGLE_CPT) {
+      skylist = SkyRegionByCPT (sky, SINGLE_CPT);
+  } else {
       skylist = SkyListByPatch (sky, -1, &UserPatch);
-  } else {
-      skylist = SkyListByCPT (sky, cptname);
   }
   myAssert (skylist, "ooops!");
@@ -114,6 +113,7 @@
 
     char command[1024];
-    snprintf (command, 1024, "setposangle_client -hostID %d -catdir %s -hostdir %s -images %s -region STUFF", 
-	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile);
+    snprintf (command, 1024, "setposangle_client -hostID %d -catdir %s -hostdir %s -images %s -region %f %f %f %f", 
+	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile, 
+	      UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
 
     fprintf (stderr, "command: %s\n", command);
