Index: trunk/psphot/src/psphotSourceStats.c
===================================================================
--- trunk/psphot/src/psphotSourceStats.c	(revision 24588)
+++ trunk/psphot/src/psphotSourceStats.c	(revision 24589)
@@ -89,25 +89,14 @@
 
             if (!psThreadJobAddPending(job)) {
-                psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
+                psError(PS_ERR_UNKNOWN, false, "Unable to launch thread job PSPHOT_SOURCE_STATS");
                 psFree (job);
                 return NULL;
             }
             psFree(job);
-
-# if (0)
-                int nfail = 0;
-                int nmoments = 0;
-                if (!psphotSourceStats_Unthreaded (&nfail, &nmoments, cells->data[j], recipe)) {
-                    psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
-                    return NULL;
-                }
-                Nfail += nfail;
-                Nmoments += nmoments;
-# endif
         }
 
         // wait for the threads to finish and manage results
         if (!psThreadPoolWait (false)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
+            psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS");
             return NULL;
         }
@@ -149,9 +138,13 @@
     psMetadata *recipe              = job->args->data[1];
 
-    float INNER    = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");
-    if (!status) return false;
-    float MIN_SN   = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");
-    if (!status) return false;
-    float RADIUS   = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
+    float INNER        = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");
+    if (!status) return false;
+    float MIN_SN       = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");
+    if (!status) return false;
+    float RADIUS       = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
+    if (!status) return false;
+    float MIN_PIXEL_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_MIN_PIXEL_SN");
+    if (!status) return false;
+    float SIGMA        = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
     if (!status) return false;
 
@@ -202,5 +195,5 @@
 
         // measure basic source moments
-        status = pmSourceMoments (source, RADIUS);
+        status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);
         if (status) {
             Nmoments ++;
@@ -212,5 +205,5 @@
         BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
         psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
-        status = pmSourceMoments (source, BIG_RADIUS);
+        status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);
         if (status) {
             source->mode |= PM_SOURCE_MODE_BIG_RADIUS;
@@ -292,5 +285,5 @@
 
         // measure basic source moments
-        status = pmSourceMoments (source, RADIUS);
+        status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);
         if (status) {
             Nmoments ++;
@@ -302,5 +295,5 @@
         BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
         psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
-        status = pmSourceMoments (source, BIG_RADIUS);
+        status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);
         if (status) {
             Nmoments ++;
