Index: trunk/psphot/src/pspsf.c
===================================================================
--- trunk/psphot/src/pspsf.c	(revision 4129)
+++ trunk/psphot/src/pspsf.c	(revision 4216)
@@ -46,5 +46,5 @@
 }
 
-pmPSF_Test *pmPSF_TestModel (psArray *sources, char *modelName) {
+pmPSF_Test *pmPSF_TestModel (psArray *sources, char *modelName, float RADIUS) {
   
     int Nflt = 0;
@@ -58,7 +58,14 @@
 	psSource *source = test->sources->data[i];
 	psModel  *model  = pmSourceModelGuess (source, test->modelType); 
-
+	x = source->peak->x;
+	y = source->peak->y;
+
+	// set temporary object mask and fit object
 	// fit model as FLT, not PSF (mask & skip poor fits)
-	if (!pmSourceFitModel (source, model, false)) {
+	psImageKeepCircle (source->mask, x, y, RADIUS, OR, 0x80);
+	status = pmSourceFitModel (source, model, false);
+	psImageKeepCircle (source->mask, x, y, RADIUS, AND, 0x7f);
+
+	if (!status) {
 	  test->mask->data.U8[i] = 1;
 	  continue;
@@ -96,6 +103,10 @@
 	psModel  *modelPSF = psModelFromPSF (modelFLT, test->psf); // set shape for this model
 
-	// fit model as PSF, not FLT (skip poor fits)
-	if (!pmSourceFitModel (source, modelPSF, true)) {
+	psImageKeepCircle (source->mask, RADIUS, OR, 0x80);
+	status = pmSourceFitModel (source, modelPSF, true);
+	psImageKeepCircle (source->mask, RADIUS, AND, 0x7f);
+
+	// skip poor fits
+	if (!status) {
 	  test->mask->data.U8[i] = 1;
 	  continue;
@@ -224,20 +235,2 @@
 }
 
-// this was an attempt to measure ap-fit using image stats.  it was giving
-// strangely wrong answers.  
-# if (0)
-	psImage  *pixels = psImageCopy (NULL, source->pixels, source->pixels->type.type);
-	pixels->col0 = source->pixels->col0;
-	pixels->row0 = source->pixels->row0;
-	// psImageCopy does not retain the parent offset
-	// this copy is relative to the parent array.
-
-	pmSourceSubModel (pixels, source->mask, model, false);
-
-	// use a robust statistic or not?
-	psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN);
-	psImageStats (stats, pixels, NULL, 0);
-	// psImageStats (stats, pixels, source->mask, 0);
-	// XXX this should be the SUM, but we don't have such a statistic
-	// XXX given the mask, we need stat functions to return Npixels used
-# endif
