Index: /branches/eam_branches/ipp-20110710/psphot/src/psphotFindFootprints.c
===================================================================
--- /branches/eam_branches/ipp-20110710/psphot/src/psphotFindFootprints.c	(revision 32333)
+++ /branches/eam_branches/ipp-20110710/psphot/src/psphotFindFootprints.c	(revision 32334)
@@ -59,12 +59,12 @@
     detections->peaks = pmFootprintArrayToPeaks(detections->footprints);
 
-    psphotFootprintSaddles (readout, detections->footprints);
-
-    int nSaddle = 0;
-    for (int i = 0; i < detections->peaks->n; i++) {
-	pmPeak *peak = detections->peaks->data[i];
-	
-	if (peak->saddlePoints) nSaddle += peak->saddlePoints->n;
-    }
+    // psphotFootprintSaddles (readout, detections->footprints);
+    // 
+    // int nSaddle = 0;
+    // for (int i = 0; i < detections->peaks->n; i++) {
+    // 	pmPeak *peak = detections->peaks->data[i];
+    // 	
+    // 	if (peak->saddlePoints) nSaddle += peak->saddlePoints->n;
+    // }
     // fprintf (stderr, "%d saddle points for %ld peaks\n", nSaddle, detections->peaks->n);
 
Index: /branches/eam_branches/ipp-20110710/psphot/src/psphotKronIterate.c
===================================================================
--- /branches/eam_branches/ipp-20110710/psphot/src/psphotKronIterate.c	(revision 32333)
+++ /branches/eam_branches/ipp-20110710/psphot/src/psphotKronIterate.c	(revision 32334)
@@ -84,6 +84,4 @@
         MIN_KRON_RADIUS = 0.25*RADIUS;
     }
-
-    float EXT_FIT_MAX_RADIUS = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_RADIUS");
 
     // bit-masks to test for good/bad pixels
@@ -145,5 +143,4 @@
             PS_ARRAY_ADD_SCALAR(job->args, RADIUS,             PS_TYPE_F32);
             PS_ARRAY_ADD_SCALAR(job->args, MIN_KRON_RADIUS,    PS_TYPE_F32);
-            PS_ARRAY_ADD_SCALAR(job->args, EXT_FIT_MAX_RADIUS, PS_TYPE_F32);
 
 // set this to 0 to run without threading
@@ -194,5 +191,4 @@
     float RADIUS                    = PS_SCALAR_VALUE(job->args->data[5],F32);
     float MIN_KRON_RADIUS           = PS_SCALAR_VALUE(job->args->data[6],F32);
-    float EXT_FIT_MAX_RADIUS        = PS_SCALAR_VALUE(job->args->data[7],F32);
 
     for (int j = 0; j < 5; j++) {
@@ -212,9 +208,18 @@
 	    }
 
+	    // use S/N to control max window size
+	    float kronSN = source->moments->KronFlux / source->moments->KronFluxErr;
+
+	    // maxWindow -> 1.5*RADIUS for kronSN = 5.0, keeping S.B. constant (kronSN ~ flux)
+	    // (kronSN / maxWindow^2) = (5.0 / (1.5 RADIUS)^2)
+	    // maxWindow = 1.5 * RADIUS * sqrt(kronSN / 5.0)
+	    float maxWindow = (isfinite(kronSN) && (kronSN > 5.0)) ? 1.5 * RADIUS * sqrt(kronSN / 5.0) : 1.5*RADIUS;
+
 	    // iterate to the window radius
-	    float windowRadius = PS_MIN(PS_MAX(RADIUS, 4.0*source->moments->Mrf), EXT_FIT_MAX_RADIUS);
+	    float windowRadius = PS_MIN(PS_MAX(RADIUS, 4.0*source->moments->Mrf), maxWindow);
 
 	    // re-allocate image, weight, mask arrays for each peak with box big enough to fit BIG_RADIUS
 	    pmSourceRedefinePixels (source, readout, source->peak->x, source->peak->y, windowRadius + 2);
+	    psAssert (source->pixels, "WTF?");
 
 	    // clear the window function for this source based on the moments
Index: /branches/eam_branches/ipp-20110710/psphot/src/psphotSetThreads.c
===================================================================
--- /branches/eam_branches/ipp-20110710/psphot/src/psphotSetThreads.c	(revision 32333)
+++ /branches/eam_branches/ipp-20110710/psphot/src/psphotSetThreads.c	(revision 32334)
@@ -30,5 +30,5 @@
     psFree(task);
 
-    task = psThreadTaskAlloc("PSPHOT_KRON_ITERATE", 8);
+    task = psThreadTaskAlloc("PSPHOT_KRON_ITERATE", 7);
     task->function = &psphotKronIterate_Threaded;
     psThreadTaskAdd(task);
