Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am	(revision 34380)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/Makefile.am	(revision 34381)
@@ -162,3 +162,6 @@
 	mksource.pl pmSourceIO_CMF.c.in PS1_SV1 pmSourceIO_CMF_PS1_SV1.c
 
+pmSourceIO_CMF_PS1_SV2.c : pmSourceIO_CMF.c.in mksource.pl
+	mksource.pl pmSourceIO_CMF.c.in PS1_SV2 pmSourceIO_CMF_PS1_SV2.c
+
 # EXTRA_DIST = pmErrorCodes.h.in pmErrorCodes.dat pmErrorCodes.c.in
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/mksource.pl
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/mksource.pl	(revision 34380)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/mksource.pl	(revision 34381)
@@ -14,9 +14,16 @@
 # validate the cmfmode
 
-# see if we can add in PS1_DV* and PS1_SV* as well...
-%cmfmodes = ("PS1_V1", 1,
-	     "PS1_V2", 2,
-	     "PS1_V3", 3,
-	     "PS1_V4", 4,
+# keep the series (V1,SV1,DV1) separate)
+%cmfmodes_v = ("PS1_V1", 1,
+	       "PS1_V2", 2,
+	       "PS1_V3", 3,
+	       "PS1_V4", 4,
+    );
+%cmfmodes_dv = ("PS1_DV1", 1,
+		"PS1_DV2", 2,
+		"PS1_DV3", 3,
+    );
+%cmfmodes_sv = ("PS1_SV1", 1,
+		"PS1_SV2", 2,
     );
 
@@ -118,8 +125,11 @@
 	if ($rule =~ m|^>=|) {
 	    print ">= rule: $rule\n" if $DEBUG;
-	    if ($cmfmodes{$cmfmode} == 0) { next; }
+	    # find the cmfmode series (v, dv, sv)
 	    $realrule = substr($rule,2);
-	    $thisLevel = $cmfmodes{$realrule};
-	    $myLevel = $cmfmodes{$cmfmode};
+	    %series = &cmf_series ($realrule);
+	    if (! %series) { next; }
+	    if ($series{$cmfmode} == 0) { next; }
+	    $thisLevel = $series{$realrule};
+	    $myLevel = $series{$cmfmode};
 	    print "levels: $cmfmode, $realrule, $myLevel, $thisLevel\n" if $DEBUG;
 	    if ($myLevel >= $thisLevel) { $keepLine = 1; }
@@ -130,8 +140,11 @@
 	if ($rule =~ m|^>|) {
 	    print "> rule: $rule\n" if $DEBUG;
-	    if ($cmfmodes{$cmfmode} == 0) { next; }
+	    # find the cmfmode series (v, dv, sv)
 	    $realrule = substr($rule,1);
-	    $thisLevel = $cmfmodes{$realrule};
-	    $myLevel = $cmfmodes{$cmfmode};
+	    %series = &cmf_series ($realrule);
+	    if (! %series) { next; }
+	    if ($series{$cmfmode} == 0) { next; }
+	    $thisLevel = $series{$realrule};
+	    $myLevel = $series{$cmfmode};
 	    print "levels: $cmfmode, $realrule, $myLevel, $thisLevel\n" if $DEBUG;
 	    if ($myLevel > $thisLevel) { $keepLine = 1; }
@@ -142,8 +155,11 @@
 	if ($rule =~ m|^<=|) {
 	    print "<= rule: $rule\n" if $DEBUG;
-	    if ($cmfmodes{$cmfmode} == 0) { next; }
+	    # find the cmfmode series (v, dv, sv)
 	    $realrule = substr($rule,2);
-	    $thisLevel = $cmfmodes{$realrule};
-	    $myLevel = $cmfmodes{$cmfmode};
+	    %series = &cmf_series ($realrule);
+	    if (! %series) { next; }
+	    if ($series{$cmfmode} == 0) { next; }
+	    $thisLevel = $series{$realrule};
+	    $myLevel = $series{$cmfmode};
 	    print "levels: $cmfmode, $realrule, $myLevel, $thisLevel\n" if $DEBUG;
 	    if ($myLevel <= $thisLevel) { $keepLine = 1; }
@@ -154,8 +170,11 @@
 	if ($rule =~ m|^<|) {
 	    print "< rule: $rule\n" if $DEBUG;
-	    if ($cmfmodes{$cmfmode} == 0) { next; }
+	    # find the cmfmode series (v, dv, sv)
 	    $realrule = substr($rule,1);
-	    $thisLevel = $cmfmodes{$realrule};
-	    $myLevel = $cmfmodes{$cmfmode};
+	    %series = &cmf_series ($realrule);
+	    if (! %series) { next; }
+	    if ($series{$cmfmode} == 0) { next; }
+	    $thisLevel = $series{$realrule};
+	    $myLevel = $series{$cmfmode};
 	    print "levels: $cmfmode, $realrule, $myLevel, $thisLevel\n" if $DEBUG;
 	    if ($myLevel < $thisLevel) { $keepLine = 1; }
@@ -174,2 +193,12 @@
 
 exit 0;
+
+sub cmf_series {
+
+    my ($rule) = $_[0];
+
+    if ($cmfmodes_v{$rule})  { return %cmfmodes_v;  }
+    if ($cmfmodes_sv{$rule}) { return %cmfmodes_sv; }
+    if ($cmfmodes_dv{$rule}) { return %cmfmodes_dv; }
+    return 0;
+}
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 34380)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceIO_CMF.c.in	(revision 34381)
@@ -136,11 +136,11 @@
 	@ALL,!PS1_V1,!PS1_V2@     psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental flux",             source->psfFluxErr);
 
-        @ALL@      		  psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG",           PS_DATA_F32, "magnitude in standard aperture",             source->apMag);
-	@>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW",       PS_DATA_F32, "magnitude in reported aperture",             source->apMagRaw);
-        @ALL@      		  psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS",    PS_DATA_F32, "radius used for aperture mags",              outputs.apRadius);
-	@PS1_DV2@ 		  psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX",          PS_DATA_F32, "instrumental flux in standard aperture",     source->apFlux);
-	@PS1_DV2@ 		  psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX_SIG",      PS_DATA_F32, "aperture flux error",                        source->apFluxErr);
-
-	@<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, "AP_MAG",           PS_DATA_F32, "magnitude in standard aperture",             source->apMag);
+	@>PS1_V2,PS1_SV?,>PS1_DV1@  psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW",       PS_DATA_F32, "magnitude in reported aperture",             source->apMagRaw);
+        @ALL@      		    psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS",    PS_DATA_F32, "radius used for aperture mags",              outputs.apRadius);
+	@>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX",          PS_DATA_F32, "instrumental flux in standard aperture",     source->apFlux);
+	@>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);
 
         @ALL@      		  psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG",      PS_DATA_F32, "PSF Magnitude using supplied calibration",   outputs.calMag);
@@ -163,5 +163,5 @@
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "PSF_THETA",        PS_DATA_F32, "PSF orientation angle",                      outputs.psfTheta);
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF",           PS_DATA_F32, "PSF coverage/quality factor (bad)",          source->pixWeightNotBad);
-	@>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT",   PS_DATA_F32, "PSF coverage/quality factor (poor)",         source->pixWeightNotPoor);
+	@>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT",   PS_DATA_F32, "PSF coverage/quality factor (poor)",         source->pixWeightNotPoor);
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "PSF_NDOF",         PS_DATA_S32, "degrees of freedom",                         outputs.nDOF);
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "PSF_NPIX",         PS_DATA_S32, "number of pixels in fit",                    outputs.nPix);
@@ -171,15 +171,15 @@
         @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_YY",       PS_DATA_F32, "second moments (Y*Y)",                       moments.Myy);
 
-	@>PS1_V2,PS1_SV1@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C",      PS_DATA_F32, "third momemt cos theta",                     moments.M_c3);
-	@>PS1_V2,PS1_SV1@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S",      PS_DATA_F32, "third momemt sin theta",                     moments.M_s3);
-	@>PS1_V2,PS1_SV1@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C",      PS_DATA_F32, "fourth momemt cos theta",                    moments.M_c4);
-	@>PS1_V2,PS1_SV1@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S",      PS_DATA_F32, "fourth momemt sin theta",                    moments.M_s4);
-
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1",       PS_DATA_F32, "first radial moment",                        moments.Mrf);
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH",       PS_DATA_F32, "half radial moment",                         moments.Mrh);
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX",        PS_DATA_F32, "Kron Flux (in 2.5 R1)",                      moments.Krf);
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_ERR",    PS_DATA_F32, "Kron Flux Error",                            moments.dKrf);
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER",  PS_DATA_F32, "Kron Flux (in 1.0 R1)",                      moments.Kinner);
-        @>PS1_V2,PS1_SV1,PS1_DV2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER",  PS_DATA_F32, "Kron Flux (in 4.0 R1)",                      moments.Kouter);
+	@>PS1_V2,PS1_SV?@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C",      PS_DATA_F32, "third momemt cos theta",                     moments.M_c3);
+	@>PS1_V2,PS1_SV?@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S",      PS_DATA_F32, "third momemt sin theta",                     moments.M_s3);
+	@>PS1_V2,PS1_SV?@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C",      PS_DATA_F32, "fourth momemt cos theta",                    moments.M_c4);
+	@>PS1_V2,PS1_SV?@ 	  psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S",      PS_DATA_F32, "fourth momemt sin theta",                    moments.M_s4);
+
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1",       PS_DATA_F32, "first radial moment",                        moments.Mrf);
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH",       PS_DATA_F32, "half radial moment",                         moments.Mrh);
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX",        PS_DATA_F32, "Kron Flux (in 2.5 R1)",                      moments.Krf);
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_ERR",    PS_DATA_F32, "Kron Flux Error",                            moments.dKrf);
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER",  PS_DATA_F32, "Kron Flux (in 1.0 R1)",                      moments.Kinner);
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER",  PS_DATA_F32, "Kron Flux (in 4.0 R1)",                      moments.Kouter);
 
         @>PS1_V3@ 		  psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_RAD",    PS_DATA_F32, "Radius where object hits sky",               source->skyRadius);
@@ -198,8 +198,8 @@
         @PS1_DV2@      		  psMetadataAdd (row, PS_LIST_TAIL, "DIFF_SN_M",        PS_DATA_F32, "signal-to-noise of neg match src",           diffStats.SNm);
 
-        @ALL@     		  psMetadataAdd (row, PS_LIST_TAIL, "FLAGS",            PS_DATA_U32, "psphot analysis flags",                      source->mode);
-	@>PS1_V2,PS1_SV1,PS1_DV2@ 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_SV1@
+        @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_SV?@
 
 	  // note that this definition is inconsistent with the definition in
@@ -316,10 +316,10 @@
         @ALL@     source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
         @ALL@     source->apMag     = psMetadataLookupF32 (&status, row, "AP_MAG");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->apMagRaw  = psMetadataLookupF32 (&status, row, "AP_MAG_RAW");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->apMagRaw  = psMetadataLookupF32 (&status, row, "AP_MAG_RAW");
 
         // XXX use these to determine PAR[PM_PAR_I0] if they exist?
 	// XXX add these to PS1_SV1?
-	@>PS1_V2,PS1_SV1,PS1_DV?@ source->psfFlux   = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX");
-	@>PS1_V2,PS1_SV1,PS1_DV?@ source->psfFluxErr= psMetadataLookupF32 (&status, row, "PSF_INST_FLUX_SIG");
+	@>PS1_V2,PS1_SV?,PS1_DV?@ source->psfFlux   = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX");
+	@>PS1_V2,PS1_SV?,PS1_DV?@ source->psfFluxErr= psMetadataLookupF32 (&status, row, "PSF_INST_FLUX_SIG");
 
         // XXX this scaling is incorrect: does not include the 2 \pi AREA factor
@@ -342,5 +342,5 @@
 
         @ALL@     source->pixWeightNotBad = psMetadataLookupF32 (&status, row, "PSF_QF");
-	@>PS1_V2,PS1_SV1,PS1_DV2@ source->pixWeightNotPoor = psMetadataLookupF32 (&status, row, "PSF_QF_PERFECT");
+	@>PS1_V2,PS1_SV?,>PS1_DV1@ source->pixWeightNotPoor = psMetadataLookupF32 (&status, row, "PSF_QF_PERFECT");
         @ALL@     source->crNsigma  = psMetadataLookupF32 (&status, row, "CR_NSIGMA");
         @ALL@     source->extNsigma = psMetadataLookupF32 (&status, row, "EXT_NSIGMA");
@@ -362,21 +362,21 @@
 	// XXX we do not save all of the 3rd and 4th moment parameters. when we load in data,
 	// we are storing enough information so the output will be consistent with the input
-        @>PS1_V2,PS1_SV1@ source->moments->Mxxx = +1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3C");
-        @>PS1_V2,PS1_SV1@ source->moments->Mxxy = 0.0;
-        @>PS1_V2,PS1_SV1@ source->moments->Mxyy = 0.0;
-        @>PS1_V2,PS1_SV1@ source->moments->Myyy = -1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3S");
-
-        @>PS1_V2,PS1_SV1@ source->moments->Mxxxx = +1.00 * psMetadataLookupF32 (&status, row, "MOMENTS_M4C");
-        @>PS1_V2,PS1_SV1@ source->moments->Mxxxy = 0.0;
-        @>PS1_V2,PS1_SV1@ source->moments->Mxxyy = 0.0;
-        @>PS1_V2,PS1_SV1@ source->moments->Mxyyy = -0.25 * psMetadataLookupF32 (&status, row, "MOMENTS_M4S");
-        @>PS1_V2,PS1_SV1@ source->moments->Myyyy = 0.0;
-
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->Mrf         = psMetadataLookupF32 (&status, row, "MOMENTS_R1");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->Mrh         = psMetadataLookupF32 (&status, row, "MOMENTS_RH");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->KronFlux    = psMetadataLookupF32 (&status, row, "KRON_FLUX");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->KronFluxErr = psMetadataLookupF32 (&status, row, "KRON_FLUX_ERR");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->KronFinner  = psMetadataLookupF32 (&status, row, "KRON_FLUX_INNER");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->moments->KronFouter  = psMetadataLookupF32 (&status, row, "KRON_FLUX_OUTER");
+        @>PS1_V2,PS1_SV?@ source->moments->Mxxx = +1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3C");
+        @>PS1_V2,PS1_SV?@ source->moments->Mxxy = 0.0;
+        @>PS1_V2,PS1_SV?@ source->moments->Mxyy = 0.0;
+        @>PS1_V2,PS1_SV?@ source->moments->Myyy = -1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3S");
+
+        @>PS1_V2,PS1_SV?@ source->moments->Mxxxx = +1.00 * psMetadataLookupF32 (&status, row, "MOMENTS_M4C");
+        @>PS1_V2,PS1_SV?@ source->moments->Mxxxy = 0.0;
+        @>PS1_V2,PS1_SV?@ source->moments->Mxxyy = 0.0;
+        @>PS1_V2,PS1_SV?@ source->moments->Mxyyy = -0.25 * psMetadataLookupF32 (&status, row, "MOMENTS_M4S");
+        @>PS1_V2,PS1_SV?@ source->moments->Myyyy = 0.0;
+
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->Mrf         = psMetadataLookupF32 (&status, row, "MOMENTS_R1");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->Mrh         = psMetadataLookupF32 (&status, row, "MOMENTS_RH");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->KronFlux    = psMetadataLookupF32 (&status, row, "KRON_FLUX");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->KronFluxErr = psMetadataLookupF32 (&status, row, "KRON_FLUX_ERR");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->KronFinner  = psMetadataLookupF32 (&status, row, "KRON_FLUX_INNER");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->KronFouter  = psMetadataLookupF32 (&status, row, "KRON_FLUX_OUTER");
 
         @>PS1_V3@ source->skyRadius            = psMetadataLookupF32 (&status, row, "SKY_LIMIT_RAD");
@@ -393,12 +393,12 @@
 	@PS1_DV?@      source->diffStats->nRatioAll  = psMetadataLookupF32 (&status, row, "DIFF_NRATIO_ALL");
 	
-	@PS1_DV2@      source->diffStats->Rp         = psMetadataLookupF32 (&status, row, "DIFF_R_P");
-	@PS1_DV2@      source->diffStats->SNp        = psMetadataLookupF32 (&status, row, "DIFF_SN_P");
-	@PS1_DV2@      source->diffStats->Rm         = psMetadataLookupF32 (&status, row, "DIFF_R_M");
-	@PS1_DV2@      source->diffStats->SNm        = psMetadataLookupF32 (&status, row, "DIFF_SN_M");
+	@>PS1_DV1@      source->diffStats->Rp         = psMetadataLookupF32 (&status, row, "DIFF_R_P");
+	@>PS1_DV1@      source->diffStats->SNp        = psMetadataLookupF32 (&status, row, "DIFF_SN_P");
+	@>PS1_DV1@      source->diffStats->Rm         = psMetadataLookupF32 (&status, row, "DIFF_R_M");
+	@>PS1_DV1@      source->diffStats->SNm        = psMetadataLookupF32 (&status, row, "DIFF_SN_M");
 	@PS1_DV?@  }
 
         @ALL@                     source->mode  = psMetadataLookupU32 (&status, row, "FLAGS");
-        @>PS1_V2,PS1_SV1,PS1_DV2@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2");
+        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2");
         assert (status);
 
@@ -734,5 +734,5 @@
     }
 
-    @PS1_DV3@ pmChip *chip = readout->parent->parent;
+    @>PS1_DV2@ pmChip *chip = readout->parent->parent;
 
     table = psArrayAllocEmpty (sources->n);
@@ -769,10 +769,10 @@
             yErr = dPAR[PM_PAR_YPOS];
 
-	    @PS1_DV3@ psSphere ptSky = {0.0, 0.0, 0.0, 0.0};
-	    @PS1_DV3@ float posAngle = 0.0;
-	    @PS1_DV3@ float pltScale = 0.0;
-	    @PS1_DV3@ pmSourceLocalAstrometry (&ptSky, &posAngle, &pltScale, chip, xPos, yPos);
-	    @PS1_DV3@ double raPos = ptSky.r*PS_DEG_RAD;
-	    @PS1_DV3@ double decPos = ptSky.d*PS_DEG_RAD;
+	    @>PS1_DV2@ psSphere ptSky = {0.0, 0.0, 0.0, 0.0};
+	    @>PS1_DV2@ float posAngle = 0.0;
+	    @>PS1_DV2@ float pltScale = 0.0;
+	    @>PS1_DV2@ pmSourceLocalAstrometry (&ptSky, &posAngle, &pltScale, chip, xPos, yPos);
+	    @>PS1_DV2@ double raPos = ptSky.r*PS_DEG_RAD;
+	    @>PS1_DV2@ double decPos = ptSky.d*PS_DEG_RAD;
 
 	    float kronFlux = source->moments ? source->moments->KronFlux : NAN;
@@ -787,8 +787,11 @@
             psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
             psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG",        0, "Sigma in EXT y coordinate",                  yErr);
-            @PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model ra coordinate",                    raPos);
-            @PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT",          0, "EXT model dec coordinate",                   decPos);
+            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model ra coordinate",                    raPos);
+            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT",          0, "EXT model dec coordinate",                   decPos);
             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
+
+            @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "POSANGLE",   0, "position angle at source (degrees)",         posAngle);
+	    @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "PLTSCALE",   0, "plate scale at source (arcsec/pixel)",       pltScale);
 
             // psMetadataAddF32 (row, PS_LIST_TAIL, "MOMENTS_XX",       0, "second moment in x",                      extPars->Mxx);
@@ -802,6 +805,6 @@
             psMetadataAddF32 (row, PS_LIST_TAIL, "KRON_MAG",         0, "Kron Mag",                                   kronMag);
 
-            @ALL, !PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
-            @PS1_DV3@       psMetadataAddS32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
+            @ALL, <PS1_DV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
+            @>PS1_DV2@       psMetadataAddS32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
             psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
 
Index: /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceOutputs.c
===================================================================
--- /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceOutputs.c	(revision 34380)
+++ /branches/eam_branches/ipp-20120805/psModules/src/objects/pmSourceOutputs.c	(revision 34381)
@@ -227,4 +227,9 @@
     *pltScale = 0.5*(pltScale_x + pltScale_y);
 
+    float crossProduct = dTPx_dCHx * dTPy_dCHy - dTPx_dCHy * dTPy_dCHx;
+    if  (crossProduct > 0.) {
+      *pltScale *= -1.0;
+    }
+
     float posAngle_x = atan2 (+dTPy_dCHx, +dTPx_dCHx);
     float posAngle_y = atan2 (-dTPy_dCHy, +dTPx_dCHy);
