Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets	(revision 37451)
@@ -14,4 +14,5 @@
 $(ASRC)/average-ps1-v4.$(ARCH).o \
 $(ASRC)/average-ps1-v5.$(ARCH).o \
+$(ASRC)/average-ps1-sim.$(ARCH).o \
 $(ASRC)/average-ps1-ref.$(ARCH).o \
 $(ASRC)/secfilt.$(ARCH).o \
@@ -27,4 +28,5 @@
 $(ASRC)/secfilt-ps1-v4.$(ARCH).o \
 $(ASRC)/secfilt-ps1-v5.$(ARCH).o \
+$(ASRC)/secfilt-ps1-sim.$(ARCH).o \
 $(ASRC)/secfilt-ps1-ref.$(ARCH).o \
 $(ASRC)/measure.$(ARCH).o \
@@ -40,4 +42,5 @@
 $(ASRC)/measure-ps1-v4.$(ARCH).o \
 $(ASRC)/measure-ps1-v5.$(ARCH).o \
+$(ASRC)/measure-ps1-sim.$(ARCH).o \
 $(ASRC)/measure-ps1-ref.$(ARCH).o \
 $(ASRC)/lensing.$(ARCH).o \
@@ -47,4 +50,5 @@
 $(ASRC)/starpar.$(ARCH).o \
 $(ASRC)/starpar-ps1-v5.$(ARCH).o \
+$(ASRC)/starpar-ps1-sim.$(ARCH).o \
 $(ASRC)/missing.$(ARCH).o \
 $(ASRC)/photcode.$(ARCH).o \
@@ -71,4 +75,5 @@
 $(ASRC)/image-ps1-v4.$(ARCH).o \
 $(ASRC)/image-ps1-v5.$(ARCH).o \
+$(ASRC)/image-ps1-sim.$(ARCH).o \
 $(ASRC)/image-ps1-ref.$(ARCH).o \
 $(ASRC)/regimage.$(ARCH).o \
@@ -114,4 +119,5 @@
 $(AINC)/average-ps1-v4.h \
 $(AINC)/average-ps1-v5.h \
+$(AINC)/average-ps1-sim.h \
 $(AINC)/average-ps1-ref.h \
 $(AINC)/secfilt.h \
@@ -127,4 +133,5 @@
 $(AINC)/secfilt-ps1-v4.h \
 $(AINC)/secfilt-ps1-v5.h \
+$(AINC)/secfilt-ps1-sim.h \
 $(AINC)/secfilt-ps1-ref.h \
 $(AINC)/measure.h \
@@ -140,4 +147,5 @@
 $(AINC)/measure-ps1-v4.h \
 $(AINC)/measure-ps1-v5.h \
+$(AINC)/measure-ps1-sim.h \
 $(AINC)/measure-ps1-ref.h \
 $(AINC)/lensing.h \
@@ -147,4 +155,5 @@
 $(AINC)/starpar.h \
 $(AINC)/starpar-ps1-v5.h \
+$(AINC)/starpar-ps1-sim.h \
 $(AINC)/missing.h \
 $(AINC)/photcode.h \
@@ -171,4 +180,5 @@
 $(AINC)/image-ps1-v4.h \
 $(AINC)/image-ps1-v5.h \
+$(AINC)/image-ps1-sim.h \
 $(AINC)/image-ps1-ref.h \
 $(AINC)/regimage.h \
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/README
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/README	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/README	(revision 37451)
@@ -0,0 +1,2 @@
+
+doc/autocode.txt gives a description of the autocode process
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/average-ps1-sim.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/average-ps1-sim.d	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/average-ps1-sim.d	(revision 37451)
@@ -0,0 +1,46 @@
+STRUCT       Average_PS1_SIM
+EXTNAME      DVO_AVERAGE_PS1_SIM
+TYPE         BINTABLE
+SIZE         104
+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 ChiSqAve,       CHISQ_POS,   float,           astrometry analysis chisq
+FIELD ChiSqPM,        CHISQ_PM,    float,           astrometry analysis chisq
+FIELD ChiSqPar,       CHISQ_PAP,   float,           astrometry analysis chisq
+FIELD Tmean,          MEAN_EPOCH,  int,   	    mean epoch (PM,PAR ref),       unix time seconds
+FIELD Trange,         TIME_RANGE,  int,   	    mean epoch (PM,PAR ref),       unix time seconds
+
+FIELD Npos,           NUMBER_POS,  unsigned short,  number of detections used for astrometry
+FIELD dummy,          DUMMY,       short,           padding
+
+# this limits us to a max of 64k measurements per object
+FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
+FIELD Nstarpar,       NSTARPAR,    short,           number of stellar parameter entries
+
+FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
+FIELD starparOffset,  OFF_STARPAR, int,   	    offset to stellar parameter data
+
+FIELD refColorBlue,   REF_COLOR_BLUE, float,   	    color of astrometry ref stars
+FIELD refColorRed,    REF_COLOR_RED,  float,   	    color of astrometry ref stars
+
+# 'flags' was called 'code' prior to 2009.02.07
+FIELD flags,          FLAGS,       uint32_t,        average object flags (star; ghost; etc)
+
+# 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
+
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/image-ps1-sim.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/image-ps1-sim.d	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/image-ps1-sim.d	(revision 37451)
@@ -0,0 +1,78 @@
+STRUCT       Image_PS1_SIM
+EXTNAME      DVO_IMAGE_PS1_SIM
+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: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/measure-ps1-sim.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/measure-ps1-sim.d	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/measure-ps1-sim.d	(revision 37451)
@@ -0,0 +1,56 @@
+STRUCT       Measure_PS1_SIM
+EXTNAME      DVO_MEASURE_PS1_SIM
+TYPE         BINTABLE
+SIZE         136
+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 Mcal,           M_CAL,         float,          image cal mag,                  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 (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 RoffGAL,        R_OFF_GAL,     float,          RA offset from correction,    arcsec
+FIELD DoffGAL,        D_OFF_GAL,     float,          DEC offset from correction,   arcsec
+
+FIELD t,              TIME,         int,            time in seconds (UNIX)
+FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
+
+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 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 photcode,       PHOTCODE,     unsigned short, photcode
+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
+
+FIELD dummy,          PADDING,      short,          padding
+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
+
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/secfilt-ps1-sim.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/secfilt-ps1-sim.d	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/secfilt-ps1-sim.d	(revision 37451)
@@ -0,0 +1,15 @@
+STRUCT       SecFilt_PS1_SIM
+EXTNAME      DVO_SECFILT_PS1_SIM
+TYPE         BINTABLE
+SIZE         16
+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  dM,            MAG_ERR,         float,      formal error on average mag,           mags
+
+FIELD  Ncode,         NCODE,           short,      number of detections in band (gpc1 chip only)
+FIELD  Nused,         NUSED,           short,      number of detections used to calculate secfilt.M
+
+FIELD  flags,         FLAGS,           uint32_t,   photometry flags
+
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-sim.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-sim.d	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-sim.d	(revision 37451)
@@ -0,0 +1,24 @@
+STRUCT       StarPar_PS1_SIM
+EXTNAME      DVO_STELLAR_PARAMS_PS1_SIM
+TYPE         BINTABLE
+SIZE         72
+DESCRIPTION  DVO Table of Stellar Properties
+
+FIELD galLat,         GAL_LAT,       double,         galactic latitude
+FIELD galLon,         GAL_LON,       double,         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
+
+# this is the list of stellar parameters loaded from Greg Green's tables:
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/Makefile
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/Makefile	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/Makefile	(revision 37451)
@@ -38,4 +38,5 @@
 $(DESTINC)/ps1_v5_defs.h \
 $(DESTINC)/ps1_ref_defs.h \
+$(DESTINC)/ps1_sim_defs.h \
 $(DESTINC)/cmf-ps1-dv3.h \
 $(DESTINC)/cmf-ps1-v5.h \
@@ -82,4 +83,5 @@
 $(SRC)/dvo_convert_PS1_V5.$(ARCH).o \
 $(SRC)/dvo_convert_PS1_REF.$(ARCH).o \
+$(SRC)/dvo_convert_PS1_SIM.$(ARCH).o \
 $(SRC)/flatcorr_io.$(ARCH).o    \
 $(SRC)/skyregion_io.$(ARCH).o    \
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h	(revision 37451)
@@ -24,4 +24,5 @@
   DVO_FORMAT_PS1_DEV_3,
   DVO_FORMAT_PS1_REF,
+  DVO_FORMAT_PS1_SIM,
   DVO_FORMAT_PS1_V1,
   DVO_FORMAT_PS1_V2,
@@ -898,4 +899,5 @@
 # include "ps1_v5_defs.h"
 # include "ps1_ref_defs.h"
+# include "ps1_sim_defs.h"
 
 /*** DVO image db I/O Functions ***/
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_sim_defs.h
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_sim_defs.h	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_sim_defs.h	(revision 37451)
@@ -0,0 +1,14 @@
+Image 		       	*Image_PS1_SIM_ToInternal (Image_PS1_SIM *in, off_t Nvalues, off_t Nalloc);
+Image_PS1_SIM    	*ImageInternalTo_PS1_SIM (Image *in, off_t Nvalues);
+
+Average 	       	*Average_PS1_SIM_ToInternal (Average_PS1_SIM *in, off_t Nvalues, SecFilt **primary);
+Average_PS1_SIM         *AverageInternalTo_PS1_SIM (Average *in, off_t Nvalues, SecFilt *primary);
+
+Measure 	       	*Measure_PS1_SIM_ToInternal (Average *ave, Measure_PS1_SIM *in, off_t Nvalues);
+Measure_PS1_SIM         *MeasureInternalTo_PS1_SIM (Average *ave, Measure *in, off_t Nvalues);
+
+SecFilt 	       	*SecFilt_PS1_SIM_ToInternal (SecFilt_PS1_SIM *in, off_t Nvalues);
+SecFilt_PS1_SIM         *SecFiltInternalTo_PS1_SIM (SecFilt *in, off_t Nvalues);
+
+StarPar 	       	*StarPar_PS1_SIM_ToInternal (StarPar_PS1_SIM *in, off_t Nvalues);
+StarPar_PS1_SIM         *StarParInternalTo_PS1_SIM (StarPar *in, off_t Nvalues);
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37451)
@@ -58,4 +58,5 @@
   if (!strcasecmp (catformat, "PS1_V5"))          return (DVO_FORMAT_PS1_V5);
   if (!strcasecmp (catformat, "PS1_REF"))         return (DVO_FORMAT_PS1_REF);
+  if (!strcasecmp (catformat, "PS1_SIM"))         return (DVO_FORMAT_PS1_SIM);
   return (DVO_FORMAT_UNDEF);
 }
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 37451)
@@ -92,4 +92,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -287,4 +288,5 @@
   if (catalog[0].catformat == DVO_FORMAT_PS1_V5)          gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V5");
   if (catalog[0].catformat == DVO_FORMAT_PS1_REF)         gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_REF");
+  if (catalog[0].catformat == DVO_FORMAT_PS1_SIM)         gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_SIM");
 
   /* rewind file pointers and truncate file */
@@ -391,4 +393,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -443,4 +446,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -498,4 +502,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -550,4 +555,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -606,4 +612,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
@@ -658,4 +665,5 @@
       FORMAT_CASE (PS1_V5,    PS1_V5);
       FORMAT_CASE (PS1_REF,   PS1_REF);
+      FORMAT_CASE (PS1_SIM,   PS1_SIM);
 
     default:
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c	(revision 37451)
@@ -43,4 +43,5 @@
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5",          PS1_V5);
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF",         PS1_REF);
+  CONVERT_FORMAT ("DVO_AVERAGE_PS1_SIM",         PS1_SIM);
 # undef CONVERT_FORMAT
 
@@ -129,4 +130,5 @@
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5",          PS1_V5,          PS1_V5);
   CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF",         PS1_REF,         PS1_REF);
+  CONVERT_FORMAT ("DVO_AVERAGE_PS1_SIM",         PS1_SIM,         PS1_SIM);
 # undef CONVERT_FORMAT
 
@@ -165,4 +167,5 @@
       FORMAT_CASE (PS1_V5,          PS1_V5);
       FORMAT_CASE (PS1_REF,         PS1_REF);
+      FORMAT_CASE (PS1_SIM,         PS1_SIM);
 # undef FORMAT_CASE
 
@@ -240,4 +243,5 @@
   CONVERT_FORMAT ("DVO_MEASURE_PS1_V5",          PS1_V5,          PS1_V5,          TRUE);
   CONVERT_FORMAT ("DVO_MEASURE_PS1_REF",         PS1_REF,         PS1_REF,         FALSE);
+  CONVERT_FORMAT ("DVO_MEASURE_PS1_SIM",         PS1_SIM,         PS1_SIM,         TRUE);
 # undef CONVERT_FORMAT
 
@@ -278,4 +282,5 @@
       FORMAT_CASE (PS1_V5,          PS1_V5,          TRUE);
       FORMAT_CASE (PS1_REF,         PS1_REF,         FALSE);
+      FORMAT_CASE (PS1_SIM,         PS1_SIM,         TRUE);
 # undef FORMAT_CASE
 
@@ -350,4 +355,5 @@
   CONVERT_FORMAT ("DVO_SECFILT_PS1_V5",          PS1_V5,          PS1_V5);
   CONVERT_FORMAT ("DVO_SECFILT_PS1_REF",         PS1_REF,         PS1_REF);
+  CONVERT_FORMAT ("DVO_SECFILT_PS1_SIM",         PS1_SIM,         PS1_SIM);
 # undef CONVERT_FORMAT
 
@@ -386,4 +392,5 @@
       FORMAT_CASE (PS1_V5,          PS1_V5);
       FORMAT_CASE (PS1_REF,         PS1_REF);
+      FORMAT_CASE (PS1_SIM,         PS1_SIM);
 # undef FORMAT_CASE
 
@@ -626,4 +633,5 @@
   }
 
+   CONVERT_FORMAT ("DVO_STARPAR_PS1_SIM",         PS1_SIM,         PS1_SIM);
 // CONVERT_FORMAT ("DVO_STARPAR_PS1_REF",         PS1_REF,         PS1_REF);
 // CONVERT_FORMAT ("DVO_STARPAR_ELIXIR", 	  ELIXIR,  	   Elixir);
@@ -665,4 +673,5 @@
       break; }
 
+      FORMAT_CASE (PS1_SIM,         PS1_SIM);
 //    FORMAT_CASE (PS1_REF,         PS1_REF);
 //    FORMAT_CASE (ELIXIR, 	    Elixir);
@@ -751,4 +760,5 @@
   CONVERT_FORMAT ("DVO_IMAGE_PS1_V5",          PS1_V5,          PS1_V5);
   CONVERT_FORMAT ("DVO_IMAGE_PS1_REF",         PS1_REF,         PS1_REF);
+  CONVERT_FORMAT ("DVO_IMAGE_PS1_SIM",         PS1_SIM,         PS1_SIM);
 
 # undef CONVERT_FORMAT
@@ -787,4 +797,5 @@
       FORMAT_CASE (PS1_V5,          PS1_V5);
       FORMAT_CASE (PS1_REF,         PS1_REF);
+      FORMAT_CASE (PS1_SIM,         PS1_SIM);
 
 # undef FORMAT_CASE
@@ -837,4 +848,5 @@
       FORMAT_CASE (PS1_V5,          PS1_V5);
       FORMAT_CASE (PS1_REF,         PS1_REF);
+      FORMAT_CASE (PS1_SIM,         PS1_SIM);
 
 # undef FORMAT_CASE
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 37451)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 37451)
@@ -0,0 +1,425 @@
+# include <dvo.h>
+
+/* convert PS1_SIM formats to internal formats */
+
+Measure *Measure_PS1_SIM_ToInternal (Average *ave, Measure_PS1_SIM *in, off_t Nvalues) {
+
+  off_t i;
+  Measure *out;
+
+  ALLOCATE_ZERO (out, Measure, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    dvo_measure_init (&out[i]);
+
+    out[i].R          = in[i].R;
+    out[i].D          = in[i].D;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].dt         = in[i].dt;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].Xfix       = in[i].Xfix;
+    out[i].Yfix       = in[i].Yfix;
+    out[i].XoffKH     = in[i].XoffKH;
+    out[i].YoffKH     = in[i].YoffKH;
+    out[i].XoffDCR    = in[i].XoffDCR;
+    out[i].YoffDCR    = in[i].YoffDCR;
+    out[i].RoffGAL    = in[i].RoffGAL;
+    out[i].DoffGAL    = in[i].DoffGAL;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].detID      = in[i].detID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
+    out[i].imageID    = in[i].imageID;
+    out[i].psfQF      = in[i].psfQF;
+    out[i].psfQFperf  = in[i].psfQFperf;
+    out[i].photcode   = in[i].photcode;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    out[i].dRsys      = in[i].dRsys;
+    out[i].posangle   = in[i].posangle;
+    out[i].pltscale   = in[i].pltscale;
+    out[i].dbFlags    = in[i].dbFlags;
+    out[i].photFlags  = in[i].photFlags;
+  }
+  return (out);
+}
+
+Measure_PS1_SIM *MeasureInternalTo_PS1_SIM (Average *ave, Measure *in, off_t Nvalues) {
+
+  off_t i;
+  Measure_PS1_SIM *out;
+
+  ALLOCATE_ZERO (out, Measure_PS1_SIM, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].R          = in[i].R;
+    out[i].D          = in[i].D;
+    out[i].M          = in[i].M;
+    out[i].dM         = in[i].dM;
+    out[i].Mcal       = in[i].Mcal;
+    out[i].dt         = in[i].dt;
+    out[i].airmass    = in[i].airmass;
+    out[i].az         = in[i].az;
+    out[i].Xccd       = in[i].Xccd;
+    out[i].Yccd       = in[i].Yccd;
+    out[i].Xfix       = in[i].Xfix;
+    out[i].Yfix       = in[i].Yfix;
+    out[i].XoffKH     = in[i].XoffKH;
+    out[i].YoffKH     = in[i].YoffKH;
+    out[i].XoffDCR    = in[i].XoffDCR;
+    out[i].YoffDCR    = in[i].YoffDCR;
+    out[i].RoffGAL    = in[i].RoffGAL;
+    out[i].DoffGAL    = in[i].DoffGAL;
+    out[i].t          = in[i].t;
+    out[i].averef     = in[i].averef;
+    out[i].detID      = in[i].detID;
+    out[i].objID      = in[i].objID;
+    out[i].catID      = in[i].catID;
+    out[i].imageID    = in[i].imageID;
+    out[i].psfQF      = in[i].psfQF;
+    out[i].psfQFperf  = in[i].psfQFperf;
+    out[i].photcode   = in[i].photcode;
+    out[i].dXccd      = in[i].dXccd;
+    out[i].dYccd      = in[i].dYccd;
+    out[i].dRsys      = in[i].dRsys;
+    out[i].posangle   = in[i].posangle;
+    out[i].pltscale   = in[i].pltscale;
+    out[i].dbFlags    = in[i].dbFlags;
+    out[i].photFlags  = in[i].photFlags;
+  }
+  return (out);
+}
+
+// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
+Average *Average_PS1_SIM_ToInternal (Average_PS1_SIM *in, off_t Nvalues, SecFilt **primary) {
+
+  off_t i;
+  Average *out;
+
+  ALLOCATE_ZERO (out, Average, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    dvo_average_init (&out[i]);
+
+    out[i].R        	 = in[i].R;      
+    out[i].D        	 = in[i].D;      
+    out[i].dR       	 = in[i].dR;
+    out[i].dD       	 = in[i].dD;
+    out[i].uR       	 = in[i].uR;
+    out[i].uD       	 = in[i].uD;
+    out[i].duR      	 = in[i].duR;
+    out[i].duD      	 = in[i].duD;
+    out[i].P        	 = in[i].P;
+    out[i].dP       	 = in[i].dP;
+
+    out[i].ChiSqAve    	 = in[i].ChiSqAve;     
+    out[i].ChiSqPM    	 = in[i].ChiSqPM;     
+    out[i].ChiSqPar    	 = in[i].ChiSqPar;     
+    out[i].Tmean    	 = in[i].Tmean;     
+    out[i].Trange   	 = in[i].Trange;     
+
+    out[i].Npos       	 = in[i].Npos;     
+
+    out[i].Nmeasure      = in[i].Nmeasure;     
+    out[i].Nstarpar      = in[i].Nstarpar;     
+
+    out[i].measureOffset = in[i].measureOffset; 
+    out[i].starparOffset = in[i].starparOffset;
+
+    out[i].refColorBlue  = in[i].refColorBlue;
+    out[i].refColorRed   = in[i].refColorRed;
+
+    out[i].flags     	 = in[i].flags;   
+    out[i].objID 	 = in[i].objID;
+    out[i].catID 	 = in[i].catID;
+  }
+  return (out);
+}
+
+// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
+Average_PS1_SIM *AverageInternalTo_PS1_SIM (Average *in, off_t Nvalues, SecFilt *primary) {
+
+  off_t i;
+  Average_PS1_SIM *out;
+
+  ALLOCATE_ZERO (out, Average_PS1_SIM, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    out[i].R        	 = in[i].R;      
+    out[i].D        	 = in[i].D;      
+    out[i].dR       	 = in[i].dR;
+    out[i].dD       	 = in[i].dD;
+    out[i].uR       	 = in[i].uR;
+    out[i].uD       	 = in[i].uD;
+    out[i].duR      	 = in[i].duR;
+    out[i].duD      	 = in[i].duD;
+    out[i].P        	 = in[i].P;
+    out[i].dP       	 = in[i].dP;
+
+    out[i].ChiSqAve    	 = in[i].ChiSqAve;     
+    out[i].ChiSqPM    	 = in[i].ChiSqPM;     
+    out[i].ChiSqPar    	 = in[i].ChiSqPar;     
+    out[i].Tmean    	 = in[i].Tmean;     
+    out[i].Trange   	 = in[i].Trange;     
+
+    out[i].Npos       	 = in[i].Npos;     
+
+    out[i].Nmeasure      = in[i].Nmeasure;     
+    out[i].Nstarpar      = in[i].Nstarpar;     
+
+    out[i].measureOffset = in[i].measureOffset; 
+    out[i].starparOffset = in[i].starparOffset;
+
+    out[i].refColorBlue  = in[i].refColorBlue;
+    out[i].refColorRed   = in[i].refColorRed;
+
+    out[i].flags     	 = in[i].flags;   
+    out[i].objID 	 = in[i].objID;
+    out[i].catID 	 = in[i].catID;
+  }
+  return (out);
+}
+
+SecFilt *SecFilt_PS1_SIM_ToInternal (SecFilt_PS1_SIM *in, off_t Nvalues) {
+
+  off_t i;
+  SecFilt *out;
+
+  ALLOCATE_ZERO (out, SecFilt, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    dvo_secfilt_init (&out[i]);
+
+    out[i].M             = in[i].M;      
+    out[i].dM            = in[i].dM;      
+    out[i].Ncode         = in[i].Ncode;
+    out[i].Nused         = in[i].Nused;
+    out[i].flags         = in[i].flags;     
+  }
+  return (out);
+}
+
+SecFilt_PS1_SIM *SecFiltInternalTo_PS1_SIM (SecFilt *in, off_t Nvalues) {
+
+  off_t i;
+  SecFilt_PS1_SIM *out;
+
+  ALLOCATE_ZERO (out, SecFilt_PS1_SIM, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+
+    out[i].M             = in[i].M;      
+    out[i].dM            = in[i].dM;      
+    out[i].Ncode         = in[i].Ncode;
+    out[i].Nused         = in[i].Nused;
+    out[i].flags         = in[i].flags;     
+  }
+  return (out);
+}
+
+StarPar *StarPar_PS1_SIM_ToInternal (StarPar_PS1_SIM *in, off_t Nvalues) {
+
+  off_t i;
+  StarPar *out;
+
+  ALLOCATE_ZERO (out, StarPar, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    dvo_starpar_init (&out[i]);
+
+    out[i].galLat  = in[i].galLat;      
+    out[i].galLon  = in[i].galLon;      
+
+    out[i].Ebv       = in[i].Ebv     ;      
+    out[i].dEbv      = in[i].dEbv    ;      
+    out[i].DistMag   = in[i].DistMag ;      
+    out[i].dDistMag  = in[i].dDistMag;      
+    out[i].M_r       = in[i].M_r     ;      
+    out[i].dM_r      = in[i].dM_r    ;      
+    out[i].FeH       = in[i].FeH     ;      
+    out[i].dFeH      = in[i].dFeH    ;      
+    out[i].uRA       = in[i].uRA     ;      
+    out[i].uDEC      = in[i].uDEC    ;      
+
+    out[i].averef  = in[i].averef;
+    out[i].objID   = in[i].objID ;
+    out[i].catID   = in[i].catID ;
+  }
+  return (out);
+}
+
+StarPar_PS1_SIM *StarParInternalTo_PS1_SIM (StarPar *in, off_t Nvalues) {
+
+  off_t i;
+  StarPar_PS1_SIM *out;
+
+  ALLOCATE_ZERO (out, StarPar_PS1_SIM, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+
+    out[i].galLat  = in[i].galLat;      
+    out[i].galLon  = in[i].galLon;      
+
+    out[i].Ebv       = in[i].Ebv     ;      
+    out[i].dEbv      = in[i].dEbv    ;      
+    out[i].DistMag   = in[i].DistMag ;      
+    out[i].dDistMag  = in[i].dDistMag;      
+    out[i].M_r       = in[i].M_r     ;      
+    out[i].dM_r      = in[i].dM_r    ;      
+    out[i].FeH       = in[i].FeH     ;      
+    out[i].dFeH      = in[i].dFeH    ;      
+    out[i].uRA       = in[i].uRA     ;      
+    out[i].uDEC      = in[i].uDEC    ;      
+
+    out[i].averef  = in[i].averef;
+    out[i].objID   = in[i].objID ;
+    out[i].catID   = in[i].catID ;
+  }
+  return (out);
+}
+
+# define RAW_IMAGE_NAME_LEN 117
+
+Image *Image_PS1_SIM_ToInternal (Image_PS1_SIM *in, off_t Nvalues, off_t Nalloc) {
+
+  off_t i;
+  Image *out;
+
+  char *buffer;
+  ALLOCATE_ZERO (buffer, char, Nalloc);
+  out = (Image *) buffer;
+  // ALLOCATE_ZERO (out, Image, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    // this is only safe because the initial 120 bytes in Coords match CoordsDisk
+    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
+    out[i].coords.mosaic   = NULL;
+    out[i].coords.offsetMap = NULL;
+
+    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
+    strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
+    out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
+
+    out[i].tzero    	    = in[i].tzero;
+    out[i].nstar    	    = in[i].nstar;
+    out[i].secz	    	    = in[i].secz;
+    out[i].NX	    	    = in[i].NX;
+    out[i].NY	    	    = in[i].NY;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
+    out[i].Xm	    	    = in[i].Xm;
+    out[i].photcode   	    = in[i].photcode;
+    out[i].exptime  	    = in[i].exptime;
+    out[i].sidtime  	    = in[i].sidtime;
+    out[i].latitude  	    = in[i].latitude;
+
+    out[i].RAo  	    = in[i].RAo;
+    out[i].DECo  	    = in[i].DECo;
+    out[i].Radius  	    = in[i].Radius;
+    out[i].refColorBlue	    = in[i].refColorBlue;
+    out[i].refColorRed 	    = in[i].refColorRed;
+
+    out[i].detection_limit  = in[i].detection_limit;
+    out[i].saturation_limit = in[i].saturation_limit;
+    out[i].cerror	    = in[i].cerror;
+    out[i].fwhm_x	    = in[i].fwhm_x;
+    out[i].fwhm_y	    = in[i].fwhm_y;
+    out[i].trate	    = in[i].trate;
+    out[i].ccdnum	    = in[i].ccdnum;
+    out[i].flags	    = in[i].flags;
+    out[i].imageID	    = in[i].imageID;
+    out[i].parentID	    = in[i].parentID;
+    out[i].externID	    = in[i].externID;
+    out[i].sourceID	    = in[i].sourceID;
+
+    // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced
+    // with the following.  (no real databases used those values -- see
+    // libdvo/doc/dvo-images.txt)
+    out[i].nLinkAstrom	    = in[i].nLinkAstrom;
+    out[i].nLinkPhotom	    = in[i].nLinkPhotom;
+    out[i].ubercalDist	    = in[i].ubercalDist;
+    out[i].dXpixSys	    = in[i].dXpixSys;
+    out[i].dYpixSys	    = in[i].dYpixSys;
+    out[i].dMagSys	    = in[i].dMagSys;
+    out[i].nFitAstrom       = in[i].nFitAstrom;
+    out[i].nFitPhotom       = in[i].nFitPhotom;
+    out[i].photom_map_id    = in[i].photom_map_id;
+    out[i].astrom_map_id    = in[i].astrom_map_id;
+  }
+  return (out);
+}
+
+Image_PS1_SIM *ImageInternalTo_PS1_SIM (Image *in, off_t Nvalues) {
+
+  off_t i;
+  Image_PS1_SIM *out;
+
+  ALLOCATE_ZERO (out, Image_PS1_SIM, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    // this is only save because the initial 120 bytes in Coords match CoordsDisk
+    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
+
+    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
+    strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
+    out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
+
+    out[i].tzero    	    = in[i].tzero;
+    out[i].nstar    	    = in[i].nstar;
+    out[i].secz	    	    = in[i].secz;
+    out[i].NX	    	    = in[i].NX;
+    out[i].NY	    	    = in[i].NY;
+    out[i].apmifit  	    = in[i].apmifit;
+    out[i].dapmifit 	    = in[i].dapmifit;
+    out[i].Mcal	    	    = in[i].Mcal;
+    out[i].dMcal    	    = in[i].dMcal;
+    out[i].Xm	    	    = in[i].Xm;
+    out[i].photcode   	    = in[i].photcode;
+    out[i].exptime  	    = in[i].exptime;
+    out[i].sidtime  	    = in[i].sidtime;
+    out[i].latitude  	    = in[i].latitude;
+
+    out[i].RAo  	    = in[i].RAo;
+    out[i].DECo  	    = in[i].DECo;
+    out[i].Radius  	    = in[i].Radius;
+    out[i].refColorBlue	    = in[i].refColorBlue;
+    out[i].refColorRed 	    = in[i].refColorRed;
+
+    out[i].detection_limit  = in[i].detection_limit;
+    out[i].saturation_limit = in[i].saturation_limit;
+    out[i].cerror	    = in[i].cerror;
+    out[i].fwhm_x	    = in[i].fwhm_x;
+    out[i].fwhm_y	    = in[i].fwhm_y;
+    out[i].trate	    = in[i].trate;
+    out[i].ccdnum	    = in[i].ccdnum;
+    out[i].flags	    = in[i].flags;
+    out[i].imageID	    = in[i].imageID;
+    out[i].parentID	    = in[i].parentID;
+    out[i].externID	    = in[i].externID;
+    out[i].sourceID	    = in[i].sourceID;
+
+    // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced
+    // with the following.  (no real databases used those values -- see
+    // libdvo/doc/dvo-images.txt)
+    out[i].nLinkAstrom	    = in[i].nLinkAstrom;
+    out[i].nLinkPhotom	    = in[i].nLinkPhotom;
+    out[i].ubercalDist	    = in[i].ubercalDist;
+    out[i].dXpixSys	    = in[i].dXpixSys;
+    out[i].dYpixSys	    = in[i].dYpixSys;
+    out[i].dMagSys	    = in[i].dMagSys;
+    out[i].nFitAstrom       = in[i].nFitAstrom;
+    out[i].nFitPhotom       = in[i].nFitPhotom;
+    out[i].photom_map_id    = in[i].photom_map_id;
+    out[i].astrom_map_id    = in[i].astrom_map_id;
+  }
+  return (out);
+}
+
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image.c	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image.c	(revision 37451)
@@ -221,4 +221,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V5)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V5");
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_REF");
+  if (db[0].format == DVO_FORMAT_PS1_SIM)         gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_SIM");
   
   return;
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 37450)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 37451)
@@ -61,4 +61,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V5)          ImageSize = sizeof(Image_PS1_V5);
   if (db[0].format == DVO_FORMAT_PS1_REF)         ImageSize = sizeof(Image_PS1_REF);
+  if (db[0].format == DVO_FORMAT_PS1_SIM)         ImageSize = sizeof(Image_PS1_SIM);
 
   /* check that filesize makes sense */
@@ -92,4 +93,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V5)          gfits_table_mkheader_Image_PS1_V5 (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_table_mkheader_Image_PS1_REF (&db[0].theader);
+  if (db[0].format == DVO_FORMAT_PS1_SIM)         gfits_table_mkheader_Image_PS1_SIM (&db[0].theader);
     
   /* read data from file */
