Index: /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot_client.c	(revision 33229)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot_client.c	(revision 33230)
@@ -24,5 +24,5 @@
   FlatCorrectionTable *flatcorrTable = FlatCorrectionLoad (flatcorrFile);
 
-  update_setphot(image, Nimage, flatcorrTable);
+  update_dvo_setphot_client (image, Nimage, flatcorrTable);
 
   exit (0);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot_client.c	(revision 33230)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot_client.c	(revision 33230)
@@ -0,0 +1,43 @@
+# include "uniphot.h"
+# include <glob.h>
+
+void update_catalog_setphot_client (Catalog *catalog, Image *image, off_t *index, off_t Nimage, FlatCorrectionTable *flatcorr) {
+
+  off_t i, j, found;
+
+  found = 0;    
+  for (i = 0; i < catalog[0].Naverage; i++) {
+
+    off_t m = catalog[0].average[i].measureOffset;
+    for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
+      off_t idx = catalog[0].measure[m].imageID;
+      if (idx <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode)
+
+      off_t id = index[idx];
+      float Mcal = image[id].Mcal;
+      float dMcal = image[id].dMcal;
+      float Mcal_offset = 0.0;
+
+      // if we know about a flat-field correction, then we need to apply the sub-chip correction
+      int flat_id = image[id].photom_map_id;
+      if (flat_id > 0) {
+	  Mcal_offset = FlatCorrectionOffset (flatcorr, flat_id, catalog[0].measure[m].Xccd, catalog[0].measure[m].Yccd);
+      }
+
+      catalog[0].measure[m].Mcal = Mcal - Mcal_offset;
+      catalog[0].measure[m].dMcal = dMcal;
+
+      // if we are setting the zero points from an UBERCAL database, and this detection is from one of those images,
+      // then tag the measurement as well
+      if (UBERCAL && (image[id].flags & ID_IMAGE_PHOTOM_UBERCAL)) {
+	catalog[0].measure[m].dbFlags |=  ID_MEAS_PHOTOM_UBERCAL;
+      }
+
+      found ++;
+    }
+  }
+
+  if (found) {
+    fprintf (stderr, "found "OFF_T_FMT" matches\n", found);
+  }
+}
Index: /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot_client.c	(revision 33230)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot_client.c	(revision 33230)
@@ -0,0 +1,82 @@
+# include "uniphot.h"
+# include <glob.h>
+
+// we want to load a subset of image data for this operation.  we only need:
+// imageID, photom_map_id, Mcal, dMcal, flags.  
+int update_dvo_setphot_client (Image *image, off_t Nimage, FlatCorrectionTable *flatcorr) {
+
+  SkyRegion UserPatch;
+  SkyTable *sky = NULL;
+  SkyList *skylist = NULL;
+  Catalog catalog;
+  off_t i, maxID, *index;
+
+  // create an index for the image IDs
+  maxID = 0;
+  for (i = 0; i < Nimage; i++) {
+    maxID = MAX(maxID, image[i].imageID);
+  }
+  ALLOCATE (index, off_t, maxID + 1);
+  for (i = 0; i < Nimage; i++) {
+    if (!image[i].imageID) continue; // images with ID == 0 are virtual
+    index[image[i].imageID] = i;
+  }
+
+  // load the current sky table (layout of all SkyRegions) 
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  
+  // load the host table
+  hosts = HostTableLoad ();
+  int hostID = XX;
+  HostInfo *host = XX;
+
+  // 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);
+
+  // update measurements for each populated catalog
+  for (i = 0; i < skylist[0].Nregions; i++) {
+
+    if (hostID != skylist->regions[i]->hostID) continue;
+    if (!(skylist->regions[i]->hostFlags & DATA_ON_TGT)) continue;
+
+    snprintf (localFilename, 1024, "%s/%s.cpt", host->pathname, skylist->regions[i].name);
+
+    // set up the basic catalog info
+    catalog.filename  = localFilename;
+    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;
+    }
+
+    update_catalog_setphot_client (&catalog, image, index, Nimage, flatcorr);
+
+    if (!UPDATE) {
+      dvo_catalog_unlock (&catalog);
+      dvo_catalog_free (&catalog);
+      continue;
+    }
+    
+    if (VERBOSE) fprintf (stderr, "saving catalog %s\n", catalog.filename);
+    
+    dvo_catalog_save (&catalog, VERBOSE); 
+    dvo_catalog_unlock (&catalog);
+    dvo_catalog_free (&catalog);
+  }
+  return (TRUE);
+}      
Index: anches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_setphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_setphot_client.c	(revision 33229)
+++ 	(revision )
@@ -1,123 +1,0 @@
-# include "uniphot.h"
-# include <glob.h>
-
-// we want to load a subset of image data for this operation.  we only need:
-// imageID, photom_map_id, Mcal, dMcal, flags.  
-int update_setphot (Image *image, off_t Nimage, FlatCorrectionTable *flatcorr) {
-
-  SkyRegion UserPatch;
-  SkyTable *sky = NULL;
-  SkyList *skylist = NULL;
-  Catalog catalog;
-  off_t i, maxID, *index;
-
-  // create an index for the image IDs
-  maxID = 0;
-  for (i = 0; i < Nimage; i++) {
-    maxID = MAX(maxID, image[i].imageID);
-  }
-  ALLOCATE (index, off_t, maxID + 1);
-  for (i = 0; i < Nimage; i++) {
-    if (!image[i].imageID) continue; // images with ID == 0 are virtual
-    index[image[i].imageID] = i;
-  }
-
-  // load the current sky table (layout of all SkyRegions) 
-  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
-  SkyTableSetFilenames (sky, CATDIR, "cpt");
-  
-  // load the host table
-  hosts = HostTableLoad ();
-  int hostID = XX;
-  HostInfo *host = XX;
-
-  // 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);
-
-  // update measurements for each populated catalog
-  for (i = 0; i < skylist[0].Nregions; i++) {
-
-    if (hostID != skylist->regions[i]->hostID) continue;
-    if (!(skylist->regions[i]->hostFlags & DATA_ON_TGT)) continue;
-
-    snprintf (localFilename, 1024, "%s/%s.cpt", host->pathname, skylist->regions[i].name);
-
-    // set up the basic catalog info
-    catalog.filename  = localFilename;
-    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;
-    }
-
-    update_catalog_setphot_client (&catalog, image, index, Nimage, flatcorr);
-
-    if (!UPDATE) {
-      dvo_catalog_unlock (&catalog);
-      dvo_catalog_free (&catalog);
-      continue;
-    }
-    
-    if (VERBOSE) fprintf (stderr, "saving catalog %s\n", catalog.filename);
-    
-    dvo_catalog_save (&catalog, VERBOSE); 
-    dvo_catalog_unlock (&catalog);
-    dvo_catalog_free (&catalog);
-  }
-  return (TRUE);
-}      
-
-void update_catalog_setphot_client (Catalog *catalog, Image *image, off_t *index, off_t Nimage, FlatCorrectionTable *flatcorr) {
-
-  off_t i, j, found;
-
-  found = 0;    
-  for (i = 0; i < catalog[0].Naverage; i++) {
-
-    off_t m = catalog[0].average[i].measureOffset;
-    for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
-      off_t idx = catalog[0].measure[m].imageID;
-      if (idx <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode)
-
-      off_t id = index[idx];
-      float Mcal = image[id].Mcal;
-      float dMcal = image[id].dMcal;
-      float Mcal_offset = 0.0;
-
-      // if we know about a flat-field correction, then we need to apply the sub-chip correction
-      int flat_id = image[id].photom_map_id;
-      if (flat_id > 0) {
-	  Mcal_offset = FlatCorrectionOffset (flatcorr, flat_id, catalog[0].measure[m].Xccd, catalog[0].measure[m].Yccd);
-      }
-
-      catalog[0].measure[m].Mcal = Mcal - Mcal_offset;
-      catalog[0].measure[m].dMcal = dMcal;
-
-      // if we are setting the zero points from an UBERCAL database, and this detection is from one of those images,
-      // then tag the measurement as well
-      if (UBERCAL && (image[id].flags & ID_IMAGE_PHOTOM_UBERCAL)) {
-	catalog[0].measure[m].dbFlags |=  ID_MEAS_PHOTOM_UBERCAL;
-      }
-
-      found ++;
-    }
-  }
-
-  if (found) {
-    fprintf (stderr, "found "OFF_T_FMT" matches\n", found);
-  }
-}
