Index: trunk/psphot/src/psphot.h
===================================================================
--- trunk/psphot/src/psphot.h	(revision 27672)
+++ trunk/psphot/src/psphot.h	(revision 27673)
@@ -177,5 +177,5 @@
 psArray        *psphotFindPeaks (psImage *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax);
 bool            psphotFindFootprints (pmDetections *detections, psImage *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal);
-psErrorCode     psphotCullPeaks(const psImage *img, const psImage *weight, const psMetadata *recipe, psArray *footprints);
+psErrorCode     psphotCullPeaks(const pmReadout *readout, const psMetadata *recipe, psArray *footprints);
 
 // in psphotApResid.c:
Index: trunk/psphot/src/psphotCullPeaks.c
===================================================================
--- trunk/psphot/src/psphotCullPeaks.c	(revision 27672)
+++ trunk/psphot/src/psphotCullPeaks.c	(revision 27673)
@@ -5,9 +5,10 @@
  */
 psErrorCode
-psphotCullPeaks(const psImage *image,   // the image wherein lives the footprint
-                const psImage *weight,  // corresponding variance image
+psphotCullPeaks(const pmReadout *readout,   // the image wherein lives the footprint
                 const psMetadata *recipe,
                 psArray *footprints) {  // array of pmFootprints
+
     bool status = false;
+
     float nsigma_delta = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_DELTA");
     if (!status) {
@@ -22,14 +23,26 @@
         fPadding = 0;
     }
-    const float skyStdev = psMetadataLookupF32(NULL, recipe, "SKY_STDEV");
+    const float skyStdev = psMetadataLookupF32(&status, readout->analysis, "SKY_STDEV");
+    psAssert (status, "cannot find SKY_STDEV in readout->analysis");
+
     const float min_threshold = nsigma_min*skyStdev;
     
     for (int i = 0; i < footprints->n; i++) {
+	// if (i % 50 == 0) fprintf (stderr, "cull %d\n", i);
 	pmFootprint *fp = footprints->data[i];
-	if (pmFootprintCullPeaks(image, weight, fp, nsigma_delta, fPadding, min_threshold) != PS_ERR_NONE) {
+	if (fp->npix > 30000) {
+	    fprintf (stderr, "big footprint: %f %f to %f %f (%d pix)\n", fp->bbox.x0, fp->bbox.y0, fp->bbox.x1, fp->bbox.y1, fp->npix);
+	}
+	psTimerStart ("psphot.cull.footprints");
+	if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, min_threshold) != PS_ERR_NONE) {
 	    return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
 	}
+	float dtime = psTimerMark ("psphot.cull.footprints");
+	if (dtime > 1.0) {
+	    fprintf (stderr, "slow cull for %d (%f sec)\n", i, dtime);
+	}
     }
-    
     return PS_ERR_NONE;
 }
+
+// psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks, %ld total footprints: %f sec\n", detections->peaks->n, detections->footprints->n, 
Index: trunk/psphot/src/psphotFindFootprints.c
===================================================================
--- trunk/psphot/src/psphotFindFootprints.c	(revision 27672)
+++ trunk/psphot/src/psphotFindFootprints.c	(revision 27673)
@@ -55,5 +55,5 @@
     }
 
-    psphotCullPeaks(readout->image, readout->variance, recipe, detections->footprints);
+    psphotCullPeaks(readout, recipe, detections->footprints);
     detections->peaks = pmFootprintArrayToPeaks(detections->footprints);
     psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks, %ld total footprints: %f sec\n", detections->peaks->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
