Index: /branches/eam_branch_20090208/Ohana/src/addstar/src/ReadStarsFITS.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 21493)
@@ -210,5 +210,5 @@
     stars[i].measure.dM         = ps1data[i].dM;
     stars[i].measure.dMcal      = ps1data[i].dMcal;
-    stars[i].measure.Map        = ps1data[i].Map;
+    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
 		        
     stars[i].measure.Sky        = ps1data[i].sky;
Index: /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches.c	(revision 21493)
@@ -156,4 +156,6 @@
       catalog[0].measure[Nmeas].dbFlags  = 0;
       catalog[0].measure[Nmeas].averef   = n; // this must be an absolute sequence number, if partial average is loaded 
+      catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
+      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
       // rationalize dR:
@@ -289,4 +291,6 @@
     catalog[0].measure[Nmeas].dbFlags 	= 0;
     catalog[0].measure[Nmeas].averef   	= Nave; // XXX EAM : must be absolute Nave if partial read
+    catalog[0].measure[Nmeas].objID     = catalog[0].average[Nave].objID;
+    catalog[0].measure[Nmeas].catID     = catalog[0].catID;
 
     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
Index: /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_closest.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_closest.c	(revision 21493)
@@ -173,4 +173,6 @@
     catalog[0].measure[Nmeas].dbFlags  = 0;
     catalog[0].measure[Nmeas].averef   = n;
+    catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
+    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
     // rationalize dR
@@ -287,4 +289,6 @@
     catalog[0].measure[Nmeas].dbFlags  = 0;
     catalog[0].measure[Nmeas].averef   = Nave;
+    catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
+    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
Index: /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_refstars.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/addstar/src/find_matches_refstars.c	(revision 21493)
@@ -165,4 +165,6 @@
       catalog[0].measure[Nmeas].averef   = n;
       catalog[0].measure[Nmeas].dbFlags  = 0;
+      catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
+      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
       catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].measure.t      : TIMEREF; /** careful : time_t vs e_time **/
@@ -289,4 +291,6 @@
       catalog[0].measure[Nmeas].dbFlags  = 0;
       catalog[0].measure[Nmeas].averef   = Nave;
+      catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
+      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
 
       stars[N][0].found = Nmeas;
Index: /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure-ps1-v1.d
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure-ps1-v1.d	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure-ps1-v1.d	(revision 21493)
@@ -29,8 +29,11 @@
 FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
 
-# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+# internally, this is an unsigned int; however, we do NOT convert with TZERO/TSCAL on output
 FIELD detID,          DET_ID,       unsigned int,   detection ID
 FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image 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
 
+# PSPS uses a 64-bit detection ID
 FIELD extID,          EXT_ID,       uint64_t,       external ID (eg PSPS detID)
 
@@ -60,11 +63,13 @@
 FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,          1/100 of pixels
 FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,          1/100 of pixels
+
+FIELD pad,            PAD,          char[6],        padding
+
+# local astrometry scales
 FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
-FIELD pad1,           PAD1,         char[2],        padding
 FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
 
-FIELD pad2,           PAD2,         char[4],        padding
-FIELD dbFlags,        DB_FLAGS,     uint64_t,       flags supplied by analysis in database
-FIELD photFlags,      PHOT_FLAGS,   uint64_t,       flags supplied by photometry program
+FIELD dbFlags,        DB_FLAGS,     unsigned int,   flags supplied by analysis in database
+FIELD photFlags,      PHOT_FLAGS,   unsigned int,   flags supplied by photometry program
 
 
Index: /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure.d
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure.d	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libautocode/def/measure.d	(revision 21493)
@@ -30,7 +30,10 @@
 FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
 
-# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
 FIELD detID,          DET_ID,       unsigned int,   detection ID
 FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image 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
+
+# PSPS uses a 64-bit detection ID
 FIELD extID,          EXT_ID,       uint64_t,       external ID (eg PSPS detID)
 
@@ -56,10 +59,11 @@
 FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,          1/100 of pixels
 FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,          1/100 of pixels
+
 FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
 FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
 
 FIELD photcode,       PHOTCODE,     unsigned short, photcode
-FIELD dbFlags,        DB_FLAGS,     uint64_t,       flags supplied by analysis in database
-FIELD photFlags,      PHOT_FLAGS,   uint64_t,       flags supplied by photometry program
+FIELD dbFlags,        DB_FLAGS,     unsigned int,   flags supplied by analysis in database
+FIELD photFlags,      PHOT_FLAGS,   unsigned int,   flags supplied by photometry program
 
 # *** 20090206 : new fields : t_msec, extID, Mxx, Mxy, Myy, posangle,
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 21493)
@@ -48,4 +48,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 21493)
@@ -45,4 +45,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 21493)
@@ -30,4 +30,6 @@
     out[i].detID      = in[i].detID;
     out[i].imageID    = in[i].imageID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
     out[i].extID      = in[i].extID;
     out[i].psfQual    = in[i].psfQual;
@@ -81,4 +83,6 @@
     out[i].detID      = in[i].detID;
     out[i].imageID    = in[i].imageID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
     out[i].extID      = in[i].extID;
     out[i].psfQual    = in[i].psfQual;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_elixir.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 21493)
@@ -55,4 +55,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_loneos.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 21493)
@@ -57,4 +57,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 21493)
@@ -52,4 +52,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
Index: /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 21492)
+++ /branches/eam_branch_20090208/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 21493)
@@ -52,4 +52,6 @@
     out[i].t_msec     = 0;
     out[i].extID      = 0;
+    out[i].objID      = 0;
+    out[i].catID      = 0;
     out[i].Mxx 	      = 0.0;
     out[i].Mxy 	      = 0.0;
