Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvo.h	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvo.h	(revision 37110)
@@ -128,5 +128,5 @@
   ID_MEAS_BLEND_MEAS     = 0x00000100,  // detection is within radius of multiple objects 
   ID_MEAS_BLEND_OBJ      = 0x00000200,  // multiple detections within radius of object 
-  ID_MEAS_UNDEF_3        = 0x00000400,  // unused 
+  ID_MEAS_WARP_USED      = 0x00000400,  // measurement used to find mean warp photometry
   ID_MEAS_UNDEF_4        = 0x00000800,  // unused 
   ID_MEAS_BLEND_MEAS_X   = 0x00001000,  // detection is within radius of multiple objects across catalogs		     
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvodb.h
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvodb.h	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvodb.h	(revision 37110)
@@ -54,7 +54,9 @@
   MAG_OPTION_NPHOT, // Nused
   MAG_OPTION_UC_DIST, 
-  MAG_OPTION_STACK_DET_ID, 
   MAG_OPTION_FLAGS, 
 } dvoMagOptionType;
+
+//  MAG_OPTION_STACK_PRIMARY_OFF, 
+//  MAG_OPTION_STACK_BEST_OFF, 
 
 typedef enum {
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/TessellationTable.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/TessellationTable.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/TessellationTable.c	(revision 37110)
@@ -560,6 +560,6 @@
     int yi = y / tess[myTess].tree->dY[zone][band];
 
-    xi = MAX(MIN(xi, tess[myTess].NX_SUB - 1.0), 0);
-    yi = MAX(MIN(yi, tess[myTess].NY_SUB - 1.0), 0);
+    xi = MAX(MIN(xi, tess[myTess].tree->NX_SUB - 1.0), 0);
+    yi = MAX(MIN(yi, tess[myTess].tree->NY_SUB - 1.0), 0);
 
     int N = xi + tess[myTess].tree->NX_SUB * yi;
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractAverages.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractAverages.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractAverages.c	(revision 37110)
@@ -306,7 +306,7 @@
 	  value.Flt = PhotUCdist (field->photcode, average, secfilt);
 	  break;
-	case MAG_OPTION_STACK_DET_ID:
-	  value.Int = PhotStackID (field->photcode, average, secfilt);
-	  break;
+	// XX case MAG_OPTION_STACK_DET_ID:
+	// XX   value.Int = PhotStackID (field->photcode, average, secfilt);
+	// XX   break;
 	case MAG_OPTION_FLAGS: {
 	  int Nsec = GetPhotcodeNsec (field->photcode->code);
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractMeasures.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractMeasures.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbExtractMeasures.c	(revision 37110)
@@ -248,5 +248,4 @@
 	case MAG_OPTION_NPHOT:
 	case MAG_OPTION_UC_DIST:
-	case MAG_OPTION_STACK_DET_ID:
 	case MAG_OPTION_FLAGS:
 	case MAG_OPTION_NONE:
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbFields.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbFields.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dbFields.c	(revision 37110)
@@ -78,5 +78,4 @@
   if (!strcasecmp (string, "nphot"))        return (MAG_OPTION_NPHOT);
   if (!strcasecmp (string, "uc_dist"))      return (MAG_OPTION_UC_DIST);
-  if (!strcasecmp (string, "stack_det_id")) return (MAG_OPTION_STACK_DET_ID);
   if (!strcasecmp (string, "flags"))        return (MAG_OPTION_FLAGS);
 
@@ -145,5 +144,4 @@
   if (!strcasecmp (string, "max"))         return (MAG_MAX);
   if (!strcasecmp (string, "ucdist"))      return (MAG_UC_DIST);
-  if (!strcasecmp (string, "stackDetectID")) return (MAG_STACK_DET_ID);
   if (!strcasecmp (string, "fluxpsf"))     return (MAG_FLUX_PSF);
   if (!strcasecmp (string, "fluxpsferr"))  return (MAG_FLUX_PSF_ERR);
@@ -296,5 +294,4 @@
 
   switch (field->magOption) {
-    case MAG_OPTION_STACK_DET_ID:
     case MAG_OPTION_NCODE:
     case MAG_OPTION_NPHOT:
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37110)
@@ -197,5 +197,6 @@
   secfilt->dFapStk     = NAN;
 
-  secfilt->stackDetectID = 0;
+  secfilt->stackPrmryOff = -1;
+  secfilt->stackBestOff  = -1;
 
   secfilt->MpsfWrp     = NAN;
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 37110)
@@ -251,5 +251,6 @@
     out[i].Mstdev        = in[i].Mstdev;      
     out[i].ubercalDist   = in[i].ubercalDist;      
-    out[i].stackDetectID = in[i].stackDetectID;      
+    out[i].stackPrmryOff = in[i].stackPrmryOff;      
+    out[i].stackBestOff  = in[i].stackBestOff;      
  }
   return (out);
@@ -281,5 +282,6 @@
     out[i].Mstdev      	 = in[i].Mstdev;      
     out[i].ubercalDist 	 = in[i].ubercalDist;      
-    out[i].stackDetectID = in[i].stackDetectID;
+    out[i].stackPrmryOff = in[i].stackPrmryOff;      
+    out[i].stackBestOff  = in[i].stackBestOff;      
   }
   return (out);
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37110)
@@ -319,5 +319,6 @@
     out[i].dFapStk       = in[i].dFapStk;
 
-    out[i].stackDetectID = in[i].stackDetectID;      
+    out[i].stackPrmryOff = in[i].stackPrmryOff;      
+    out[i].stackBestOff  = in[i].stackBestOff;      
 
     out[i].MpsfWrp       = in[i].MpsfWrp;
@@ -387,5 +388,6 @@
     out[i].dFapStk       = in[i].dFapStk;
 
-    out[i].stackDetectID = in[i].stackDetectID;      
+    out[i].stackPrmryOff = in[i].stackPrmryOff;      
+    out[i].stackBestOff  = in[i].stackBestOff;      
 
     out[i].MpsfWrp       = in[i].MpsfWrp;
Index: /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_photcode_ops.c
===================================================================
--- /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_photcode_ops.c	(revision 37109)
+++ /branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/dvo_photcode_ops.c	(revision 37110)
@@ -863,15 +863,15 @@
 }
 
-unsigned int PhotStackID (PhotCode *code, Average *average, SecFilt *secfilt) {
-
-  int Ns;
-  unsigned int ID;
-
-  if (code == NULL) return 0;
-
-  Ns = photcodes[0].hashNsec[code[0].code];
-  ID = (Ns == -1) ? 0 : secfilt[Ns].stackDetectID;
-  return (ID);
-}
+// XX unsigned int PhotStackID (PhotCode *code, Average *average, SecFilt *secfilt) {
+// XX 
+// XX   int Ns;
+// XX   unsigned int ID;
+// XX 
+// XX   if (code == NULL) return 0;
+// XX 
+// XX   Ns = photcodes[0].hashNsec[code[0].code];
+// XX   ID = (Ns == -1) ? 0 : secfilt[Ns].stackDetectID;
+// XX   return (ID);
+// XX }
 
 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short
