Index: /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure-ps1-v3.d
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure-ps1-v3.d	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure-ps1-v3.d	(revision 34138)
@@ -5,9 +5,9 @@
 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 Map,            M_APER,       float,          aperture mag,		  mag
+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 Map,            M_APER,       float,          aperture mag,                 mag
 FIELD dM,             MAG_ERR,      float,          mag error,                    mag
 FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error, mag
@@ -15,5 +15,5 @@
 
 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
-FIELD airmass,        AIRMASS,      float,          (airmass - 1),		  airmass
+FIELD airmass,        AIRMASS,      float,          (airmass - 1),                airmass
 FIELD az,             AZ,           float,          telescope azimuth
 
@@ -26,5 +26,5 @@
 FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
 
-FIELD t,              TIME,         int,   	    time in seconds (UNIX)
+FIELD t,              TIME,         int,            time in seconds (UNIX)
 FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
 
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure.d
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure.d	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/measure.d	(revision 34138)
@@ -2,14 +2,14 @@
 EXTNAME      DVO_MEASURE
 TYPE         BINTABLE
-SIZE         160
+SIZE         156
 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 Map,            M_APER,       float,          aperture mag,		    mag
-FIELD Mkron,	      M_KRON,	    float,	    kron magnitude,		    mag
-FIELD dMkron,	      M_KRON_ERR,   float,	    kron magnitude error,	    mag
+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 Map,            M_APER,       float,          aperture mag,                   mag
+FIELD Mkron,          M_KRON,       float,          kron magnitude,                 mag
+FIELD dMkron,         M_KRON_ERR,   float,          kron magnitude error,           mag
 FIELD dM,             MAG_ERR,      float,          mag error,                      mag
 FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error,   mag
@@ -17,5 +17,5 @@
 
 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
-FIELD airmass,        AIRMASS,      float,          (airmass - 1),		    airmass
+FIELD airmass,        AIRMASS,      float,          (airmass - 1),                  airmass
 FIELD az,             AZ,           float,          telescope azimuth
 
@@ -28,5 +28,5 @@
 FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,     counts/sec
 
-FIELD t,              TIME,         int,   	    time in seconds (UNIX)
+FIELD t,              TIME,         int,            time in seconds (UNIX)
 FIELD t_msec,         TIME_MSEC,    unsigned short, time fraction of second,        milliseconds
 FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/Makefile
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/Makefile	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/Makefile	(revision 34138)
@@ -35,4 +35,5 @@
 $(DESTINC)/ps1_v2_defs.h \
 $(DESTINC)/ps1_v3_defs.h \
+$(DESTINC)/ps1_v4_defs.h \
 $(DESTINC)/ps1_ref_defs.h
 
@@ -73,4 +74,5 @@
 $(SRC)/dvo_convert_PS1_V2.$(ARCH).o \
 $(SRC)/dvo_convert_PS1_V3.$(ARCH).o \
+$(SRC)/dvo_convert_PS1_V4.$(ARCH).o \
 $(SRC)/dvo_convert_PS1_REF.$(ARCH).o \
 $(SRC)/flatcorr_io.$(ARCH).o    \
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/doc/notes.txt
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/doc/notes.txt	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/doc/notes.txt	(revision 34138)
@@ -25,8 +25,10 @@
    include the new STRUCT name.
 
-7) create a new conversion file dvo_convert_foo.c and define the
+7) create a new conversion file libdvo/src/dvo_convert_foo.c and define the
    internal to Foo conversions.
 
-8) add the new format to the list of FORMAT conversion in dvo_convert.c.
+8a) add the new dvo_convert_foo.c to libdvo/Makefile
+
+8b) add the new format to the list of FORMAT conversion in dvo_convert.c.
 
 9) any changes to the internal format need to be reflected in the
@@ -44,4 +46,8 @@
 
 13) Add the conversion functions to the header file libdvo/include/foo_defs.h
+
+14) Add the above foo_defs.h to libdvo/include/dvo.h
+
+14) Add the above foo_defs.h to libdvo/Makefile
 
 * Note some esoteric format issues:  
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/dvo.h	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/dvo.h	(revision 34138)
@@ -572,4 +572,5 @@
 # include "ps1_v2_defs.h"
 # include "ps1_v3_defs.h"
+# include "ps1_v4_defs.h"
 # include "ps1_ref_defs.h"
 
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/ps1_v4_defs.h
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/ps1_v4_defs.h	(revision 34138)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/ps1_v4_defs.h	(revision 34138)
@@ -0,0 +1,11 @@
+Image 		       	*Image_PS1_V4_ToInternal (Image_PS1_V4 *in, off_t Nvalues);
+Image_PS1_V4    	*ImageInternalTo_PS1_V4 (Image *in, off_t Nvalues);
+Average 	       	*Average_PS1_V4_ToInternal (Average_PS1_V4 *in, off_t Nvalues, SecFilt **primary);
+Average_PS1_V4          *AverageInternalTo_PS1_V4 (Average *in, off_t Nvalues, SecFilt *primary);
+Measure 	       	*Measure_PS1_V4_ToInternal (Measure_PS1_V4 *in, off_t Nvalues);
+Measure_PS1_V4          *MeasureInternalTo_PS1_V4 (Measure *in, off_t Nvalues);
+SecFilt 	       	*SecFilt_PS1_V4_ToInternal (SecFilt_PS1_V4 *in, off_t Nvalues);
+SecFilt_PS1_V4          *SecFiltInternalTo_PS1_V4 (SecFilt *in, off_t Nvalues);
+
+PhotCode                *PhotCode_PS1_V4_To_Internal (PhotCode_PS1_V4 *in, off_t Nvalues);
+PhotCode_PS1_V4         *PhotCode_Internal_To_PS1_V4 (PhotCode *in, off_t Nvalues);
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/LoadPhotcodesFITS.c	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/LoadPhotcodesFITS.c	(revision 34138)
@@ -63,4 +63,5 @@
   CONVERT_FORMAT("DVO_PHOTCODE_PS1_V2",    PS1_V2);
   CONVERT_FORMAT("DVO_PHOTCODE_PS1_V3",    PS1_V3);
+  CONVERT_FORMAT("DVO_PHOTCODE_PS1_V4",    PS1_V4);
 
   table = GetPhotcodeTable ();
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/SavePhotcodesFITS.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/SavePhotcodesFITS.c	(revision 34138)
@@ -4,4 +4,5 @@
 /* locking is used to avoid collisions with programs trying to update the photcodes values */
 /* XXX better distinction between NOT FOUND and FAILURE */
+
 int SavePhotcodesFITS (char *filename) {
 
@@ -29,9 +30,9 @@
   // for the moment, we simply support the latest photcode format for output
   // XXX update this as needed as new formats are defined
-  PhotCode_PS1_V3 *photcode_output = PhotCode_Internal_To_PS1_V3 (table[0].code, table[0].Ncode);
+  PhotCode_PS1_V4 *photcode_output = PhotCode_Internal_To_PS1_V4 (table[0].code, table[0].Ncode);
 
   /* convert FITS format data to internal format (byteswaps & EXTNAME) */
   if (!gfits_db_create (&db)) return (FALSE);
-  if (!gfits_table_set_PhotCode_PS1_V3 (&db.ftable, photcode_output, table[0].Ncode)) return (FALSE);
+  if (!gfits_table_set_PhotCode_PS1_V4 (&db.ftable, photcode_output, table[0].Ncode)) return (FALSE);
   if (!gfits_db_save (&db)) return (FALSE);
   if (!gfits_db_close (&db)) return (FALSE);
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image.c	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image.c	(revision 34138)
@@ -212,4 +212,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V2)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V2");
   if (db[0].format == DVO_FORMAT_PS1_V3)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V3");
+  if (db[0].format == DVO_FORMAT_PS1_V4)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V4");
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_REF");
   
Index: /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image_raw.c
===================================================================
--- /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 34137)
+++ /branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_image_raw.c	(revision 34138)
@@ -58,4 +58,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V2)          ImageSize = sizeof(Image_PS1_V2);
   if (db[0].format == DVO_FORMAT_PS1_V3)          ImageSize = sizeof(Image_PS1_V3);
+  if (db[0].format == DVO_FORMAT_PS1_V4)          ImageSize = sizeof(Image_PS1_V4);
   if (db[0].format == DVO_FORMAT_PS1_REF)         ImageSize = sizeof(Image_PS1_REF);
 
@@ -87,4 +88,5 @@
   if (db[0].format == DVO_FORMAT_PS1_V2)          gfits_table_mkheader_Image_PS1_V2 (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PS1_V3)          gfits_table_mkheader_Image_PS1_V3 (&db[0].theader);
+  if (db[0].format == DVO_FORMAT_PS1_V4)          gfits_table_mkheader_Image_PS1_V4 (&db[0].theader);
   if (db[0].format == DVO_FORMAT_PS1_REF)         gfits_table_mkheader_Image_PS1_REF (&db[0].theader);
     
