Index: branches/tap_branches/psphot/src/psphotCullPeaks.c
===================================================================
--- branches/tap_branches/psphot/src/psphotCullPeaks.c	(revision 25900)
+++ branches/tap_branches/psphot/src/psphotCullPeaks.c	(revision 27838)
@@ -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, 
