Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/include/addstar.h
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/include/addstar.h	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/include/addstar.h	(revision 34383)
@@ -269,14 +269,4 @@
 int 	   NewReflist_Thread	  PROTO((int BindSocket));
 
-Stars     *Convert_SMPDATA	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_DEV_0	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_DEV_1	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_V1	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_V1_Alt	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_V2	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_V3	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_SV1	  PROTO((FTable *table, unsigned int *nstars));
-Stars     *Convert_PS1_SV1_Alt	  PROTO((FTable *table, unsigned int *nstars));
-
 int        InitStar               PROTO((Stars *star));
 
Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/MatchHeaders.c
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/MatchHeaders.c	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/MatchHeaders.c	(revision 34383)
@@ -58,5 +58,7 @@
     if (!strcmp (exttype, "PS1_V2")) goto keep;
     if (!strcmp (exttype, "PS1_V3")) goto keep;
+    if (!strcmp (exttype, "PS1_V4")) goto keep;
     if (!strcmp (exttype, "PS1_SV1")) goto keep;
+    if (!strcmp (exttype, "PS1_SV2")) goto keep;
     continue;
 
Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/ReadStarsFITS.c
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/ReadStarsFITS.c	(revision 34383)
@@ -1,3 +1,18 @@
 # include "addstar.h"
+
+// this is the complete list of FITS format input files the addstar knows 
+// (excluding SDSS data and reference database info, such as 2MASS)
+// NOTE: these must also be listed in MatchHeaders.c (line ~ 62)
+Stars     *Convert_SMPDATA	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_DEV_0	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_DEV_1	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_V1	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_V1_Alt	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_V2	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_V3	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_V4	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_SV1	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_SV1_Alt	  PROTO((FTable *table, unsigned int *nstars));
+Stars     *Convert_PS1_SV2	  PROTO((FTable *table, unsigned int *nstars));
 
 // given a file with the pointer at the start of the table block and the 
@@ -54,6 +69,12 @@
     stars = Convert_PS1_V3 (&table, &Nstars);
   }
+  if (!strcmp (type, "PS1_V4")) {
+    stars = Convert_PS1_V4 (&table, &Nstars);
+  }
   if (!strcmp (type, "PS1_SV1")) {
     stars = Convert_PS1_SV1 (&table, &Nstars);
+  }
+  if (!strcmp (type, "PS1_SV2")) {
+    stars = Convert_PS1_SV2 (&table, &Nstars);
   }
   if (stars == NULL) {
@@ -616,5 +637,5 @@
 }
 
-Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
+Stars *Convert_PS1_V4 (FTable *table, unsigned int *nstars) {
 
   off_t Nstars; 
@@ -622,12 +643,7 @@
   double ZeroPt;
   Stars *stars;
-  CMF_PS1_SV1 *ps1data;
-
-  if (table[0].header[0].Naxis[0] == 196) {
-    stars = Convert_PS1_SV1_Alt (table, nstars);
-    return (stars);
-  }
-
-  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
+  CMF_PS1_V4 *ps1data;
+
+  ps1data = gfits_table_get_CMF_PS1_V4 (table, &Nstars, NULL);
   if (!ps1data) {
     fprintf (stderr, "skipping inconsistent entry\n");
@@ -658,5 +674,5 @@
     stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
-
+                        
     // these fluxes are converted from counts to counts/sec in FilterStars.c
     stars[i].measure.FluxPSF    = ps1data[i].Flux;
@@ -689,6 +705,9 @@
 
     // the Average fields and the following Measure fields are set in FilterStars after
-    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 
-    // averef is set in find_matches, dbFlags is zero on ingest.
+    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
+
+    // averef is set in find_matches
+
+    // dbFlags is zero on ingest.
 
     // the following fields are currently not being set anywhere: t_msec
@@ -698,5 +717,5 @@
 }
 
-Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
+Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
 
   off_t Nstars; 
@@ -706,7 +725,10 @@
   CMF_PS1_SV1 *ps1data;
 
-  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
-
-  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
+  if (table[0].header[0].Naxis[0] == 196) {
+    stars = Convert_PS1_SV1_Alt (table, nstars);
+    return (stars);
+  }
+
+  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
   if (!ps1data) {
     fprintf (stderr, "skipping inconsistent entry\n");
@@ -777,2 +799,159 @@
 }
 
+Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
+
+  off_t Nstars; 
+  unsigned int i;
+  double ZeroPt;
+  Stars *stars;
+  CMF_PS1_SV1 *ps1data;
+
+  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
+
+  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
+  if (!ps1data) {
+    fprintf (stderr, "skipping inconsistent entry\n");
+    return (NULL);
+  }
+  ZeroPt = GetZeroPoint();
+
+  ALLOCATE (stars, Stars, Nstars);
+  for (i = 0; i < Nstars; i++) {
+    InitStar (&stars[i]);
+    stars[i].measure.Xccd       = ps1data[i].X;
+    stars[i].measure.Yccd       = ps1data[i].Y;
+    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
+    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
+
+    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
+    stars[i].measure.pltscale   = ps1data[i].pltscale;
+
+    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
+      stars[i].measure.M      = NAN;
+    } else {
+      stars[i].measure.M      = ps1data[i].M + ZeroPt;
+    }
+    stars[i].measure.dM         = ps1data[i].dM;
+    stars[i].measure.dMcal      = ps1data[i].dMcal;
+    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
+                        
+    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
+    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
+
+    // these fluxes are converted from counts to counts/sec in FilterStars.c
+    stars[i].measure.FluxPSF    = ps1data[i].Flux;
+    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
+    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
+    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
+
+    stars[i].measure.Sky        = ps1data[i].sky;
+    stars[i].measure.dSky       = ps1data[i].dSky;
+                        
+    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
+    stars[i].measure.psfQF      = ps1data[i].psfQF;
+    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
+    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
+    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
+    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
+
+    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
+    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
+    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
+
+    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
+    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
+    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
+                        
+    stars[i].measure.photFlags  = ps1data[i].flags;
+
+    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
+    stars[i].measure.detID      = ps1data[i].detID; 
+
+    // the Average fields and the following Measure fields are set in FilterStars after
+    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 
+    // averef is set in find_matches, dbFlags is zero on ingest.
+
+    // the following fields are currently not being set anywhere: t_msec
+  }    
+  *nstars = Nstars;
+  return (stars);
+}
+
+Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) {
+
+  off_t Nstars; 
+  unsigned int i;
+  double ZeroPt;
+  Stars *stars;
+  CMF_PS1_SV2 *ps1data;
+
+  ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
+  if (!ps1data) {
+    fprintf (stderr, "skipping inconsistent entry\n");
+    return (NULL);
+  }
+  ZeroPt = GetZeroPoint();
+
+  ALLOCATE (stars, Stars, Nstars);
+  for (i = 0; i < Nstars; i++) {
+    InitStar (&stars[i]);
+    stars[i].measure.Xccd       = ps1data[i].X;
+    stars[i].measure.Yccd       = ps1data[i].Y;
+    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
+    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
+
+    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
+    stars[i].measure.pltscale   = ps1data[i].pltscale;
+
+    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
+      stars[i].measure.M      = NAN;
+    } else {
+      stars[i].measure.M      = ps1data[i].M + ZeroPt;
+    }
+    stars[i].measure.dM         = ps1data[i].dM;
+    stars[i].measure.dMcal      = ps1data[i].dMcal;
+    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
+                        
+    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
+    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
+
+    // these fluxes are converted from counts to counts/sec in FilterStars.c
+    stars[i].measure.FluxPSF    = ps1data[i].Flux;
+    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
+    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
+    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
+
+    stars[i].measure.Sky        = ps1data[i].sky;
+    stars[i].measure.dSky       = ps1data[i].dSky;
+                        
+    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
+    stars[i].measure.psfQF      = ps1data[i].psfQF;
+    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
+    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
+    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
+    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
+
+    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
+    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
+    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
+
+    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
+    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
+    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
+                        
+    stars[i].measure.photFlags  = ps1data[i].flags;
+
+    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
+    stars[i].measure.detID      = ps1data[i].detID; 
+
+    // the Average fields and the following Measure fields are set in FilterStars after
+    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 
+    // averef is set in find_matches, dbFlags is zero on ingest.
+
+    // the following fields are currently not being set anywhere: t_msec
+  }    
+  *nstars = Nstars;
+  return (stars);
+}
+
+
Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/mkcmf.c
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/mkcmf.c	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/src/mkcmf.c	(revision 34383)
@@ -14,4 +14,5 @@
 void gauss_init (int Nbin);
 double rnd_gauss (double mean, double sigma);
+void writeStars_PS1_V4 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
 void writeStars_PS1_V3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
@@ -281,4 +282,8 @@
   if (!strcmp(type, "PS1_V3")) {
     writeStars_PS1_V3 (&ftable, X, Y, M, Flag, Nstars); 
+    found = TRUE;
+  }
+  if (!strcmp(type, "PS1_V4")) {
+    writeStars_PS1_V4 (&ftable, X, Y, M, Flag, Nstars); 
     found = TRUE;
   }
@@ -635,2 +640,62 @@
 }
 
+void writeStars_PS1_V4 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
+
+  int i;
+  CMF_PS1_V4 *stars;
+  float flux, fSN;
+
+  // XXX add gaussian-distributed noise based on counts
+  // this needs to make different output 'stars' entries depending on the desired type
+  ALLOCATE (stars, CMF_PS1_V4, Nstars);
+  gauss_init (2048);
+  for (i = 0; i < Nstars; i++) {
+    stars[i].detID = i;
+
+    flux = pow (10.0, -0.4*M[i]);
+    fSN = 1.0 / sqrt(flux);
+
+    stars[i].X = X[i];
+    stars[i].Y = Y[i];
+    stars[i].M = M[i];
+    stars[i].Map = M[i] - 0.05;
+
+    if (ADDNOISE) {
+      stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0);
+      stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0);
+      stars[i].M += fSN*rnd_gauss(0.0, 1.0);
+    }
+
+    // randomly give poor PSFQF values
+    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
+      stars[i].psfQF     = 0.25;
+      stars[i].psfQFperf = 0.24;
+    } else {
+      stars[i].psfQF     = PSFQUAL;
+      stars[i].psfQFperf = MAX(PSFQUAL - 0.01, 0.0);
+    }
+    
+    stars[i].dX = FX * fSN;
+    stars[i].dY = FY * fSN;
+    stars[i].dM = fSN;
+
+    stars[i].Mpeak     = M[i] + 1.0;
+    stars[i].sky       = SKY;
+    stars[i].dSky      = DSKY;
+    stars[i].psfChisq  = PSFCHI;
+    stars[i].crNsigma  = CRN;
+    stars[i].extNsigma = EXTN;
+    stars[i].fx        = FX;
+    stars[i].fy        = FY;
+    stars[i].df        = DF;
+    stars[i].nFrames   = 1;
+    stars[i].flags     = Flag[i];
+
+    stars[i].kronFlux  = flux * 1.25;
+    stars[i].kronFluxErr = fSN * flux * 1.25;
+  }
+
+  gfits_table_set_CMF_PS1_V4 (ftable, stars, Nstars);
+  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V4");
+}
+
Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/simple.dvo
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/simple.dvo	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/simple.dvo	(revision 34383)
@@ -4,4 +4,5 @@
 
 macro test.all
+  # test.fields (DVO schema) (CMF format)
   test.fields PS1_DEV_0 PS1_V1
   test.fields PS1_DEV_1 PS1_V1
@@ -9,4 +10,5 @@
   test.fields PS1_V2 	PS1_V1
   test.fields PS1_V3 	PS1_V1
+  test.fields PS1_V4 	PS1_V1
 
   test.fields PS1_DEV_0 PS1_V2
@@ -15,4 +17,5 @@
   test.fields PS1_V2 	PS1_V2
   test.fields PS1_V3 	PS1_V2
+  test.fields PS1_V4 	PS1_V4
 
   test.fields PS1_DEV_0 PS1_V3
@@ -21,4 +24,5 @@
   test.fields PS1_V2 	PS1_V3
   test.fields PS1_V3 	PS1_V3
+  test.fields PS1_V4 	PS1_V4
 
   test.fields PS1_DEV_0 PS1_V4
@@ -27,4 +31,5 @@
   test.fields PS1_V2 	PS1_V4
   test.fields PS1_V3 	PS1_V4
+  test.fields PS1_V4 	PS1_V4
 end  
 
@@ -36,5 +41,6 @@
   end
 
-  tapPLAN 51
+  echo ""
+  echo "testing --- CMF = $1, DVO = $2 ---"
 
   exec rm -rf catdir.test
@@ -45,7 +51,14 @@
   mkinput
   exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1
-  exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
+  if ($TAP_VERBOSE)
+    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
+  else
+    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass >& tmp.log
+  end
 
   list testfields -copy testfields_$1
+
+  # set the number of tests based on the testfields list
+  tapPLAN {3 + 3*($testfields:n - 1)}
 
   catdir catdir.test
@@ -77,6 +90,12 @@
   for i 1 $testfields:n
     list name -split $testfields:$i
-    if ("$name:0" == "SKIP") continue
-    if ("$name:2" == "SKIP") continue
+    if ("$name:0" == "SKIP") 
+      tapSKIP 3
+      continue
+    end
+    if ("$name:2" == "SKIP") 
+      tapSKIP 3
+      continue
+    end
     # must be the same length
     set v1 = $name:0
@@ -106,5 +125,5 @@
     # THETA is stored to only (360/65536) deg accuracy
     if ("$name:0" == "PSF_THETA")
-      echo $MEAN
+      # echo $MEAN
       tapOK {abs($MEAN)  < 0.006} "$name:0 vs $name:2 (MEAN)"
       tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
@@ -304,2 +323,52 @@
   N_FRAMES          : SKIP # not ingested into DVO
 end
+
+# this list is good for PS1_V4
+list testfields_PS1_V4
+  IPP_IDET          : detid	
+  X_PSF             : xccd	
+  Y_PSF             : yccd	
+  X_PSF_SIG         : xccd:err # FAIL
+  Y_PSF_SIG         : yccd:err # FAIL
+  POSANGLE          : SKIP # astrometry is not calibrated in the cmf
+  PLTSCALE          : SKIP # astrometry is not calibrated in the cmf
+  PSF_INST_MAG      : mag:inst	
+  PSF_INST_MAG_SIG  : mag:err	
+  PSF_INST_FLUX     : SKIP # not ingested into DVO
+  PSF_INST_FLUX_SIG : SKIP # not ingested into DVO
+  AP_MAG_STANDARD   : mag:aperinst # FAIL
+  AP_MAG_RAW        : SKIP # not ingested into DVO
+  AP_MAG_RADIUS     : SKIP # not ingested into DVO
+  CAL_PSF_MAG       : SKIP # photometry is not calibrated in the cmf
+  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
+  RA_PSF            : SKIP # astrometry is not calibrated in the cmf
+  DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
+  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
+  SKY               : sky	
+  SKY_SIG           : sky_err	
+  PSF_CHISQ         : psf_chisq	
+  CR_NSIGMA         : cr_nsigma	
+  EXT_NSIGMA        : ext_nsigma
+  PSF_MAJOR         : FWHM_MAJ	
+  PSF_MINOR         : FWHM_MIN	
+  PSF_THETA         : THETA # FAIL
+  PSF_QF            : PSF_QF	
+  PSF_QF_PERFECT    : SKIP # not ingested into DVO
+  PSF_NDOF          : PSF_NDOF
+  PSF_NPIX          : PSF_NPIX
+  MOMENTS_XX        : MXX
+  MOMENTS_XY        : MXY
+  MOMENTS_YY        : MYY
+  MOMENTS_M3C       : SKIP # not ingested into DVO
+  MOMENTS_M3S       : SKIP # not ingested into DVO
+  MOMENTS_M4C       : SKIP # not ingested into DVO
+  MOMENTS_M4S       : SKIP # not ingested into DVO
+  MOMENTS_R1        : SKIP # not ingested into DVO
+  MOMENTS_RH        : SKIP # not ingested into DVO
+  KRON_FLUX         : mag:kroninst
+  KRON_FLUX_ERR     : mag:kronerr
+  KRON_FLUX_INNER   : SKIP # not ingested into DVO
+  KRON_FLUX_OUTER   : SKIP # not ingested into DVO
+  FLAGS             : phot_flags
+  N_FRAMES          : SKIP # not ingested into DVO
+end
Index: /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/tap.dvo
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/tap.dvo	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/addstar/test/tap.dvo	(revision 34383)
@@ -2,4 +2,5 @@
 
 if (not($?TAP_BREAK)) set TAP_BREAK = 0
+if (not($?TAP_VERBOSE)) set TAP_VERBOSE = 0
 
 macro tapOK
@@ -10,5 +11,7 @@
 
   if ($1)
-    echo "ok : $2"
+    if ($TAP_VERBOSE)
+      echo "ok : $2"
+    end
     $TAP_LAST = 1
   else
@@ -42,6 +45,6 @@
   end
 
-  $TAP_NSKIP ++
-  $TAP_NDONE ++
+  $TAP_NSKIP += $1
+  $TAP_NDONE += $1
 end
 
Index: /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-sv2.d
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-sv2.d	(revision 34383)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-sv2.d	(revision 34383)
@@ -0,0 +1,140 @@
+# name of structure type
+STRUCT  CMF_PS1_SV2
+EXTNAME CMF_PS1_SV2
+TYPE    BINTABLE
+SIZE    208
+
+## note that this definition is inconsistent with the definition in
+## pmModules/src/objects/pmSourceIO_CMF.c.in.  The version in
+## pmSourceIO*.c creates a table with data not properly aligned with
+## the 8-byte boundaries. The structure defined by libautocode does
+## this, but has a different order of elements (and adds padding2 to
+## fix things). We have generated may files with PS1_SV1 as is, so
+## I'll leave it. But in future a PS1_SV2 should be forced to match
+## libautocode. Note that addstar knows to detect the alternate
+## version of PS1_SV1 and correctly interpret its fields.
+
+# elements of data structure / FITS table
+FIELD detID,          IPP_IDET,          unsigned int, detection ID                     
+FIELD X,              X_PSF,             float,    x coord,               pixels
+FIELD Y,              Y_PSF,             float,    y coord,               pixels
+FIELD dX,             X_PSF_SIG,         float,    x coord error,         pixels
+
+FIELD dY,             Y_PSF_SIG,         float,    y coord error,         pixels
+FIELD posangle,       POSANGLE,          float,    Posangle at source,    degrees
+FIELD pltscale,       PLTSCALE,          float,    Plate Scale at source, arcsec/pixel
+FIELD M,              PSF_INST_MAG,      float,    inst mags,             mags
+
+FIELD dM,             PSF_INST_MAG_SIG,  float,    inst mag error,        mags
+FIELD Flux,           PSF_INST_FLUX,     float,    psf flux,	       counts
+FIELD dFlux,          PSF_INST_FLUX_SIG, float,    psf flux error,        counts      
+FIELD Map,            AP_MAG_STANDARD,   float,    standard aperture mag, mags
+
+FIELD MapRaw,         AP_MAG_RAW,        float,    raw aperture mag,      mags
+FIELD apRadius,       AP_MAG_RADIUS,     float,    radius used for fit,   pixels
+FIELD apFlux,         AP_FLUX,           float,    aperture flux,         counts
+FIELD apFluxErr,      AP_FLUX_SIG,       float,    error on ap flux,      counts
+
+FIELD Mcalib,         CAL_PSF_MAG,       float,    calibrated psf mag,    mags
+FIELD dMcal,          CAL_PSF_MAG_SIG,   float,    zero point scatter,    mags
+
+# NOTE: RA & DEC (both double) need to be on an 8-byte boundary...
+FIELD RA,             RA_PSF,            double,   PSF RA coord,          degrees
+FIELD DEC,            DEC_PSF,           double,   PSF DEC coord,         degrees
+
+FIELD Mpeak,          PEAK_FLUX_AS_MAG,  float,    peak flux as a mag,    mags
+FIELD sky,            SKY,               float,    sky flux,              cnts/sec
+FIELD dSky,           SKY_SIG,           float,    sky flux error,        cnts/sec
+FIELD psfChisq,       PSF_CHISQ,         float,    psf fit chisq
+
+FIELD crNsigma,       CR_NSIGMA,         float,    Nsigma deviations from PSF to CF
+FIELD extNsigma,      EXT_NSIGMA,        float,    Nsigma deviations from PSF to EXT
+FIELD fx,             PSF_MAJOR,         float,    psf fit major axis,    pixels
+FIELD fy,             PSF_MINOR,         float,    psf fit minor axis,    pixels
+
+FIELD df,             PSF_THETA,         float,    ellipse angle,         degrees
+FIELD psfQF,          PSF_QF,            float,    quality factor
+FIELD psfQFperf,      PSF_QF_PERFECT,    float,    quality factor perfect
+FIELD psfNdof,        PSF_NDOF,          int,      psf degrees of freedom
+
+FIELD psfNpix,        PSF_NPIX,          int,      psf number of pixels
+FIELD Mxx,            MOMENTS_XX,        float,    second moment X,       pixels^2
+FIELD Mxy,            MOMENTS_XY,        float,    second moment Y,       pixels^2
+FIELD Myy,            MOMENTS_YY,        float,    second moment XY,      pixels^2
+
+FIELD M3c,            MOMENTS_M3C,       float,    third moment cos(t),   pixels^3
+FIELD M3s,            MOMENTS_M3S,       float,    third moment sin(t),   pixels^3
+FIELD M4c,            MOMENTS_M4C,       float,    fourth moment cos(t),  pixels^4
+FIELD M4s,            MOMENTS_M4S,       float,    fourth moment sin(t),  pixels^4
+
+FIELD Mr1,            MOMENTS_R1,        float,    first radial moment,   pixels
+FIELD Mrh,            MOMENTS_RH,        float,    half radial moment,    pixels^1/2
+FIELD kronFlux,       KRON_FLUX,         float,    kron flux,             counts
+FIELD kronFluxErr,    KRON_FLUX_ERR,     float,    kron flux error,       counts
+
+FIELD kronInner,      KRON_FLUX_INNER,   float,    kron flux 1<R<2.5,     counts
+FIELD kronOuter,      KRON_FLUX_OUTER,   float,    kron flux 2.5<R<4,     counts
+FIELD flags,          FLAGS,             int,      analysis flags
+FIELD flags2,         FLAGS2,            int,      analysis flags (2)
+
+FIELD padding2,       PADDING2,          int,      padding for 8byte records
+FIELD nFrames,        N_FRAMES,          short,    images overlapping peak
+FIELD padding,        PADDING,           short,    padding for 8byte records
+
+# for an object in an image, we have three triplets that tell us about the shape:
+# second moments: Mxx, Mxy, Myy 
+# model shape parameters: F_major, F_minor, F_theta
+# centroid errors: sigma_X, sigma_Y, sigma_XY
+
+# # elements of data structure / FITS table
+# FIELD detID,          IPP_IDET,          IPP_IDET           1J      unsigned int, detection ID                     
+# FIELD X,              X_PSF,             X_PSF              1E      float,    x coord,               pixels
+# FIELD Y,              Y_PSF,             Y_PSF              1E      float,    y coord,               pixels
+# FIELD dX,             X_PSF_SIG,         X_PSF_SIG          1E      float,    x coord error,         pixels
+# FIELD dY,             Y_PSF_SIG,         Y_PSF_SIG          1E      float,    y coord error,         pixels
+# FIELD posangle,       POSANGLE,          POSANGLE           1E      float,    Posangle at source,    degrees
+# FIELD pltscale,       PLTSCALE,          PLTSCALE           1E      float,    Plate Scale at source, arcsec/pixel
+# FIELD M,              PSF_INST_MAG,      PSF_INST_MAG       1E      float,    inst mags,             mags
+# FIELD dM,             PSF_INST_MAG_SIG,  PSF_INST_MAG_SIG   1E      float,    inst mag error,        mags
+# FIELD flux,           PSF_INST_FLUX,     PSF_INST_FLUX      1E      float,    psf flux,	       counts
+# FIELD flux,           PSF_INST_FLUX_SIG, PSF_INST_FLUX_SIG  1E      float,    psf flux error,        counts      
+# FIELD Map,            AP_MAG_STANDARD,   AP_MAG             1E      float,    standard aperture mag, mags
+# FIELD Map,            AP_MAG_RAW,        AP_MAG_RAW         1E      float,    raw aperture mag,      mags
+# FIELD apRadius,       AP_MAG_RADIUS,     AP_MAG_RADIUS      1E      float,    radius used for fit,   pixels
+# FIELD Mpeak,          PEAK_FLUX_AS_MAG,  PEAK_FLUX_AS_MAG   1E      float,    peak flux as a mag,    mags
+# FIELD Mcalib,         CAL_PSF_MAG,       CAL_PSF_MAG        1E      float,    calibrated psf mag,    mags
+# FIELD dMcal,          CAL_PSF_MAG_SIG,   CAL_PSF_MAG_SIG    1E      float,    zero point scatter,    mags
+# FIELD RA,             RA_PSF,            RA_PSF             1D      double,   PSF RA coord,          degrees
+# FIELD DEC,            DEC_PSF,           DEC_PSF            1D      double,   PSF DEC coord,         degrees
+# FIELD sky,            SKY,               SKY                1E      float,    sky flux,              cnts/sec
+# FIELD dSky,           SKY_SIG,           SKY_SIGMA          1E      float,    sky flux error,        cnts/sec
+# FIELD psfChisq,       PSF_CHISQ,         PSF_CHISQ          1E      float,    psf fit chisq
+# FIELD crNsigma,       CR_NSIGMA,         CR_NSIGMA          1E      float,    Nsigma deviations from PSF to CF
+# FIELD extNsigma,      EXT_NSIGMA,        EXT_NSIGMA         1E      float,    Nsigma deviations from PSF to EXT
+# FIELD fx,             PSF_MAJOR,         PSF_MAJOR          1E      float,    psf fit major axis,    pixels
+# FIELD fy,             PSF_MINOR,         PSF_MINOR          1E      float,    psf fit minor axis,    pixels
+# FIELD df,             PSF_THETA,         PSF_THETA          1E      float,    ellipse angle,         degrees
+# FIELD psfQF,          PSF_QF,            PSF_QF             1E      float,    quality factor
+# FIELD psfQFperf,      PSF_QF_PERFECT,    PSF_QF_PERFECT     1E      float,    quality factor perfect
+# FIELD psfNdof,        PSF_NDOF,          PSF_NDOF           1J      int,      psf degrees of freedom
+# FIELD psfNpix,        PSF_NPIX,          PSF_NPIX           1J      int,      psf number of pixels
+# FIELD Mxx,            MOMENTS_XX,        MOMENTS_XX         1E      float,    second moment X,       pixels^2
+# FIELD Mxy,            MOMENTS_XY,        MOMENTS_XY         1E      float,    second moment Y,       pixels^2
+# FIELD Myy,            MOMENTS_YY,        MOMENTS_YY         1E      float,    second moment XY,      pixels^2
+# FIELD M3c,            MOMENTS_M3C,       MOMENTS_M3C        1E      float,    third moment cos(t),   pixels^3
+# FIELD M3s,            MOMENTS_M3S,       MOMENTS_M3S        1E      float,    third moment sin(t),   pixels^3
+# FIELD M4c,            MOMENTS_M4C,       MOMENTS_M4C        1E      float,    fourth moment cos(t),  pixels^4
+# FIELD M4s,            MOMENTS_M4S,       MOMENTS_M4S        1E      float,    fourth moment sin(t),  pixels^4
+# FIELD Mr1,            MOMENTS_R1,        MOMENTS_R1         1E      float,    first radial moment,   pixels
+# FIELD Mrh,            MOMENTS_RH,        MOMENTS_RH         1E      float,    half radial moment,    pixels^1/2
+# FIELD kronFlux,       KRON_FLUX,         KRON_FLUX          1E      float,    kron flux,             counts
+# FIELD kronFluxErr,    KRON_FLUX_ERR,     KRON_FLUX_ERR      1E      float,    kron flux error,       counts
+# FIELD kronInner,      KRON_FLUX_INNER,   KRON_FLUX_INNER    1E      float,    kron flux 1<R<2.5,     counts
+# FIELD kronOuter,      KRON_FLUX_OUTER,   KRON_FLUX_OUTER    1E      float,    kron flux 2.5<R<4,     counts
+# FIELD flags,          FLAGS,             FLAGS              1J      int,      analysis flags
+# FIELD flags2,         FLAGS,             FLAGS2             1J      int,      analysis flags (2)
+# FIELD nFrames,        N_FRAMES,          N_FRAMES           1I      short,    images overlapping peak
+# FIELD padding,        PADDING,           PADDING            1I      short,    padding for 8byte records
+
+      
+
Index: /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-v4.d
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-v4.d	(revision 34383)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/cmf-ps1-v4.d	(revision 34383)
@@ -0,0 +1,85 @@
+# name of structure type
+STRUCT  CMF_PS1_V4
+EXTNAME CMF_PS1_V4
+TYPE    BINTABLE
+SIZE    216
+
+# elements of data structure / FITS table
+FIELD detID,          IPP_IDET,          unsigned int, detection ID                     
+FIELD X,              X_PSF,             float,    x coord,               pixels
+FIELD Y,              Y_PSF,             float,    y coord,               pixels
+FIELD dX,             X_PSF_SIG,         float,    x coord error,         pixels
+FIELD dY,             Y_PSF_SIG,         float,    y coord error,         pixels
+FIELD posangle,       POSANGLE,          float,    Posangle at source,    degrees
+FIELD pltscale,       PLTSCALE,          float,    Plate Scale at source, arcsec/pixel
+FIELD M,              PSF_INST_MAG,      float,    inst mags,             mags
+FIELD dM,             PSF_INST_MAG_SIG,  float,    inst mag error,        mags
+FIELD Flux,           PSF_INST_FLUX,     float,    psf flux,	       counts
+FIELD dFlux,          PSF_INST_FLUX_SIG, float,    psf flux error,        counts      
+FIELD Map,            AP_MAG_STANDARD,   float,    standard aperture mag, mags
+FIELD MapRaw,         AP_MAG_RAW,        float,    raw aperture mag,      mags
+FIELD apRadius,       AP_MAG_RADIUS,     float,    radius used for fit,   pixels
+FIELD apFlux,         AP_FLUX,           float,    aperture flux,         counts
+FIELD apFluxErr,      AP_FLUX_SIG,       float,    error on ap flux,      counts
+FIELD Mcalib,         CAL_PSF_MAG,       float,    calibrated psf mag,    mags
+FIELD dMcal,          CAL_PSF_MAG_SIG,   float,    zero point scatter,    mags
+
+# NOTE: RA & DEC (both double) need to be on an 8-byte boundary...
+FIELD RA,             RA_PSF,            double,   PSF RA coord,          degrees
+FIELD DEC,            DEC_PSF,           double,   PSF DEC coord,         degrees
+
+FIELD Mpeak,          PEAK_FLUX_AS_MAG,  float,    peak flux as a mag,    mags
+FIELD sky,            SKY,               float,    sky flux,              cnts/sec
+FIELD dSky,           SKY_SIG,           float,    sky flux error,        cnts/sec
+FIELD psfChisq,       PSF_CHISQ,         float,    psf fit chisq
+FIELD crNsigma,       CR_NSIGMA,         float,    Nsigma deviations from PSF to CF
+FIELD extNsigma,      EXT_NSIGMA,        float,    Nsigma deviations from PSF to EXT
+FIELD fx,             PSF_MAJOR,         float,    psf fit major axis,    pixels
+FIELD fy,             PSF_MINOR,         float,    psf fit minor axis,    pixels
+FIELD df,             PSF_THETA,         float,    ellipse angle,         degrees
+FIELD psfQF,          PSF_QF,            float,    quality factor
+FIELD psfQFperf,      PSF_QF_PERFECT,    float,    quality factor perfect
+FIELD psfNdof,        PSF_NDOF,          int,      psf degrees of freedom
+FIELD psfNpix,        PSF_NPIX,          int,      psf number of pixels
+FIELD Mxx,            MOMENTS_XX,        float,    second moment X,       pixels^2
+FIELD Mxy,            MOMENTS_XY,        float,    second moment Y,       pixels^2
+FIELD Myy,            MOMENTS_YY,        float,    second moment XY,      pixels^2
+FIELD M3c,            MOMENTS_M3C,       float,    third moment cos(t),   pixels^3
+FIELD M3s,            MOMENTS_M3S,       float,    third moment sin(t),   pixels^3
+FIELD M4c,            MOMENTS_M4C,       float,    fourth moment cos(t),  pixels^4
+FIELD M4s,            MOMENTS_M4S,       float,    fourth moment sin(t),  pixels^4
+FIELD Mr1,            MOMENTS_R1,        float,    first radial moment,   pixels
+FIELD Mrh,            MOMENTS_RH,        float,    half radial moment,    pixels^1/2
+FIELD kronFlux,       KRON_FLUX,         float,    kron flux,             counts
+FIELD kronFluxErr,    KRON_FLUX_ERR,     float,    kron flux error,       counts
+FIELD kronInner,      KRON_FLUX_INNER,   float,    kron flux 1<R<2.5,     counts
+FIELD kronOuter,      KRON_FLUX_OUTER,   float,    kron flux 2.5<R<4,     counts
+FIELD skyLimitRad,    SKY_LIMIT_RAD,     float,    profile to sky limit (radius)
+FIELD skyLimitFlux,   SKY_LIMIT_FLUX,    float,    profile to sky limit (flux)
+FIELD skyLimitSlope,  SKY_LIMIT_SLOPE,   float,    profile to sky limit (slope)
+FIELD flags,          FLAGS,             int,      analysis flags
+FIELD flags2,         FLAGS,             int,      analysis flags (2)
+FIELD nFrames,        N_FRAMES,          short,    images overlapping peak
+FIELD padding,        PADDING,           short,    padding for 8byte records
+
+# for an object in an image, we have three triplets that tell us about the shape:
+# second moments: Mxx, Mxy, Myy 
+# model shape parameters: F_major, F_minor, F_theta
+# centroid errors: sigma_X, sigma_Y, sigma_XY
+
+# fields added since PS1_V2:
+# FIELD Flux,           PSF_INST_FLUX,     float,    psf flux,	       counts
+# FIELD dFlux,          PSF_INST_FLUX_SIG, float,    psf flux error,        counts      
+# FIELD MapRaw,         AP_MAG_RAW,        float,    raw aperture mag,      mags
+# FIELD psfQFPerf,      PSF_QF_PERFECT,    float,    quality factor perfect
+# FIELD M3c,            MOMENTS_M3C,       float,    third moment cos(t),   pixels^3
+# FIELD M3s,            MOMENTS_M3S,       float,    third moment sin(t),   pixels^3
+# FIELD M4c,            MOMENTS_M4C,       float,    fourth moment cos(t),  pixels^4
+# FIELD M4s,            MOMENTS_M4S,       float,    fourth moment sin(t),  pixels^4
+# FIELD Mr1,            MOMENTS_R1,        float,    first radial moment,   pixels
+# FIELD Mrh,            MOMENTS_RH,        float,    half radial moment,    pixels^1/2
+# FIELD kronFlux,       KRON_FLUX,         float,    kron flux,             counts
+# FIELD kronFluxErr,    KRON_FLUX_ERR,     float,    kron flux error,       counts
+# FIELD kronInner,      KRON_FLUX_INNER,   float,    kron flux 1<R<2.5,     counts
+# FIELD kronOuter,      KRON_FLUX_OUTER,   float,    kron flux 2.5<R<4,     counts
+# FIELD flags2,         FLAGS,             int,      analysis flags (2)
Index: /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure-ps1-v4.d
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure-ps1-v4.d	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure-ps1-v4.d	(revision 34383)
@@ -48,5 +48,5 @@
 # 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 psfQFperf,      PSF_QF_PEFECT, float,          psf coverage / quality factor (all mask bits)
 FIELD psfChisq,       PSF_CHISQ,     float,          psf fit chisq
 
Index: /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure.d
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure.d	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/libautocode/def/measure.d	(revision 34383)
@@ -48,5 +48,5 @@
 # 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 psfQFperf,      PSF_QF_PEFECT, float,          psf coverage / quality factor (all mask bits)
 FIELD psfChisq,       PSF_CHISQ,     float,          psf fit chisq
 
Index: /branches/eam_branches/ipp-20120805/Ohana/src/libdvo/doc/updates-psps.txt
===================================================================
--- /branches/eam_branches/ipp-20120805/Ohana/src/libdvo/doc/updates-psps.txt	(revision 34383)
+++ /branches/eam_branches/ipp-20120805/Ohana/src/libdvo/doc/updates-psps.txt	(revision 34383)
@@ -0,0 +1,17 @@
+
+2012.09.03 
+
+Things that we need to add to the DVO schema to support the desired PSPS stuff:
+
+* measure.psfQualPerfect (PSF_QF_PERFECT) [OK in ps1-v4]
+* average.stargal [add to ps1-v4, old average@ps1-v4 need to be read as average@ps1-v3]
+  (re-purpose average.Xp, which should be deprecated anyway)
+* error on kron radius : skipping this (is proportional to R1 / (S/N))
+
+Here is what I've done:
+* updated mksource.pl to handle the cmf series a bit more cleanly
+* added CMF_PS1_SV2 and CMF_PS1_DV3
+* added AP_FLUX and AP_FLUX_SIG to PS1_V4, PS1_SV2 formats
+* added RA_EXT, DEC_EXT, POSANGLE, PLTSCALE to PS1_DV3
+* PLTSCALE has parity +1 if image has sky parity, -1 for opposite parity
+
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am	(revision 34383)
@@ -48,4 +48,5 @@
 	pmSourceIO_CMF_PS1_V4.c \
 	pmSourceIO_CMF_PS1_SV1.c \
+	pmSourceIO_CMF_PS1_SV2.c \
 	pmSourceIO_CMF_PS1_DV1.c \
 	pmSourceIO_CMF_PS1_DV2.c \
@@ -136,5 +137,14 @@
 
 # pmSourceID_CMF_* functions use a common framework
-BUILT_SOURCES = pmSourceIO_CMF_PS1_V1.c pmSourceIO_CMF_PS1_V2.c pmSourceIO_CMF_PS1_V3.c pmSourceIO_CMF_PS1_DV1.c pmSourceIO_CMF_PS1_DV2.c pmSourceIO_CMF_PS1_DV3.c pmSourceIO_CMF_PS1_SV1.c
+BUILT_SOURCES = \
+pmSourceIO_CMF_PS1_V1.c \
+pmSourceIO_CMF_PS1_V2.c \
+pmSourceIO_CMF_PS1_V3.c \
+pmSourceIO_CMF_PS1_V4.c \
+pmSourceIO_CMF_PS1_DV1.c \
+pmSourceIO_CMF_PS1_DV2.c \
+pmSourceIO_CMF_PS1_DV3.c \
+pmSourceIO_CMF_PS1_SV1.c \
+pmSourceIO_CMF_PS1_SV2.c
 
 pmSourceIO_CMF_PS1_V1.c : pmSourceIO_CMF.c.in mksource.pl
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.c
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.c	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.c	(revision 34383)
@@ -575,6 +575,8 @@
 	    PM_SOURCES_WRITE("PS1_V4",    CMF_PS1_V4);
 	    PM_SOURCES_WRITE("PS1_SV1",   CMF_PS1_SV1);
+	    PM_SOURCES_WRITE("PS1_SV2",   CMF_PS1_SV2);
 	    PM_SOURCES_WRITE("PS1_DV1",   CMF_PS1_DV1);
 	    PM_SOURCES_WRITE("PS1_DV2",   CMF_PS1_DV2);
+	    PM_SOURCES_WRITE("PS1_DV3",   CMF_PS1_DV3);
 
 	    psFree (outhead);
@@ -1048,6 +1050,8 @@
 	    PM_SOURCES_READ_PSF("PS1_V4",    CMF_PS1_V4);
 	    PM_SOURCES_READ_PSF("PS1_SV1",   CMF_PS1_SV1);
+	    PM_SOURCES_READ_PSF("PS1_SV2",   CMF_PS1_SV2);
 	    PM_SOURCES_READ_PSF("PS1_DV1",   CMF_PS1_DV1);
 	    PM_SOURCES_READ_PSF("PS1_DV2",   CMF_PS1_DV2);
+	    PM_SOURCES_READ_PSF("PS1_DV3",   CMF_PS1_DV3);
 
             long *sourceIndex = NULL;
@@ -1254,6 +1258,8 @@
 	PM_SOURCES_READ_XSRC("PS1_V4",    CMF_PS1_V4);
 	PM_SOURCES_READ_XSRC("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XSRC("PS1_SV2",   CMF_PS1_SV2);
 	PM_SOURCES_READ_XSRC("PS1_DV1",   CMF_PS1_DV1);
 	PM_SOURCES_READ_XSRC("PS1_DV2",   CMF_PS1_DV2);
+	PM_SOURCES_READ_XSRC("PS1_DV3",   CMF_PS1_DV3);
     }
     psFree(tableHeader);
@@ -1290,6 +1296,8 @@
 	PM_SOURCES_READ_XFIT("PS1_V4",    CMF_PS1_V4);
 	PM_SOURCES_READ_XFIT("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XFIT("PS1_SV2",   CMF_PS1_SV2);
 	PM_SOURCES_READ_XFIT("PS1_DV1",   CMF_PS1_DV1);
 	PM_SOURCES_READ_XFIT("PS1_DV2",   CMF_PS1_DV2);
+	PM_SOURCES_READ_XFIT("PS1_DV3",   CMF_PS1_DV3);
     }
     psFree(tableHeader);
@@ -1325,6 +1333,8 @@
 	PM_SOURCES_READ_XRAD("PS1_V4",    CMF_PS1_V4);
 	PM_SOURCES_READ_XRAD("PS1_SV1",   CMF_PS1_SV1);
+	PM_SOURCES_READ_XRAD("PS1_SV2",   CMF_PS1_SV2);
 	PM_SOURCES_READ_XRAD("PS1_DV1",   CMF_PS1_DV1);
 	PM_SOURCES_READ_XRAD("PS1_DV2",   CMF_PS1_DV2);
+	PM_SOURCES_READ_XRAD("PS1_DV3",   CMF_PS1_DV3);
     }
     psFree(tableHeader);
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.h
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.h	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO.h	(revision 34383)
@@ -36,4 +36,5 @@
 MK_PROTO(CMF_PS1_V4);
 MK_PROTO(CMF_PS1_SV1);
+MK_PROTO(CMF_PS1_SV2);
 MK_PROTO(CMF_PS1_DV1);
 MK_PROTO(CMF_PS1_DV2);
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO_CMF.c.in
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO_CMF.c.in	(revision 34382)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO_CMF.c.in	(revision 34383)
@@ -142,5 +142,5 @@
 	@>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX_SIG",      PS_DATA_F32, "aperture flux error",                        source->apFluxErr);
 
-	@<PS1_V3,PS1_SV?,PS1_DV?@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude",           outputs.peakMag);
+	@<PS1_V3,PS1_SV1,PS1_DV?@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude",           outputs.peakMag);
 
         @ALL@      		  psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG",      PS_DATA_F32, "PSF Magnitude using supplied calibration",   outputs.calMag);
@@ -151,5 +151,5 @@
 	@ALL,!PS1_V1@             psMetadataAdd (row, PS_LIST_TAIL, "DEC_PSF",          PS_DATA_F64, "PSF DEC coordinate (degrees)",               outputs.dec);
 
-	@>=PS1_V3@ 		  psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude",           outputs.peakMag);
+	@>=PS1_V3,>PS1_SV1@	  psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude",           outputs.peakMag);
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "SKY",              PS_DATA_F32, "Sky level",                                  source->sky);
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "SKY_SIGMA",        PS_DATA_F32, "Sigma of sky level",                         source->skyErr);
@@ -200,5 +200,5 @@
         @ALL@     		   psMetadataAdd (row, PS_LIST_TAIL, "FLAGS",            PS_DATA_U32, "psphot analysis flags",                      source->mode);
 	@>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2",           PS_DATA_U32, "psphot analysis flags",                      source->mode2);
-	@>PS1_V2@                  psMetadataAdd (row, PS_LIST_TAIL, "PADDING2",         PS_DATA_S32, "more padding", 0);
+	@PS1_V3,PS1_SV2@           psMetadataAdd (row, PS_LIST_TAIL, "PADDING2",         PS_DATA_S32, "more padding", 0);
 	@PS1_SV?@
 
