Index: /trunk/Ohana/src/libautocode/def/average-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/average-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/average-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,43 @@
+STRUCT       Average_PS1_DEV_2
+EXTNAME      DVO_AVERAGE_PS1_DEV_2
+TYPE         BINTABLE
+SIZE         72
+DESCRIPTION  DVO Average Object Table
+
+# elements of data structure / FITS table
+
+FIELD R,              RA,         double,           RA,                	       	  decimal degrees 
+FIELD D,              DEC,        double,           DEC,               	       	  decimal degrees 
+FIELD dR,             RA_ERR,     float,            RA error                      arcsec
+FIELD dD,             DEC_ERR,    float,            DEC error                     arcsec
+
+FIELD uR,             U_RA,       float,            RA*cos(D) proper-motion,      arcsec/year
+FIELD uD,             U_DEC,      float,            DEC proper-motion,            arcsec/year
+FIELD duR,            V_RA_ERR,   float,            RA*cos(D) p-m error,          arcsec/year
+FIELD duD,            V_DEC_ERR,  float,            DEC p-m error,                arcsec/year
+FIELD P,              PAR,        float,            parallax,			  arcsec
+FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
+
+FIELD Xp,             SIGMA_POS,  short, 	    position scatter,   	  1/100 arcsec
+FIELD Npsf,           NPSF,       unsigned short,   number of psf measurements
+FIELD Next,           NEXT,       unsigned short,   number of extended measurements
+FIELD Nmiss,          NMISS,      unsigned short,   number of missings
+FIELD psfOffset,      OFF_PSF,    int,     	    offset to first measurement
+FIELD extOffset,      OFF_EXT,    int,     	    offset to first measurement
+FIELD missOffset,     OFF_MISS,   int,     	    offset to first missing obs
+
+FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
+
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+FIELD objID_hi,       OBJ_ID_HI,  unsigned int,     ID upper bytes
+FIELD objID_lo,       OBJ_ID_LO,  unsigned int,     ID lower bytes
+
+# this structure should only be used for internal representations
+# the average-FORMAT structures should be used for external representations
+# note that the average magnitudes are stored in the 'secfilt' table (change this name??)
+# the index for the secfilt table is just Nsecfilt times the index for the average table.
+
+# the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs
+# probably need to add position chisq
+
+# XXX include the number of measurements used to determine the positional information?
Index: /trunk/Ohana/src/libautocode/def/extend-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/extend-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/extend-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,57 @@
+STRUCT       Extend_PS1_DEV_1
+EXTNAME      DVO_EXTEND_PS1_DEV_1
+TYPE         BINTABLE
+SIZE         104
+DESCRIPTION  DVO Detection Extended Source Parameters Table 
+
+FIELD dR,             D_RA,         	  float,          RA offset,                	  arcsec
+FIELD dD,             D_DEC,        	  float,          DEC offset,               	  arcsec
+FIELD M,              MAG,          	  float,          catalog mag,       	       	  mag
+FIELD dM,             MAG_ERR,      	  float,          mag error,                    mag
+
+# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
+# I don't actually have these indexed, but this lets us match back to the measurement
+FIELD detID,          DET_ID,       	  unsigned int,   detection ID
+FIELD imageID,        IMAGE_ID,     	  unsigned int,   reference to image
+FIELD photcode,       PHOTCODE,     	  unsigned short, photcode
+
+FIELD FWx,            EXT_MAJOR,    	  float,          object fwhm major axis
+FIELD FWy,            EXT_MINOR,    	  float,          object fwhm minor axis
+FIELD theta,          EXT_THETA,    	  float,          angle wrt ccd X dir
+
+FIELD petroMag,       PETRO_MAG,    	  float,          petrosian mag
+FIELD petroMagErr,    PETRO_MAG_ERR,	  float,          petrosian mag
+FIELD petroRad,       PETRO_RADIUS,       float,          petrosian mag
+FIELD petroRadErr,    PETRO_RADIUS_ERR,   float,          petrosian mag
+
+FIELD kronMag,        KRON_MAG,    	  float,          kron mag
+FIELD kronMagErr,     KRON_MAG_ERR,	  float,          kron mag
+FIELD kronRad,        KRON_RADIUS,     	  float,          kron mag
+FIELD kronRadErr,     KRON_RADIUS_ERR, 	  float,          kron mag
+
+FIELD isophotMag,     ISOPHOT_MAG,    	  float,          isophot mag
+FIELD isophotMagErr,  ISOPHOT_MAG_ERR,	  float,          isophot mag
+FIELD isophotRad,     ISOPHOT_RADIUS,     float,          isophot mag
+FIELD isophotRadErr,  ISOPHOT_RADIUS_ERR, float,          isophot mag
+
+FIELD fluxR0,         FLUX_VAL_R_00,      float,          flux in annulus 0
+FIELD fluxR1,         FLUX_VAL_R_01,      float,          flux in annulus 1
+FIELD fluxR2,         FLUX_VAL_R_02,      float,          flux in annulus 2
+FIELD fluxR3,         FLUX_VAL_R_03,      float,          flux in annulus 3
+FIELD fluxR4,         FLUX_VAL_R_04,      float,          flux in annulus 4
+FIELD fluxR5,         FLUX_VAL_R_05,      float,          flux in annulus 5
+
+FIELD fluxR0err,      FLUX_ERR_R_00,      float,          flux error in annulus 0
+FIELD fluxR1err,      FLUX_ERR_R_01,      float,          flux error in annulus 1
+FIELD fluxR2err,      FLUX_ERR_R_02,      float,          flux error in annulus 2
+FIELD fluxR3err,      FLUX_ERR_R_03,      float,          flux error in annulus 3
+FIELD fluxR4err,      FLUX_ERR_R_04,      float,          flux error in annulus 4
+FIELD fluxR5err,      FLUX_ERR_R_05,      float,          flux error in annulus 5
+
+FIELD fluxR0var,      FLUX_VAR_R_00,      float,          flux var in annulus 0
+FIELD fluxR1var,      FLUX_VAR_R_01,      float,          flux var in annulus 1
+FIELD fluxR2var,      FLUX_VAR_R_02,      float,          flux var in annulus 2
+FIELD fluxR3var,      FLUX_VAR_R_03,      float,          flux var in annulus 3
+FIELD fluxR4var,      FLUX_VAR_R_04,      float,          flux var in annulus 4
+FIELD fluxR5var,      FLUX_VAR_R_05,      float,          flux var in annulus 5
+
Index: /trunk/Ohana/src/libautocode/def/image-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/image-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/image-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,69 @@
+STRUCT       Image_PS1_DEV_1
+EXTNAME      DVO_IMAGE_PS1_DEV_1
+TYPE         BINTABLE
+SIZE         288
+DESCRIPTION  DVO Image Table 
+
+# elements of the image structure
+
+SUBSTRUCT coords,           COORDS,               Coords,        astrometric data
+SUBFIELD  crval1,           CRVAL1,               double,   	 coordinate at reference pixel
+SUBFIELD  crval2,           CRVAL2,               double,  	 coordinate at reference pixel
+SUBFIELD  crpix1,           CRPIX1,               float,   	 coordinate of reference pixel
+SUBFIELD  crpix2,           CRPIX2,               float,   	 coordinate of reference pixel
+SUBFIELD  cdelt1,           CDELT1,               float,   	 degrees per pixel
+SUBFIELD  cdelt2,           CDELT2,               float,    	 degrees per pixel
+SUBFIELD  pc1_1,            PC1_1,                float,    	 rotation matrix
+SUBFIELD  pc1_2,            PC1_2,                float,    	 rotation matrix
+SUBFIELD  pc2_1,            PC2_1,                float,    	 rotation matrix
+SUBFIELD  pc2_2,            PC2_2,                float,    	 rotation matrix
+SUBFIELD  polyterms,        POLYTERMS,            float[7][2],	 higher order warping terms
+SUBFIELD  ctype,            CTYPE,                char[15],      coordinate type
+SUBFIELD  Npolyterms,       NPOLYTERMS,           char,     	 order of polynomial
+# 120 bytes
+
+FIELD 	  tzero,            TZERO,                e_time,         readout time (row 0)
+FIELD 	  nstar,            NSTAR,                unsigned int,   number of stars on image
+FIELD 	  secz,             SECZ,                 float,      	  airmass,                   mag
+FIELD 	  NX,               NX,                   short,      	  image width
+FIELD 	  NY,               NY,                   short,      	  image height
+FIELD 	  apmifit,          APMIFIT,              float,      	  aperture correction,       mag
+FIELD 	  dapmifit,         DAPMIFIT,             float,      	  apmifit error,             mag
+FIELD 	  Mcal,             MCAL,                 float,      	  calibration mag,           mag
+FIELD 	  dMcal,            DMCAL,                float,      	  error on Mcal,             mag
+FIELD 	  Xm,               XM,                   short,      	  image chisq,               10*log(value)
+FIELD 	  photcode,         PHOTCODE,             short,      	  identifier for CCD,
+FIELD 	  exptime,          EXPTIME,              float,          exposure time,             seconds
+FIELD     sidtime,          ST,			  float,          sidereal time of exposure
+FIELD     latitude,         LAT,		  float,          observatory latitude,      degrees
+# 40 bytes
+
+FIELD 	  name,             NAME,                 char[64],       name of original image 
+FIELD 	  detection_limit,  DETECTION_LIMIT,      unsigned char,  detection limit,           10*mag
+FIELD 	  saturation_limit, SATURATION_LIMIT,     unsigned char,  saturation limit,          10*mag
+FIELD 	  cerror,           CERROR,               unsigned char,  astrometric error,         50*arcsec
+FIELD 	  fwhm_x,           FWHM_X,               unsigned char,  PSF x width,               25*arcsec
+FIELD 	  fwhm_y,           FWHM_Y,               unsigned char,  PSF y width,               25*arcsec
+FIELD 	  trate,            TRATE,                unsigned char,  scan rate,                 100 usec/pixel
+FIELD 	  code,             CODE,                 char,           image quality flag
+FIELD 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
+FIELD 	  imageID,          IMAGE_ID,             unsigned int,   image ID
+# 44 bytes 
+
+FIELD 	  dummy,            DUMMY,                char[14],       unused
+FIELD 	  order,            ORDER,                short,      	  Mrel 2D polynomical order 
+FIELD 	  Mx,               MX,                   short,      	  Mrel polyterm
+FIELD 	  My,               MY,                   short,      	  Mrel polyterm
+FIELD 	  Mxx,              MXX,                  short,      	  Mrel polyterm
+FIELD 	  Mxy,              MXY,                  short,      	  Mrel polyterm
+FIELD 	  Myy,              MYY,                  short,      	  Mrel polyterm
+FIELD 	  Mxxx,             MXXX,                 short,      	  Mrel polyterm
+FIELD 	  Mxxy,             MXXY,                 short,      	  Mrel polyterm
+FIELD 	  Mxyy,             MXYY,                 short,      	  Mrel polyterm
+FIELD 	  Myyy,             MYYY,                 short,      	  Mrel polyterm
+FIELD 	  Mxxxx,            MXXXX,                short,      	  Mrel polyterm
+FIELD 	  Mxxxy,            MXXXY,                short,      	  Mrel polyterm
+FIELD 	  Mxxyy,            MXXYY,                short,      	  Mrel polyterm
+FIELD 	  Mxyyy,            MXYYY,                short,      	  Mrel polyterm
+FIELD 	  Myyyy,            MYYYY,                short,      	  Mrel polyterm
+# 40 bytes
Index: /trunk/Ohana/src/libautocode/def/measure-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/measure-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/measure-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,56 @@
+STRUCT       Measure_PS1_DEV_1
+EXTNAME      DVO_MEASURE_PS1_DEV_1
+TYPE         BINTABLE
+SIZE         104
+DESCRIPTION  DVO Detection Measurement Table 
+
+FIELD dR,             D_RA,         float,          RA offset,                	  arcsec
+FIELD dD,             D_DEC,        float,          DEC offset,               	  arcsec
+FIELD M,              MAG,          float,          catalog mag,       	       	  mag
+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 az,             AZ,           float,          telescope azimuth
+
+# new field elements needed for Pan-STARRS:
+FIELD Xccd,           X_CCD,        float,          X coord on chip,               pixels
+FIELD Yccd,           Y_CCD,        float,          Y coord on chip,               pixels
+
+# could these be packed into fewer bits?
+FIELD Sky,            SKY_FLUX,     float,          local estimate of sky flux,    counts/sec
+FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
+
+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,          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,            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
+
+FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses  
+FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
+
+FIELD stargal,        STAR_GAL,     char,           star-galaxy separator
+
+# absorb these into photFlags?
+FIELD dophot,         DOPHOT,       char,           dophot type
+
+FIELD dummy,          DUMMY,        char[2],        padding
Index: /trunk/Ohana/src/libautocode/def/photcode-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/photcode-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/photcode-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,23 @@
+STRUCT       PhotCode_PS1_DEV_1
+EXTNAME      DVO_PHOTCODE_PS1_DEV_1
+TYPE         BINTABLE
+SIZE         104
+DESCRIPTION  DVO Photcode Description Table 
+
+# elements of data structure / FITS table
+FIELD  code,         CODE,          unsigned short, code number (stored in Measure.source) 
+FIELD  name,         NAME,          char[32],       name for filter combination 
+FIELD  type,         TYPE,          char,           PRI/SEC/DEP/REF 
+FIELD  dummy,        DUMMY,         char[3],        padding
+FIELD  C,            C_LAM,         short,          primary phot calibration terms (millimags) 
+FIELD  dC,           C_LAM_ERR,     short,          primary phot calibration terms (millimags) 
+FIELD  dX,           X_ERR,         short,          primary phot calibration terms (millimags) 
+FIELD  K,            K,             float,          secondary phot calibration terms (millimags) 
+FIELD  c1,           C1,            int,            color is average.M[c1] - average.M[c2] 
+FIELD  c2,           C2,            int,            color is average.M[c1] - average.M[c2] 
+FIELD  equiv,        EQUIV,         int,            this dependent filter is equivalent to equiv PRI/SEC
+FIELD  Nc,           NC,            int,            number of color terms 
+FIELD  X,            X,             float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc 
+FIELD  astromScale,  ASTROM_SCALE,  float,          astrom error = mag error * astromScale
+FIELD  photSysErr,   PHOT_SYS_ERR,  float,          systematic photometric error
+FIELD  padding,      PADDING,       float[4],       placeholder
Index: /trunk/Ohana/src/libautocode/def/secfilt-ps1-dev-2.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/secfilt-ps1-dev-2.d	(revision 16266)
+++ /trunk/Ohana/src/libautocode/def/secfilt-ps1-dev-2.d	(revision 16266)
@@ -0,0 +1,13 @@
+STRUCT       SecFilt_PS1_DEV_1
+EXTNAME      DVO_SECFILT_PS1_DEV_1
+TYPE         BINTABLE
+SIZE         16
+DESCRIPTION  DVO SecFilt : Secondary Filter Data 
+
+# elements of data structure / FITS table
+FIELD  M,     MAG,      float,                other mags,       mags
+FIELD  dM,    MAG_ERR,  float,                scatter on mag,   mags
+FIELD  Xm,    MAG_CHI,  short,                chisq on mag,     [100*log(value)]
+FIELD  Ncode, NCODE,    short,                number of detections in band
+FIELD  Nused, NUSED,    short,                number of detections used in average
+FIELD  dummy, JUNK,     short,                place holder
