Index: trunk/Ohana/src/libautocode/Makefile.Targets
===================================================================
--- trunk/Ohana/src/libautocode/Makefile.Targets	(revision 40061)
+++ trunk/Ohana/src/libautocode/Makefile.Targets	(revision 40062)
@@ -14,4 +14,5 @@
 $(ASRC)/average-ps1-v4.$(ARCH).o \
 $(ASRC)/average-ps1-v5.$(ARCH).o \
+$(ASRC)/average-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/average-ps1-sim.$(ARCH).o \
 $(ASRC)/average-ps1-ref.$(ARCH).o \
@@ -28,4 +29,5 @@
 $(ASRC)/secfilt-ps1-v4.$(ARCH).o \
 $(ASRC)/secfilt-ps1-v5.$(ARCH).o \
+$(ASRC)/secfilt-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/secfilt-ps1-sim.$(ARCH).o \
 $(ASRC)/secfilt-ps1-ref.$(ARCH).o \
@@ -42,4 +44,5 @@
 $(ASRC)/measure-ps1-v4.$(ARCH).o \
 $(ASRC)/measure-ps1-v5.$(ARCH).o \
+$(ASRC)/measure-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/measure-ps1-sim.$(ARCH).o \
 $(ASRC)/measure-ps1-ref.$(ARCH).o \
@@ -49,13 +52,17 @@
 $(ASRC)/lensing-ps1-v5-r2.$(ARCH).o \
 $(ASRC)/lensing-ps1-v5-r3.$(ARCH).o \
+$(ASRC)/lensing-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/lensobj.$(ARCH).o \
 $(ASRC)/lensobj-ps1-v5-r0.$(ARCH).o \
 $(ASRC)/lensobj-ps1-v5-r1.$(ARCH).o \
+$(ASRC)/lensobj-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/starpar.$(ARCH).o \
 $(ASRC)/starpar-ps1-v5.$(ARCH).o \
+$(ASRC)/starpar-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/starpar-ps1-sim.$(ARCH).o \
 $(ASRC)/galphot.$(ARCH).o \
 $(ASRC)/galphot-ps1-v5-r0.$(ARCH).o \
 $(ASRC)/galphot-ps1-v5-r1.$(ARCH).o \
+$(ASRC)/galphot-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/missing.$(ARCH).o \
 $(ASRC)/photcode.$(ARCH).o \
@@ -69,4 +76,5 @@
 $(ASRC)/photcode-ps1-v4.$(ARCH).o \
 $(ASRC)/photcode-ps1-v5.$(ARCH).o \
+$(ASRC)/photcode-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/photcode-ps1-ref.$(ARCH).o \
 $(ASRC)/image-loneos.$(ARCH).o \
@@ -82,4 +90,5 @@
 $(ASRC)/image-ps1-v4.$(ARCH).o \
 $(ASRC)/image-ps1-v5.$(ARCH).o \
+$(ASRC)/image-ps1-v5-ld.$(ARCH).o \
 $(ASRC)/image-ps1-sim.$(ARCH).o \
 $(ASRC)/image-ps1-ref.$(ARCH).o \
@@ -127,4 +136,5 @@
 $(AINC)/average-ps1-v4.h \
 $(AINC)/average-ps1-v5.h \
+$(AINC)/average-ps1-v5-ld.h \
 $(AINC)/average-ps1-sim.h \
 $(AINC)/average-ps1-ref.h \
@@ -141,4 +151,5 @@
 $(AINC)/secfilt-ps1-v4.h \
 $(AINC)/secfilt-ps1-v5.h \
+$(AINC)/secfilt-ps1-v5-ld.h \
 $(AINC)/secfilt-ps1-sim.h \
 $(AINC)/secfilt-ps1-ref.h \
@@ -155,4 +166,5 @@
 $(AINC)/measure-ps1-v4.h \
 $(AINC)/measure-ps1-v5.h \
+$(AINC)/measure-ps1-v5-ld.h \
 $(AINC)/measure-ps1-sim.h \
 $(AINC)/measure-ps1-ref.h \
@@ -162,13 +174,17 @@
 $(AINC)/lensing-ps1-v5-r2.h \
 $(AINC)/lensing-ps1-v5-r3.h \
+$(AINC)/lensing-ps1-v5-ld.h \
 $(AINC)/lensobj.h \
 $(AINC)/lensobj-ps1-v5-r0.h \
 $(AINC)/lensobj-ps1-v5-r1.h \
+$(AINC)/lensobj-ps1-v5-ld.h \
 $(AINC)/starpar.h \
 $(AINC)/starpar-ps1-v5.h \
+$(AINC)/starpar-ps1-v5-ld.h \
 $(AINC)/starpar-ps1-sim.h \
 $(AINC)/galphot.h \
 $(AINC)/galphot-ps1-v5-r0.h \
 $(AINC)/galphot-ps1-v5-r1.h \
+$(AINC)/galphot-ps1-v5-ld.h \
 $(AINC)/missing.h \
 $(AINC)/photcode.h \
@@ -182,4 +198,5 @@
 $(AINC)/photcode-ps1-v4.h \
 $(AINC)/photcode-ps1-v5.h \
+$(AINC)/photcode-ps1-v5-ld.h \
 $(AINC)/photcode-ps1-ref.h \
 $(AINC)/image-loneos.h \
@@ -195,4 +212,5 @@
 $(AINC)/image-ps1-v4.h \
 $(AINC)/image-ps1-v5.h \
+$(AINC)/image-ps1-v5-ld.h \
 $(AINC)/image-ps1-sim.h \
 $(AINC)/image-ps1-ref.h \
Index: trunk/Ohana/src/libautocode/def/average-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/average-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/average-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,29 @@
+STRUCT       Average_PS1_V5_LOAD
+EXTNAME      DVO_AVERAGE_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         56
+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 
+
+# objID + catID gives a unique ID for all objects in the database
+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 extID,          EXT_ID,      uint64_t,        external ID for object (eg PSPS objID)
+
+# offsets to starting point
+FIELD measureOffset,  OFF_MEASURE, int,   	    offset to first measurement
+FIELD lensingOffset,  OFF_LENSING, int,   	    offset to first lensing obs
+FIELD galphotOffset,  OFF_GALPHOT, int,   	    offset to galphot object entry
+
+# this limits us to a max of 64k measurements per object
+FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
+FIELD Nlensing,       NLENSING,    unsigned short,  number of lensing measurements
+FIELD Ngalphot,       NGALPHOT,    unsigned short,  number of galphot measurements
+FIELD dummy,  	      DUMMY,       char[6],         padding
+
+# 3*8 + 5*4 + 3*2 + 6 = 56
+
Index: trunk/Ohana/src/libautocode/def/galphot-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/galphot-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/galphot-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,31 @@
+STRUCT       GalPhot_PS1_V5_LOAD
+EXTNAME      DVO_GALPHOT_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         80
+DESCRIPTION  DVO Galaxy Shape Table 
+
+FIELD Xfit,         XFIT,    	    float,          centroid for fit
+FIELD Yfit,         YFIT,    	    float,          centroid for fit
+FIELD mag,          MAG,    	    float,          galaxy magnitude
+FIELD magErr,       MAG_ERR,	    float,          galaxy magnitude error
+FIELD majorAxis,    MAJOR_AXIS,     float,          major axis size
+FIELD minorAxis,    MINOR_AXIS,     float,          minor axis size
+FIELD majorAxisErr, MAJOR_AXIS_ERR, float,          major axis size error
+FIELD minorAxisErr, MINOR_AXIS_ERR, float,          minor axis size error
+FIELD theta,        THETA,          float,          angle
+FIELD thetaErr,     THETA_ERR,      float,          angle error
+FIELD index,        INDEX,          float,          sersic index (if relevant)
+FIELD chisq,        CHISQ,   	    float,          fit chisq
+		    
+FIELD Npix,         NPIX,           float,          fitted pixels
+
+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 detID,        DET_ID,         unsigned int,   detection ID
+FIELD imageID,      IMAGE_ID,       unsigned int,   reference to DVO image ID
+
+FIELD averef,       AVEREF,         unsigned int,   reference to average table
+FIELD flags,        FLAGS,          unsigned int,   info flags
+
+FIELD photcode,     PHOTCODE,       short
+FIELD modelType,    MODEL_TYPE,     short,          mean lensing smear object E2
Index: trunk/Ohana/src/libautocode/def/image-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/image-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/image-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,78 @@
+STRUCT       Image_PS1_V5_LOAD
+EXTNAME      DVO_IMAGE_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         360
+DESCRIPTION  DVO Image Table 
+
+# elements of the image structure
+# careful of 8-byte boundaries
+
+SUBSTRUCT coords,           COORDS,               CoordsDisk,    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
+
+# change this to a double mjd?
+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,                   unsigned short, image width
+FIELD 	  NY,               NY,                   unsigned 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     RAo,              RA_CENTER,            float,          image center,              degrees
+FIELD     DECo,             DEC_CENTER,           float,          image center,              degrees
+FIELD     Radius,           RADIUS,               float,          image radius,              degrees
+FIELD     refColorBlue,     REF_COLOR_BLUE,       float,          median astrometry ref color
+FIELD     refColorRed,      REF_COLOR_RED,        float,          median astrometry ref color
+
+# should we define the max length of name as a macro?
+FIELD 	  name,             NAME,                 char[117],      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 	  ccdnum,           CCDNUM,               unsigned char,  CCD ID number
+FIELD 	  flags,            FLAGS,                unsigned int,   image quality flags
+FIELD 	  imageID,          IMAGE_ID,             unsigned int,   internal image ID
+FIELD 	  parentID,         PARENT_ID,            unsigned int,   associated ref image
+FIELD 	  externID,         EXTERN_ID,            unsigned int,   external image ID
+FIELD 	  sourceID,         SOURCE_ID,            unsigned short, analysis source ID
+# 48 bytes 
+
+FIELD 	  nLinkAstrom,      NLINK_ASTROM,         short,      	  mean number of matched measurements for astrometry
+FIELD 	  nLinkPhotom,      NLINK_PHOTOM,         short,      	  mean number of matched measurements for astrometry
+FIELD 	  ubercalDist,      UBERCAL_DIST,         short,      	  distance to nearest ubercal image
+
+FIELD 	  dXpixSys,         XPIX_SYS_ERR,         float,      	  systematic astrometry error in X
+FIELD 	  dYpixSys,         YPIX_SYS_ERR,         float,      	  systematic astrometry error in Y
+
+FIELD 	  dMagSys,          MAG_SYS_ERR,          float,      	  systematic photometry error
+FIELD 	  nFitAstrom,       N_FIT_ASTROM,         short,      	  number of stars used for astrometry cal
+FIELD 	  nFitPhotom,       N_FIT_PHOTOM,         short,      	  number of stars used for photometry cal
+
+FIELD 	  photom_map_id,    PHOTOM_MAP_ID,        unsigned int,   reference to 2D zero point map
+FIELD 	  astrom_map_id,    ASTROM_MAP_ID,        unsigned int,   reference to 2D astrometry map
+# nFitPhotom lands on the old location of Mxxxx, which was used to mean nFitPhotom in some cases
Index: trunk/Ohana/src/libautocode/def/lensing-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensing-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/lensing-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,60 @@
+STRUCT       Lensing_PS1_V5_LOAD
+EXTNAME      DVO_LENSING_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         160
+DESCRIPTION  DVO Lensing Table 
+
+FIELD X11_sm_obj,     X11_SM_OBJ,    float,          lensing smear object X11
+FIELD X12_sm_obj,     X12_SM_OBJ,    float,          lensing smear object X12
+FIELD X22_sm_obj,     X22_SM_OBJ,    float,          lensing smear object X22
+FIELD  E1_sm_obj,      E1_SM_OBJ,    float,          lensing smear object E1
+FIELD  E2_sm_obj,      E2_SM_OBJ,    float,          lensing smear object E2
+
+FIELD X11_sh_obj,     X11_SH_OBJ,    float,          lensing shear object X11
+FIELD X12_sh_obj,     X12_SH_OBJ,    float,          lensing shear object X12
+FIELD X22_sh_obj,     X22_SH_OBJ,    float,          lensing shear object X22
+FIELD  E1_sh_obj,      E1_SH_OBJ,    float,          lensing shear object E1
+FIELD  E2_sh_obj,      E2_SH_OBJ,    float,          lensing shear object E2
+
+FIELD X11_sm_psf,     X11_SM_PSF,    float,          lensing smear psf stars X11
+FIELD X12_sm_psf,     X12_SM_PSF,    float,          lensing smear psf stars X12
+FIELD X22_sm_psf,     X22_SM_PSF,    float,          lensing smear psf stars X22
+FIELD  E1_sm_psf,      E1_SM_PSF,    float,          lensing smear psf stars E1
+FIELD  E2_sm_psf,      E2_SM_PSF,    float,          lensing smear psf stars E2
+
+FIELD X11_sh_psf,     X11_SH_PSF,    float,          lensing shear psf stars X11
+FIELD X12_sh_psf,     X12_SH_PSF,    float,          lensing shear psf stars X12
+FIELD X22_sh_psf,     X22_SH_PSF,    float,          lensing shear psf stars X22
+FIELD  E1_sh_psf,      E1_SH_PSF,    float,          lensing shear psf stars E1
+FIELD  E2_sh_psf,      E2_SH_PSF,    float,          lensing shear psf stars E2
+
+FIELD  E1_psf,         E1_PSF,       float,          polarization psf stars E1
+FIELD  E2_psf,         E2_PSF,       float,          polarization psf stars E2
+
+FIELD  F_ApR5,           FLUX_AP_R5, float,          Flux inside r = 5
+FIELD dF_ApR5,       FLUX_ERR_AP_R5, float,          error on Flux inside r = 5
+FIELD sF_ApR5,       FLUX_STD_AP_R5, float,          stdev of Flux inside r = 5
+FIELD fF_ApR5,       FLUX_FIL_AP_R5, float,          fill factor for Flux inside r = 5
+
+FIELD  F_ApR6,           FLUX_AP_R6, float,          Flux inside r = 6
+FIELD dF_ApR6,       FLUX_ERR_AP_R6, float,          error on Flux inside r = 6
+FIELD sF_ApR6,       FLUX_STD_AP_R6, float,          stdev of Flux inside r = 6
+FIELD fF_ApR6,       FLUX_FIL_AP_R6, float,          fill factor for Flux inside r = 6
+
+FIELD  F_ApR7,           FLUX_AP_R7, float,          Flux inside r = 7
+FIELD dF_ApR7,       FLUX_ERR_AP_R7, float,          error on Flux inside r = 7
+FIELD sF_ApR7,       FLUX_STD_AP_R7, float,          stdev of Flux inside r = 7
+FIELD fF_ApR7,       FLUX_FIL_AP_R7, float,          fill factor for Flux inside r = 7
+
+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 imageID,	       IMAGE_ID,     unsigned int,   reference to DVO image ID
+FIELD oldImID,	       OLD_IM_ID,    int,   	     saved reference to (wrong) DVO image ID
+
+# 28 x float
+# 4 x int
+# = 128 bytes / detection
+# for 2.5G objects + 60 overlaps, expect 15TB for forced warp
Index: trunk/Ohana/src/libautocode/def/lensobj-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/lensobj-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/lensobj-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,58 @@
+STRUCT       Lensobj_PS1_V5_LOAD
+EXTNAME      DVO_LENSOBJ_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         152
+DESCRIPTION  DVO Lensobj Table 
+
+FIELD X11_sm_obj,     X11_SM_OBJ,    float,          mean lensing smear object X11
+FIELD X12_sm_obj,     X12_SM_OBJ,    float,          mean lensing smear object X12
+FIELD X22_sm_obj,     X22_SM_OBJ,    float,          mean lensing smear object X22
+FIELD  E1_sm_obj,      E1_SM_OBJ,    float,          mean lensing smear object E1
+FIELD  E2_sm_obj,      E2_SM_OBJ,    float,          mean lensing smear object E2
+
+FIELD X11_sh_obj,     X11_SH_OBJ,    float,          mean lensing shear object X11
+FIELD X12_sh_obj,     X12_SH_OBJ,    float,          mean lensing shear object X12
+FIELD X22_sh_obj,     X22_SH_OBJ,    float,          mean lensing shear object X22
+FIELD  E1_sh_obj,      E1_SH_OBJ,    float,          mean lensing shear object E1
+FIELD  E2_sh_obj,      E2_SH_OBJ,    float,          mean lensing shear object E2
+
+FIELD X11_sm_psf,     X11_SM_PSF,    float,          mean lensing smear psf stars X11
+FIELD X12_sm_psf,     X12_SM_PSF,    float,          mean lensing smear psf stars X12
+FIELD X22_sm_psf,     X22_SM_PSF,    float,          mean lensing smear psf stars X22
+FIELD  E1_sm_psf,      E1_SM_PSF,    float,          mean lensing smear psf stars E1
+FIELD  E2_sm_psf,      E2_SM_PSF,    float,          mean lensing smear psf stars E2
+
+FIELD X11_sh_psf,     X11_SH_PSF,    float,          mean lensing shear psf stars X11
+FIELD X12_sh_psf,     X12_SH_PSF,    float,          mean lensing shear psf stars X12
+FIELD X22_sh_psf,     X22_SH_PSF,    float,          mean lensing shear psf stars X22
+FIELD  E1_sh_psf,      E1_SH_PSF,    float,          mean lensing shear psf stars E1
+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,          error on Flux inside r = 5
+FIELD sF_ApR5,       FLUX_STD_AP_R5, float,          stdev of Flux inside r = 5
+FIELD fF_ApR5,       FLUX_FIL_AP_R5, float,          fill factor for Flux inside r = 5
+
+FIELD  F_ApR6,           FLUX_AP_R6, float,          Flux inside r = 6
+FIELD dF_ApR6,       FLUX_ERR_AP_R6, float,          error on Flux inside r = 6
+FIELD sF_ApR6,       FLUX_STD_AP_R6, float,          stdev of Flux inside r = 6
+FIELD fF_ApR6,       FLUX_FIL_AP_R6, float,          fill factor for Flux inside r = 6
+
+FIELD  F_ApR7,           FLUX_AP_R7, float,          Flux inside r = 7
+FIELD dF_ApR7,       FLUX_ERR_AP_R7, float,          error on Flux inside r = 7
+FIELD sF_ApR7,       FLUX_STD_AP_R7, float,          stdev of Flux inside r = 7
+FIELD fF_ApR7,       FLUX_FIL_AP_R7, float,          fill factor for Flux inside r = 7
+
+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 photcode,         PHOTCODE,    short
+FIELD    Nmeas,            NMEAS,    short
+
+# 31 x float
+#  3 x int
+# = 136 bytes / detection
+# for 2.5G objects + 60 overlaps, expect 15TB for forced warp
Index: trunk/Ohana/src/libautocode/def/measure-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/measure-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/measure-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,111 @@
+STRUCT       Measure_PS1_V5_LOAD
+EXTNAME      DVO_MEASURE_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         240
+DESCRIPTION  DVO Detection Measurement Table 
+
+FIELD R,              RA,            double,         RA at epoch,                  degrees
+FIELD D,              DEC,           double,         DEC at epoch,                 degrees
+FIELD M,              MAG,           float,          catalog mag,                  mag
+FIELD dM,             MAG_ERR,       float,          mag error,                    mag
+FIELD Map,            M_APER,        float,          aperture mag,                 mag
+FIELD dMap,           M_APER_ERR,    float,          aperture mag,                 mag
+FIELD Mkron,          M_KRON,        float,          kron magnitude,               mag
+FIELD dMkron,         M_KRON_ERR,    float,          kron magnitude error,         mag
+FIELD Mcal,           M_CAL,         float,          image cal mag,                mag
+FIELD dMcal,          MAG_CAL_ERR,   float,          systematic calibration error, mag
+FIELD dt,             M_TIME,        float,          exposure time,                2.5*log(exptime)
+
+# needed for stacks, forced warp, and diff
+FIELD FluxPSF,        FLUX_PSF,      float,          flux from psf fit,            counts/sec
+FIELD dFluxPSF,       FLUX_PSF_ERR,  float,          error on psf flux,            counts/sec
+FIELD FluxKron,       FLUX_KRON,     float,          flux from kron ap,            counts/sec
+FIELD dFluxKron,      FLUX_KRON_ERR, float,          error on kron flux,           counts/sec
+FIELD FluxAp,         FLUX_AP,       float,          flux from ap ap,              counts/sec
+FIELD dFluxAp,        FLUX_AP_ERR,   float,          error on ap flux,             counts/sec
+
+# 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 (raw value),  pixels
+FIELD Yccd,           Y_CCD,         float,          Y coord on chip (raw value),  pixels
+                                     
+FIELD Xfix,           X_FIX,         float,          X coord after correction,     pixels
+FIELD Yfix,           Y_FIX,         float,          Y coord after correction,     pixels
+                                     
+FIELD XoffKH,         X_OFF_KH,      float,          X offset from correction,     pixels
+FIELD YoffKH,         Y_OFF_KH,      float,          Y offset from correction,     pixels
+FIELD XoffDCR,        X_OFF_DCR,     float,          X offset from correction,     pixels
+FIELD YoffDCR,        Y_OFF_DCR,     float,          Y offset from correction,     pixels
+FIELD XoffCAM,        X_OFF_CAM,     float,          X offset from correction,     pixels
+FIELD YoffCAM,        Y_OFF_CAM,     float,          Y offset from correction,     pixels
+
+FIELD Mflat,          M_FLAT,        float,          Static Flat-field offset,     mag
+FIELD dummy2,         PADDING,       int,            unused 4 bytes
+
+# 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,          int,            time in seconds (UNIX)
+FIELD averef,         AVE_REF,       unsigned int,   reference to average entry      
+
+# 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 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
+
+# extID needs to be on an 8-byte boundary
+# PSPS uses a 64-bit detection ID
+FIELD extID,          EXT_ID,        uint64_t,       external ID (eg PSPS detID)
+
+FIELD imageID,        IMAGE_ID,      unsigned int,   reference to DVO image ID
+
+# do we need more resolution than a short? should this be a log?
+FIELD psfQF,          PSF_QF,        float,          psf coverage/quality factor
+FIELD psfQFperf,      PSF_QF_PEFECT, float,          psf coverage / quality factor (all mask bits)
+FIELD psfChisq,       PSF_CHISQ,     float,          psf fit chisq
+
+FIELD psfNdof,        PSF_NDOF,      int,            psf degrees of freedom
+FIELD psfNpix,        PSF_NPIX,      int,            psf number of pixels
+FIELD photFlags2,     PHOT_FLAGS2,   int,            flags supplied by photometry program
+FIELD extNsigma,      EXT_NSIGMA,    float,          Nsigma deviation towards EXT
+
+# model shape parameters
+FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,         1/100 of pixels
+FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,         1/100 of pixels 
+FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,            (0xffff/360) deg
+
+# moments
+FIELD Mxx,            MXX,          short,          second moments in pixel coords, 1/100 of pixels
+FIELD Mxy,            MXY,          short,          second moments in pixel coords, 1/100 of pixels
+FIELD Myy,            MYY,          short,          second moments in pixel coords, 1/100 of pixels
+
+# fractional exposure time
+FIELD t_msec,         TIME_MSEC,    unsigned short, time fraction of second,        milliseconds
+FIELD photcode,       PHOTCODE,     unsigned short, photcode
+
+# position errors
+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 dRsys,          POS_SYS_ERR,  short,          systematic error from astrom,   1/100 of pixels
+
+# local astrometry scales
+FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
+FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
+
+FIELD dbFlags,        DB_FLAGS,     unsigned int,   flags supplied by analysis in database
+FIELD photFlags,      PHOT_FLAGS,   unsigned int,   flags supplied by photometry program
+
+FIELD padding,        PADDING,       int,            padding to ensure 8byte blocks
+
+# 2 x double
+# 35 x float
+# 11 x int or unsigned int
+# 12 x short or unsigned short
+# 1 x uint64_t
+# = 232 bytes / detection
+# for 2.5G objects * 60 overlaps, expect 35TB for forced warp
+# for 120G detections, expect 28TB
Index: trunk/Ohana/src/libautocode/def/photcode-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/photcode-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/photcode-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,33 @@
+STRUCT       PhotCode_PS1_V5_LOAD
+EXTNAME      DVO_PHOTCODE_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         112
+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  astromErrSys,      ASTROM_ERR_SYS,  	 float,          systematic astrometry error (arcsec)
+FIELD  astromErrScale,    ASTROM_ERR_SCALE,  	 float,          astrometric error scale
+FIELD  astromErrMagScale, ASTROM_ERR_MAG_SCALE,  float,          astrometric error / mag error scale
+FIELD  astromPoorMask,    ASTROM_POOR_MASK,      unsigned int,   detections matching this mask should only be used in emergencies
+FIELD  astromBadMask,     ASTROM_BAD_MASK,       unsigned int,   detections matching this mask should not be used
+FIELD  photomErrSys,   	  PHOTOM_ERR_SYS,  	 float,          systematic photometric error
+FIELD  photomPoorMask, 	  PHOTOM_POOR_MASK,  	 unsigned int,   detections matching this mask should only be used in emergencies
+FIELD  photomBadMask,  	  PHOTOM_BAD_MASK,  	 unsigned int,   detections matching this mask should not be used
+
+#   dR_total^2 =  dR_sys^2 + AS * dR_obs^2 + MS * dM_obs^2
+#   dR_sys : systematicAstrometryError
+#   AS     : astrometryErrorScale
+#   MS     : astrometryErrorMagScale
Index: trunk/Ohana/src/libautocode/def/secfilt-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/secfilt-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/secfilt-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,10 @@
+STRUCT       SecFilt_PS1_V5_LOAD
+EXTNAME      DVO_SECFILT_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         8
+DESCRIPTION  DVO SecFilt : Secondary Filter Data 
+
+## *** this section is for per-exposure mean values *** (unlabled values are implicitly PSF values)
+FIELD  M,             MAG,               float,    average mag in this band,              mags
+FIELD  Ncode,         NCODE,             short,    number of detections in band
+FIELD  Nused,         NUSED,             short,    number of detections used in average
Index: trunk/Ohana/src/libautocode/def/starpar-ps1-v5-ld.d
===================================================================
--- trunk/Ohana/src/libautocode/def/starpar-ps1-v5-ld.d	(revision 40062)
+++ trunk/Ohana/src/libautocode/def/starpar-ps1-v5-ld.d	(revision 40062)
@@ -0,0 +1,24 @@
+STRUCT       StarPar_PS1_V5_LOAD
+EXTNAME      DVO_STARPAR_PS1_V5_LOAD
+TYPE         BINTABLE
+SIZE         80
+DESCRIPTION  DVO Table of Stellar Properties
+
+FIELD R,              RA,            double,         ra
+FIELD D,              DEC,           double,         dec
+FIELD galLat,         GAL_LAT,       float,          galactic latitude
+FIELD galLon,         GAL_LON,       float,          galactic longitude
+FIELD Ebv,            E_BV,          float,          extinction
+FIELD dEbv,           E_BV_ERR,      float,          extinction error
+FIELD DistMag,        DISTANCE_MOD,     float,       mag
+FIELD dDistMag,       DISTANCE_MOD_ERR, float,       mag
+FIELD M_r,            M_R_ABS,       float,          r-band abs magnitude
+FIELD dM_r,           M_R_ABS_ERR,   float,          r-band abs magnitude error
+FIELD FeH,            F_E_H,         float,          metallicity
+FIELD dFeH,           F_E_H_ERR,     float,          metallicity error
+FIELD uRA,            U_RA,          float,          model guess for proper motion
+FIELD uDEC,           U_DEC,         float,          model guess for proper motion
+FIELD averef,         AVE_REF,       unsigned int,   reference to average entry      
+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 dummy,          DUMMY,         unsigned int,   dummy
