Index: trunk/Ohana/src/libautocode/def/lensing-ps1-v5.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensing-ps1-v5.d	(revision 37334)
+++ trunk/Ohana/src/libautocode/def/lensing-ps1-v5.d	(revision 37356)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_LENSING_PS1_V5
 TYPE         BINTABLE
-SIZE         128
+SIZE         136
 DESCRIPTION  DVO Lensing Table 
 
@@ -44,4 +44,7 @@
 FIELD  averef,         AVE_REF,      unsigned int,   reference to average entry      
 
+FIELD imageID,	       IMAGE_ID,     unsigned int,   reference to DVO image ID
+FIELD padding,	       PADDING,      unsigned int,   reference to DVO image ID
+
 # 28 x float
 # 4 x int
Index: trunk/Ohana/src/libautocode/def/lensing.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensing.d	(revision 37334)
+++ trunk/Ohana/src/libautocode/def/lensing.d	(revision 37356)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_LENSING
 TYPE         BINTABLE
-SIZE         128
+SIZE         136
 DESCRIPTION  DVO Lensing Table 
 
@@ -39,11 +39,14 @@
 FIELD fF_ApR6,       FLUX_AP_R6,     float,          Flux inside r = 6
 
-FIELD   detID,          DET_ID,       unsigned int,   detection ID
-FIELD   objID,          OBJ_ID,       unsigned int,   unique ID for object in table
-FIELD   catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
-FIELD  averef,         AVE_REF,       unsigned int,   reference to average entry      
+FIELD   detID,          DET_ID,      int,   	     detection ID
+FIELD   objID,          OBJ_ID,      int,   	     unique ID for object in table
+FIELD   catID,          CAT_ID,      int,   	     unique ID for table in which object was first realized
+FIELD  averef,         AVE_REF,      int,   	     reference to average entry      
+
+FIELD imageID,	       IMAGE_ID,     int,   	     reference to DVO image ID
+FIELD padding,	       PADDING,      int,   	     padding
 
 # 28 x float
-# 4 x int
-# = 128 bytes / detection
+# 5 x int + padding
+# = 136 bytes / detection
 # for 2.5G objects + 60 overlaps, expect 15TB for forced warp
Index: trunk/Ohana/src/libautocode/def/lensobj-ps1-v5.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensobj-ps1-v5.d	(revision 37334)
+++ trunk/Ohana/src/libautocode/def/lensobj-ps1-v5.d	(revision 37356)
@@ -43,7 +43,8 @@
 FIELD     E2,               E2,      float
 
-FIELD  objID,          OBJ_ID,       unsigned int,   unique ID for object in table
-FIELD  catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
-FIELD    pad,             PAD,       int
+FIELD    objID,          OBJ_ID,       unsigned int,   unique ID for object in table
+FIELD    catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
+FIELD photcode,         PHOTCODE,    short
+FIELD    Nmeas,            NMEAS,    short
 
 # 31 x float
Index: trunk/Ohana/src/libautocode/def/lensobj.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensobj.d	(revision 37334)
+++ trunk/Ohana/src/libautocode/def/lensobj.d	(revision 37356)
@@ -29,21 +29,22 @@
 FIELD  E2_sh_psf,      E2_SH_PSF,    float,          mean lensing shear psf stars E2
 
-FIELD F_ApR5,        FLUX_AP_R5,     float,          Flux inside r = 5
-FIELD dF_ApR5,       FLUX_ERR_AP_R5, float,          Flux inside r = 5
-FIELD sF_ApR5,       FLUX_STD_AP_R5, float,          Flux inside r = 5
-FIELD fF_ApR5,       FLUX_FIL_AP_R5, float,          Flux inside r = 5
+FIELD     F_ApR5,    FLUX_AP_R5,     float,          Flux inside r = 5
+FIELD    dF_ApR5,    FLUX_ERR_AP_R5, float,          Flux inside r = 5
+FIELD    sF_ApR5,    FLUX_STD_AP_R5, float,          Flux inside r = 5
+FIELD    fF_ApR5,    FLUX_FIL_AP_R5, float,          Flux inside r = 5
 
-FIELD F_ApR6,        FLUX_AP_R6,     float,          Flux inside r = 5
-FIELD dF_ApR6,       FLUX_ERR_AP_R6, float,          Flux inside r = 5
-FIELD sF_ApR6,       FLUX_AP_R6,     float,          Flux inside r = 5
-FIELD fF_ApR6,       FLUX_AP_R6,     float,          Flux inside r = 5
+FIELD     F_ApR6,    FLUX_AP_R6,     float,          Flux inside r = 5
+FIELD    dF_ApR6,    FLUX_ERR_AP_R6, float,          Flux inside r = 5
+FIELD    sF_ApR6,    FLUX_AP_R6,     float,          Flux inside r = 5
+FIELD    fF_ApR6,    FLUX_AP_R6,     float,          Flux inside r = 5
 
-FIELD  gamma,            GAMMA,      float
-FIELD     E1,               E1,      float
-FIELD     E2,               E2,      float
+FIELD      gamma,        GAMMA,      float
+FIELD         E1,           E1,      float
+FIELD         E2,           E2,      float
 
-FIELD  objID,          OBJ_ID,       unsigned int,   unique ID for object in table
-FIELD  catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
-FIELD    pad,             PAD,       int
+FIELD    objID,           OBJ_ID,    unsigned int,   unique ID for object in table
+FIELD    catID,           CAT_ID,    unsigned int,   unique ID for table in which object was first realized
+FIELD photcode,         PHOTCODE,    short
+FIELD    Nmeas,            NMEAS,    short
 
 # 31 x float
Index: trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- trunk/Ohana/src/libdvo/include/dvo.h	(revision 37334)
+++ trunk/Ohana/src/libdvo/include/dvo.h	(revision 37356)
@@ -1039,5 +1039,5 @@
 
 void dvo_lensing_init (Lensing *lensing);
-void dvo_lensobj_init (Lensobj *lensobj);
+void dvo_lensobj_init (Lensobj *lensobj, int toZero);
 
 void InitRegionHosts (RegionHostInfo *hosts, int Nhosts, int NHOSTS);
Index: trunk/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37334)
+++ trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37356)
@@ -389,41 +389,39 @@
   lensing->catID = -1;
   lensing->averef = 0;
+
+  lensing->imageID = -1;
+  lensing->padding = 0;
 }
 
 // init all data, or just catalog data
-void dvo_lensobj_init (Lensobj *lensobj) {
-  lensobj->X11_sm_obj = NAN;
-  lensobj->X12_sm_obj = NAN;
-  lensobj->X22_sm_obj = NAN;
-  lensobj->E1_sm_obj  = NAN;
-  lensobj->E2_sm_obj  = NAN;
-
-  lensobj->X11_sh_obj = NAN;
-  lensobj->X12_sh_obj = NAN;
-  lensobj->X22_sh_obj = NAN;
-  lensobj->E1_sh_obj  = NAN;
-  lensobj->E2_sh_obj  = NAN;
-
-  lensobj->X11_sm_psf = NAN;
-  lensobj->X12_sm_psf = NAN;
-  lensobj->X22_sm_psf = NAN;
-  lensobj->E1_sm_psf  = NAN;
-  lensobj->E2_sm_psf  = NAN;
-
-  lensobj->X11_sh_psf = NAN;
-  lensobj->X12_sh_psf = NAN;
-  lensobj->X22_sh_psf = NAN;
-  lensobj->E1_sh_psf  = NAN;
-  lensobj->E2_sh_psf  = NAN;
-
-  lensobj->F_ApR5     = NAN;
-  lensobj->dF_ApR5    = NAN;
-  lensobj->sF_ApR5    = NAN;
-  lensobj->fF_ApR5    = NAN;
-
-  lensobj->F_ApR6     = NAN;
-  lensobj->dF_ApR6    = NAN;
-  lensobj->sF_ApR6    = NAN;
-  lensobj->fF_ApR6    = NAN;
+void dvo_lensobj_init (Lensobj *lensobj, int toZero) {
+  lensobj->X11_sm_obj = toZero ? 0 : NAN;
+  lensobj->X12_sm_obj = toZero ? 0 : NAN;
+  lensobj->X22_sm_obj = toZero ? 0 : NAN;
+  lensobj->E1_sm_obj  = toZero ? 0 : NAN;
+  lensobj->E2_sm_obj  = toZero ? 0 : NAN;
+  lensobj->X11_sh_obj = toZero ? 0 : NAN;
+  lensobj->X12_sh_obj = toZero ? 0 : NAN;
+  lensobj->X22_sh_obj = toZero ? 0 : NAN;
+  lensobj->E1_sh_obj  = toZero ? 0 : NAN;
+  lensobj->E2_sh_obj  = toZero ? 0 : NAN;
+  lensobj->X11_sm_psf = toZero ? 0 : NAN;
+  lensobj->X12_sm_psf = toZero ? 0 : NAN;
+  lensobj->X22_sm_psf = toZero ? 0 : NAN;
+  lensobj->E1_sm_psf  = toZero ? 0 : NAN;
+  lensobj->E2_sm_psf  = toZero ? 0 : NAN;
+  lensobj->X11_sh_psf = toZero ? 0 : NAN;
+  lensobj->X12_sh_psf = toZero ? 0 : NAN;
+  lensobj->X22_sh_psf = toZero ? 0 : NAN;
+  lensobj->E1_sh_psf  = toZero ? 0 : NAN;
+  lensobj->E2_sh_psf  = toZero ? 0 : NAN;
+  lensobj->F_ApR5     = toZero ? 0 : NAN;
+  lensobj->dF_ApR5    = toZero ? 0 : NAN;
+  lensobj->sF_ApR5    = toZero ? 0 : NAN;
+  lensobj->fF_ApR5    = toZero ? 0 : NAN;
+  lensobj->F_ApR6     = toZero ? 0 : NAN;
+  lensobj->dF_ApR6    = toZero ? 0 : NAN;
+  lensobj->sF_ApR6    = toZero ? 0 : NAN;
+  lensobj->fF_ApR6    = toZero ? 0 : NAN;
 
   lensobj->gamma = NAN;
@@ -434,5 +432,6 @@
   lensobj->catID = -1;
 
-  lensobj->pad = 0;
+  lensobj->photcode = 0;
+  lensobj->Nmeas = 0;
 }
 
Index: trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37334)
+++ trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37356)
@@ -491,4 +491,6 @@
 
     out[i].averef      = in[i].averef;
+
+    out[i].imageID     = in[i].imageID;
   }
   return (out);
@@ -543,4 +545,5 @@
 
     out[i].averef      = in[i].averef;
+    out[i].imageID     = in[i].imageID;
   }
   return (out);
@@ -555,5 +558,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_lensobj_init (&out[i]);
+    dvo_lensobj_init (&out[i], FALSE);
 
     out[i].X11_sm_obj  = in[i].X11_sm_obj;      
@@ -598,4 +601,6 @@
     out[i].catID       = in[i].catID;
 
+    out[i].photcode    = in[i].photcode;
+    out[i].Nmeas       = in[i].Nmeas;
   }
   return (out);
@@ -651,4 +656,7 @@
     out[i].objID       = in[i].objID;
     out[i].catID       = in[i].catID;
+
+    out[i].photcode    = in[i].photcode;
+    out[i].Nmeas       = in[i].Nmeas;
   }
   return (out);
Index: trunk/Ohana/src/libohana/include/ohana.h
===================================================================
--- trunk/Ohana/src/libohana/include/ohana.h	(revision 37334)
+++ trunk/Ohana/src/libohana/include/ohana.h	(revision 37356)
@@ -192,5 +192,5 @@
 
 # ifndef isfinite
-# define isfinite(A) (!isnan(A))
+# define isfinite(A) (!isnan(A) && !isinf(A))
 # endif
 
