Index: /branches/eam_branches/ipp-20211108/psphot/src/psphotEfficiency.c
===================================================================
--- /branches/eam_branches/ipp-20211108/psphot/src/psphotEfficiency.c	(revision 42021)
+++ /branches/eam_branches/ipp-20211108/psphot/src/psphotEfficiency.c	(revision 42022)
@@ -3,6 +3,4 @@
 #define MODEL_MASK (PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE | \
                     PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_LIMITS) // Mask to apply to models
-
-# define TESTING 0
 
 // Calculate the limiting magnitude for an image
@@ -122,7 +120,9 @@
              meanVar, *covarFactor, thresh, *norm, *magLim);
 
-    *radius = smoothSigma * smoothNsigma;
+    *radius = 5 * smoothSigma * smoothNsigma;
 
     *minFlux = 0.1 * sqrtf(meanVar);
+
+    psLogMsg ("psphot", PS_LOG_INFO, "Detection efficiency PSF radius: %d, minFlux: %f\n", *radius, *minFlux);
 
     return true;
@@ -291,4 +291,5 @@
     psphotRemoveAllSourcesByArray(realSources, recipe);
 
+# define TESTING 0
 #if TESTING
     {
@@ -340,4 +341,5 @@
     psphotSaveImage(NULL, readout->mask, "fake_mask.fits");
 #endif
+#undef TESTING
 
     // XXX Could speed this up significantly by only convolving the central pixels of each fake source
@@ -424,4 +426,7 @@
                     continue;
                 }
+
+		// XXX this radius is too small : for faint sources the modelSum < 0.8*modelNorm and the
+		// source is rejected.  Add a factor of 2.0 to be sure we get value fluxes
                 float sourceRadius = PS_MAX(radius, model->class->modelRadius(model->params, minFlux)); // Radius for source
                 psFree(model);
@@ -536,4 +541,5 @@
         psVectorInit(magMask, 0);
 
+# define TESTING 1
 #if TESTING
         psString name = NULL;
Index: /branches/eam_branches/ipp-20211108/psphot/src/psphotFitSourcesLinear.c
===================================================================
--- /branches/eam_branches/ipp-20211108/psphot/src/psphotFitSourcesLinear.c	(revision 42021)
+++ /branches/eam_branches/ipp-20211108/psphot/src/psphotFitSourcesLinear.c	(revision 42022)
@@ -217,4 +217,12 @@
     int Nsat = 0;
 
+    // track number kept at several stages of the analysis
+    int Nstep_0 = 0;
+    int Nstep_1 = 0;
+    int Nstep_2 = 0;
+    int Nstep_3 = 0;
+    int Nstep_4 = 0;
+    int Nstep_5 = 0;
+
     // select the sources which will be used for the fitting analysis
     for (int i = 0; i < sources->n; i++) {
@@ -246,4 +254,6 @@
         if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
 
+	Nstep_0++;
+
 	// XXX count saturated stars
         if (source->mode & PM_SOURCE_MODE_SATSTAR) {
@@ -255,4 +265,5 @@
             if (!pmSourceCacheModel (source, maskVal)) continue;
         }
+	Nstep_1++;
 
         // save the original coords
@@ -265,4 +276,5 @@
         if (x > AnalysisRegion.x1) continue;
         if (y > AnalysisRegion.y1) continue;
+	Nstep_2++;
 
 	// check the integral of the model : is it large enough?
@@ -283,4 +295,6 @@
             continue;
         }
+	Nstep_3++;
+
 	bool isPSF = false;
         pmModel *model = pmSourceGetModel (&isPSF, source);
@@ -306,5 +320,8 @@
         } 
         if (modelSum  < cutModelSum * normFlux) continue;
+	Nstep_4++;
+
         if (maskedSum < cutMaskedSum * normFlux) continue;
+	Nstep_5++;
 
 	// clear the 'mark' pixels and remask on the fit aperture 
@@ -322,4 +339,5 @@
     }
     psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "built fitSources: %f sec (%ld objects)\n", psTimerMark ("psphot.linear"), sources->n);
+    psLogMsg ("psphot.ensemble", PS_LOG_INFO, "Number of sources kept at each stage: %d %d %d %d %d %d\n", Nstep_0, Nstep_1, Nstep_2, Nstep_3, Nstep_4, Nstep_5);
 
     if (fitSources->n == 0) {
