Index: /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSource.c
===================================================================
--- /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSource.c	(revision 31311)
+++ /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSource.c	(revision 31312)
@@ -199,5 +199,25 @@
     source->type = in->type;
     source->mode = in->mode;
+    source->mode2 = in->mode2;
+    source->tmpFlags = in->tmpFlags;
     source->imageID = in->imageID;
+
+    source->psfMag             = in->psfMag;
+    source->psfFlux	       = in->psfFlux;
+    source->psfFluxErr	       = in->psfFluxErr;
+    source->extMag	       = in->extMag;
+    source->errMag	       = in->errMag;
+    source->apMag	       = in->apMag;
+    source->apMagRaw	       = in->apMagRaw;
+    source->apRadius	       = in->apRadius;
+    source->apFlux	       = in->apFlux;
+    source->apFluxErr	       = in->apFluxErr;
+    source->pixWeightNotBad    = in->pixWeightNotBad;
+    source->pixWeightNotPoor   = in->pixWeightNotPoor;
+    source->psfChisq	       = in->psfChisq;
+    source->crNsigma	       = in->crNsigma;
+    source->extNsigma	       = in->extNsigma;
+    source->sky	               = in->sky;
+    source->skyErr             = in->skyErr;
 
     return(source);
@@ -486,5 +506,5 @@
         // create vectors with Sx, Sy values in window
         // clip sources based on S/N
-        for (psS32 i = 0 ; i < sources->n ; i++)
+        for (psS32 i = 0; i < sources->n; i++)
         {
             pmSource *tmpSrc = (pmSource *) sources->data[i];
Index: /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMasks.h
===================================================================
--- /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMasks.h	(revision 31311)
+++ /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMasks.h	(revision 31312)
@@ -51,4 +51,6 @@
     PM_SOURCE_MODE2_ON_BURNTOOL      = 0x00000020, ///< > 25% of (PSF-weighted) pixels land on burntool
     PM_SOURCE_MODE2_ON_CONVPOOR      = 0x00000040, ///< > 25% of (PSF-weighted) pixels land on convpoor
+
+    PM_SOURCE_MODE2_PASS1_SRC        = 0x00000080, ///< source detected in first pass analysis
 } pmSourceMode2;
 
Index: /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMoments.c
===================================================================
--- /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMoments.c	(revision 31311)
+++ /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMoments.c	(revision 31312)
@@ -109,4 +109,7 @@
     // Xn  = SUM (x - xc)^n * (z - sky)
 
+    psF32 RFW = 0.0;
+    psF32 RHW = 0.0;
+
     psF32 RF = 0.0;
     psF32 RH = 0.0;
@@ -187,4 +190,7 @@
 	    psF32 rs = fDiff;
 
+	    psF32 rfw = r * pDiff;
+	    psF32 rhw = sqrt(r) * pDiff;
+
 	    psF32 x = xDiff * pDiff;
 	    psF32 y = yDiff * pDiff;
@@ -208,4 +214,7 @@
 	    RH  += rh;
 	    RS  += rs;
+
+	    RFW  += rfw;
+	    RHW  += rhw;
 
 	    XX  += xx;
@@ -226,6 +235,9 @@
     }
 
-    source->moments->Mrf = RF/RS;
-    source->moments->Mrh = RH/RS;
+    // if Mrf (first radial moment) is << sigma, we are getting into low-significance
+    // territory.  saturate at 0.75*sigma.  conversely, if Mrf is > radius, we are clearly
+    // making an error.  saturate at radius.
+    source->moments->Mrf = MIN(radius, MAX(0.75*sigma, RF/RS));
+    source->moments->Mrh = MIN(radius, MAX(0.75*sigma, RH/RS));
 
     source->moments->Mxx = XX/Sum;
@@ -243,4 +255,8 @@
     source->moments->Mxyyy = XYYY/Sum;
     source->moments->Myyyy = YYYY/Sum;
+
+    // XXX TEST:
+    // source->moments->KronFinner = RFW/Sum;
+    // source->moments->KronFouter = sigma;
 
     // Calculate the Kron magnitude (make this block optional?)
Index: /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceOutputs.c
===================================================================
--- /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceOutputs.c	(revision 31311)
+++ /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceOutputs.c	(revision 31312)
@@ -98,5 +98,6 @@
 	outputs->xPos = PAR[PM_PAR_XPOS];
 	outputs->yPos = PAR[PM_PAR_YPOS];
-	if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) {
+	if ((source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) && !(source->mode & PM_SOURCE_MODE_EXTMODEL)) {
+	    // we only do non-linear PSF fits for non-extended objects
 	    outputs->xErr = dPAR[PM_PAR_XPOS];
 	    outputs->yErr = dPAR[PM_PAR_YPOS];
Index: /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.c
===================================================================
--- /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.c	(revision 31311)
+++ /branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.c	(revision 31312)
@@ -310,4 +310,7 @@
     bool status;
     status = pmSourcePhotometryAper(&source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
+    if (status) {
+	source->mode |= PM_SOURCE_MODE_AP_MAGS;
+    }
 
     return status;
@@ -413,4 +416,6 @@
     maskBad &= ~maskSuspect;
 
+    psImageMaskType maskPoor = maskVal | maskSuspect;
+
     // measure modelSum and validSum.  this function is applied to a sources' subimage.  the
     // value of DX is chosen (see above) to cover the full possible size of the subimage if it
@@ -446,5 +451,5 @@
 
 	    // count pixels which are masked with an mask bit (bad or poor)
-            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) {
+            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskPoor)) {
 		notPoorSum += value;
 	    }
@@ -487,5 +492,5 @@
 
     if (isfinite(source->pixWeightNotBad) && isfinite(source->pixWeightNotPoor)) {
-	psAssert (source->pixWeightNotBad <= source->pixWeightNotPoor, "error: all bad pixels should also be poor");
+	psAssert (source->pixWeightNotPoor <= source->pixWeightNotBad, "error: all bad pixels should also be poor");
     }
 
