Index: trunk/Ohana/src/libautocode/def/AddstarClientOptions.d
===================================================================
--- trunk/Ohana/src/libautocode/def/AddstarClientOptions.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/AddstarClientOptions.d	(revision 15038)
@@ -2,5 +2,5 @@
 EXTNAME OPTIONS
 TYPE    BINTABLE
-SIZE    72
+SIZE    76
 
 FIELD     Nsigma,           NSIGMA,               double,         match radius in terms of astrometric error 
@@ -20,2 +20,3 @@
 FIELD  	  photcode,         PHOTCODE,             int,     	  photocode of input data
 FIELD  	  timeref,          TIMEREF,              e_time,  	  time/date of input data (REFLIST only?)
+FIELD  	  imageID,          IMAGE_ID,             unsigned int,   reference to image
Index: trunk/Ohana/src/libautocode/def/Stars.d
===================================================================
--- trunk/Ohana/src/libautocode/def/Stars.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/Stars.d	(revision 15038)
@@ -2,5 +2,5 @@
 EXTNAME STARS
 TYPE    BINTABLE
-SIZE    240
+SIZE    244
 
 FIELD     X,                X,          double,    x coordinate on image,	     pixels
@@ -38,8 +38,10 @@
 FIELD     Mcal,             MCAL,       float,     image cal mag,	             mag
 FIELD     airmass,          AIRMASS,    float,     (airmass - 1),		     airmass
+FIELD     az,     	    AZ,         float,     azimuth
 FIELD     code,             CODE,       short
 FIELD     nFrames,          N_FRAMES,   short
+FIELD     flags,            FLAGS,      short
 FIELD     dophot,           DOPHOT,     char,      dophot type code
-FIELD     dummy,            DUMMY,      char[3]
+FIELD     dummy,            DUMMY,      char
 
 # XXX I'm going to need azimuth (or load from image header?)
Index: trunk/Ohana/src/libautocode/def/autocode.c
===================================================================
--- trunk/Ohana/src/libautocode/def/autocode.c	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/autocode.c	(revision 15038)
@@ -36,4 +36,5 @@
   if ((swapped == NULL) || (*swapped == FALSE)) {
     gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata);
+    gfits_table_scale_data (ftable);
     if (swapped != NULL) *swapped = TRUE;
   }
@@ -57,4 +58,5 @@
 
   /* add data values */
+  gfits_table_scale_data (ftable);
   gfits_convert_$STRUCT (data, sizeof ($STRUCT), Ndata);
   gfits_add_rows (ftable, (char *) data, Ndata, sizeof ($STRUCT));
Index: trunk/Ohana/src/libautocode/def/image-ps1-dev-1.d
===================================================================
--- trunk/Ohana/src/libautocode/def/image-ps1-dev-1.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/image-ps1-dev-1.d	(revision 15038)
@@ -48,9 +48,8 @@
 FIELD 	  code,             CODE,                 char,           image quality flag
 FIELD 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
-FIELD 	  imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
-FIELD 	  imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
-# 48 bytes 
+FIELD 	  imageID,          IMAGE_ID,             unsigned int,   image ID
+# 44 bytes 
 
-FIELD 	  dummy,            DUMMY,                char[10],       unused
+FIELD 	  dummy,            DUMMY,                char[14],       unused
 FIELD 	  order,            ORDER,                short,      	  Mrel 2D polynomical order 
 FIELD 	  Mx,               MX,                   short,      	  Mrel polyterm
Index: trunk/Ohana/src/libautocode/def/image.d
===================================================================
--- trunk/Ohana/src/libautocode/def/image.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/image.d	(revision 15038)
@@ -48,9 +48,8 @@
 FIELD 	  code,             CODE,                 char,           image quality flag
 FIELD 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
-FIELD 	  imageID_hi,       IMAGE_ID_HI,          unsigned int,   ID upper bytes
-FIELD 	  imageID_lo,       IMAGE_ID_LO,          unsigned int,   ID lower bytes
+FIELD 	  imageID,          IMAGE_ID,             unsigned int,   image ID
 # 48 bytes 
 
-FIELD 	  dummy,            DUMMY,                char[10],       unused
+FIELD 	  dummy,            DUMMY,                char[14],       unused
 FIELD 	  order,            ORDER,                short,      	  Mrel 2D polynomical order 
 FIELD 	  Mx,               MX,                   short,      	  Mrel polyterm
Index: trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d
===================================================================
--- trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d	(revision 15038)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_MEASURE_PS1_DEV_1
 TYPE         BINTABLE
-SIZE         96
+SIZE         104
 DESCRIPTION  DVO Detection Measurement Table 
 
@@ -8,11 +8,11 @@
 FIELD dD,             D_DEC,        float,          DEC offset,               	  arcsec
 FIELD M,              MAG,          float,          catalog mag,       	       	  mag
-FIELD Mcal,           Mcal,         float,          image cal mag,	          mag
-FIELD Mgal,           Mgal,         float,          galaxy mag,			  mag
-FIELD dM,             dM,           float,          mag error,                    mag
-FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
+FIELD Mcal,           M_CAL,        float,          image cal mag,	          mag
+FIELD Mgal,           M_GAL,        float,          galaxy mag,			  mag
+FIELD dM,             MAG_ERR,      float,          mag error,                    mag
+FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
 
 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
-FIELD airmass,        airmass,      float,          (airmass - 1),		  airmass
+FIELD airmass,        AIRMASS,      float,          (airmass - 1),		  airmass
 FIELD az,             AZ,           float,          telescope azimuth
 
@@ -25,34 +25,36 @@
 FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
 
-FIELD t,              t,            unsigned int,   time in seconds (UNIX)
-FIELD averef,         averef,       unsigned int,   reference to average entry      
+FIELD t,              TIME,         unsigned int,   time in seconds (UNIX)
+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_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
-FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
+FIELD detID,          DET_ID,       unsigned int,   ID upper bytes
+FIELD imageID,        IMAGE_ID,     unsigned int,   reference to image
 
-FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
-FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
+# do we need more resolution than a short? should this be a log?
+FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
+FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
+FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
+FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
 
-FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec 
-FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec 
-FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
-FIELD photcode,       photcode,     unsigned short, photcode
-
-FIELD flags,          flags,        unsigned short, flags for various uses  
+FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,       1/100 of arcsec 
+FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,       1/100 of arcsec 
+FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,          (0xffff/360) deg
+FIELD photcode,       PHOTCODE,     unsigned short, photcode
 
 FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
 FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
 
-# do we need more resolution than a short? should this be a log?
-FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
+FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses  
+FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
 
-FIELD dophot,         dophot,       char,           dophot type
-FIELD stargal,        stargal,      char,           star-galaxy separator
+FIELD stargal,        STAR_GAL,     char,           star-galaxy separator
 
-# we need extra bytes for padding purposes...
-FIELD dummy,          dummy,        char[2],        padding
+# absorb these into photFlags?
+FIELD dophot,         DOPHOT,       char,           dophot type
 
-# float : 13 x 4 = 52
+FIELD dummy,          DUMMY,        char[2],        padding
+
+# float : 17 x 4 = 68
 # int:     6 x 4 = 24
 # short:   8 x 2 = 16
Index: trunk/Ohana/src/libautocode/def/measure.d
===================================================================
--- trunk/Ohana/src/libautocode/def/measure.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/measure.d	(revision 15038)
@@ -2,5 +2,5 @@
 EXTNAME      DVO_MEASURE
 TYPE         BINTABLE
-SIZE         96
+SIZE         104
 DESCRIPTION  DVO Detection Measurement Table 
 
@@ -11,18 +11,9 @@
 FIELD Mgal,           Mgal,         float,          galaxy mag,			  mag
 FIELD dM,             dM,           float,          mag error,                    mag
-FIELD airmass,        airmass,      float,          (airmass - 1),		  airmass
 FIELD dt,             dt,           float,          exposure time,                2.5*log(exptime)
 
-FIELD t,              t,            unsigned int,   time in seconds (UNIX)
-FIELD averef,         averef,       unsigned int,   reference to average entry      
-
-FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec 
-FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec 
-FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
-FIELD photcode,       photcode,     unsigned short, photcode
-
-FIELD flags,          flags,        unsigned short, flags for various uses  
-FIELD dophot,         dophot,       char,           dophot type
-FIELD stargal,        stargal,      char,           star-galaxy separator
+# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
+FIELD airmass,        airmass,      float,          (airmass - 1),		  airmass
+FIELD az,             AZ,           float,          telescope azimuth
 
 # new field elements needed for Pan-STARRS:
@@ -34,20 +25,32 @@
 FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
 
+FIELD t,              t,            unsigned int,   time in seconds (UNIX)
+FIELD averef,         averef,       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 image
+
+# do we need more resolution than a short? should this be a log?
+FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
+FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
+FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
+FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
+
+FIELD FWx,            FWx,          short,          object fwhm major axis,       1/100 of arcsec 
+FIELD FWy,            FWy,          short,          object fwhm minor axis,       1/100 of arcsec 
+FIELD theta,          theta,        short,          angle wrt ccd X dir,          (0xffff/360) deg
+FIELD photcode,       photcode,     unsigned short, photcode
+
 FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
 FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
 
-# do we need more resolution than a short? should this be a log?
-FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
+FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses  
+FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
 
-# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
-FIELD detID_hi,       DET_ID_HI,    unsigned int,   ID upper bytes
-FIELD detID_lo,       DET_ID_LO,    unsigned int,   ID lower bytes
+FIELD stargal,        stargal,      char,           star-galaxy separator
 
-FIELD imageID_hi,     IMAGE_ID_HI,  unsigned int,   reference to image
-FIELD imageID_lo,     IMAGE_ID_LO,  unsigned int,   reference to image
+# absorb these into photFlags?
+FIELD dophot,         dophot,       char,           dophot type
 
-# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
-FIELD az,             AZ,           float,          telescope azimuth
-
-# we need extra bytes for padding purposes...
-FIELD dummy,          dummy,        char[2],        padding
+FIELD dummy,          DUMMY,        char[2],        padding
Index: trunk/Ohana/src/libautocode/def/ps1_dev_1.d
===================================================================
--- trunk/Ohana/src/libautocode/def/ps1_dev_1.d	(revision 15034)
+++ trunk/Ohana/src/libautocode/def/ps1_dev_1.d	(revision 15038)
@@ -24,3 +24,3 @@
 FIELD psfQual, 	 PSF_QF,           float,    quality factor
 FIELD nFrames, 	 N_FRAMES,         short,    images overlapping peak
-FIELD dummy,  	 DUMMY,            short,    padding
+FIELD flags,  	 FLAGS,            short,    padding
