Index: branches/eam_branches/ipp-20110404/psphot/src/psphotBlendFit.c
===================================================================
--- branches/eam_branches/ipp-20110404/psphot/src/psphotBlendFit.c	(revision 31381)
+++ branches/eam_branches/ipp-20110404/psphot/src/psphotBlendFit.c	(revision 31384)
@@ -242,4 +242,7 @@
         if (source->mode &  PM_SOURCE_MODE_PAIR) continue;
 
+	// do not include MOMENTS_FAILURES in the fit
+        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
+
         // limit selection to some SN limit
         if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;
Index: branches/eam_branches/ipp-20110404/psphot/src/psphotFitSourcesLinear.c
===================================================================
--- branches/eam_branches/ipp-20110404/psphot/src/psphotFitSourcesLinear.c	(revision 31381)
+++ branches/eam_branches/ipp-20110404/psphot/src/psphotFitSourcesLinear.c	(revision 31384)
@@ -137,4 +137,7 @@
         if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;
 
+	// do not include MOMENTS_FAILURES in the fit
+        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
+
 	// XXX count saturated stars
         if (source->mode & PM_SOURCE_MODE_SATSTAR) {
@@ -166,13 +169,20 @@
 	// apply mask?
 	float modelSum = 0.0;
+	float maskedSum = 0.0;
 	for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
 	    for (int ix = 0; ix < source->modelFlux->numCols; ix++) {
 		modelSum += source->modelFlux->data.F32[iy][ix];
+		if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue;
+		maskedSum += source->modelFlux->data.F32[iy][ix];
 	    }
 	}
 	if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit)
 	if (modelSum < 0.8) {
-	    fprintf (stderr, "low-sig model @ %f, %f (%f sum, %f peak)\n",
-		     source->peak->xf, source->peak->yf, modelSum, source->peak->rawFlux);
+	    fprintf (stderr, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
+		     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
+	}
+	if (maskedSum < 0.5) {
+	    fprintf (stderr, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",
+		     source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);
 	}
 
Index: branches/eam_branches/ipp-20110404/psphot/src/psphotGuessModels.c
===================================================================
--- branches/eam_branches/ipp-20110404/psphot/src/psphotGuessModels.c	(revision 31381)
+++ branches/eam_branches/ipp-20110404/psphot/src/psphotGuessModels.c	(revision 31384)
@@ -160,8 +160,4 @@
         pmSource *source = sources->data[i];
 
-        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) {
-	    fprintf (stderr, "moment failure\n");
-	}
-
         // this is used to mark sources for which the model is measured. We check later that
         // all are used.
@@ -169,4 +165,5 @@
 
         // skip non-astronomical objects (very likely defects)
+        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
         if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
         if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
@@ -196,4 +193,5 @@
         }
 
+# if (0)
 	if (source->mode & PM_SOURCE_MODE_SATSTAR) {
 	    fprintf (stderr, "satstar: %f,%f vs %f,%f : %c\n", 
@@ -202,4 +200,5 @@
 		     (useMoments ? 'T' : 'F'));
 	}
+# endif
 
         // set PSF parameters for this model (apply 2D shape model to coordinates Xo, Yo)
Index: branches/eam_branches/ipp-20110404/psphot/src/psphotMakeGrowthCurve.c
===================================================================
--- branches/eam_branches/ipp-20110404/psphot/src/psphotMakeGrowthCurve.c	(revision 31381)
+++ branches/eam_branches/ipp-20110404/psphot/src/psphotMakeGrowthCurve.c	(revision 31384)
@@ -50,8 +50,8 @@
 # endif
 
+    psLogMsg ("psphot", PS_LOG_MINUTIA, "built growth curve: %f sec\n", psTimerMark ("psphot.growth"));
+
     float offset = pmGrowthCurveCorrect (psf->growth, PSF_APERTURE);
-    fprintf (stderr, "correction from %f to %f: %f mags\n", PSF_APERTURE, REF_RADIUS, offset);
-
-    psLogMsg ("psphot", PS_LOG_MINUTIA, "built growth curve: %f sec\n", psTimerMark ("psphot.growth"));
+    psLogMsg ("psphot", PS_LOG_DETAIL, "correction from %f to %f: %f mags\n", PSF_APERTURE, REF_RADIUS, offset);
 
     return true;
Index: branches/eam_branches/ipp-20110404/psphot/src/psphotRadialApertures.c
===================================================================
--- branches/eam_branches/ipp-20110404/psphot/src/psphotRadialApertures.c	(revision 31381)
+++ branches/eam_branches/ipp-20110404/psphot/src/psphotRadialApertures.c	(revision 31384)
@@ -95,5 +95,7 @@
 	if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
 	if (source->mode & PM_SOURCE_MODE_DEFECT) continue;
-	if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
+
+	// XXX measure radial apertures even for saturated stars
+	// if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
 
 	// limit selection to some SN limit
@@ -257,9 +259,12 @@
 	float SBstdv = sqrt((fluxStd->data.F32[i] / nPix) - PS_SQR(SBmean));
 
+	// XXX report the total flux or the mask-corrected flux?
 	// flux->data.F32[i]    = SBmean * Area;
+	// fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]) * Area / nPix;
+
+	fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]);
 	fluxStd->data.F32[i] = SBstdv * Area;
-	fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]) * Area / nPix;
-
-	// fill->data.F32[i] /= Area;
+	fill->data.F32[i] /= Area;
+
 	psTrace ("psphot", 5, "radial bins: %3d  %5.1f : %8.1f +/- %7.2f : %8.1f +/- %8.1f : %4.2f %6.1f\n", 
 		 i, aperRadii->data.F32[i], flux->data.F32[i], fluxErr->data.F32[i], SBmean, SBstdv, fill->data.F32[i], Area);
