Index: trunk/psphot/src/psphotFindDetections.c
===================================================================
--- trunk/psphot/src/psphotFindDetections.c	(revision 17444)
+++ trunk/psphot/src/psphotFindDetections.c	(revision 17870)
@@ -6,4 +6,6 @@
     bool status;
     int pass;
+    float NSIGMA_PEAK = 25.0;
+    int NMAX = 0;
 
     psTimerStart ("psphot");
@@ -20,7 +22,13 @@
 	detections = pmDetectionsAlloc();
 	pass = 1;
+        NSIGMA_PEAK = psMetadataLookupF32 (&status, recipe, "PEAKS_NSIGMA_LIMIT"); PS_ASSERT (status, NULL);
+        NMAX = psMetadataLookupS32 (&status, recipe, "PEAKS_NMAX"); PS_ASSERT (status, NULL);
     } else {
 	pass = 2;
+        NSIGMA_PEAK = psMetadataLookupF32 (&status, recipe, "PEAKS_NSIGMA_LIMIT_2"); PS_ASSERT (status, NULL);
+	NMAX = 0; // unlimited number of peaks in final pass: allow a limit (PEAKS_NMAX_2) ?
     }
+
+    float threshold = PS_SQR(NSIGMA_PEAK);
 
     // move the old peaks array (if it exists) to oldPeaks 
@@ -34,5 +42,6 @@
 
     // detect the peaks in the significance image
-    detections->peaks = psphotFindPeaks (significance, readout, recipe, pass, maskVal);
+    detections->peaks = psphotFindPeaks (significance, readout, recipe, threshold, NMAX);
+    psMetadataAddF32  (recipe, PS_LIST_TAIL, "PEAK_THRESHOLD", PS_META_REPLACE, "Peak Detection Threshold", threshold);
 
     // optionally merge peaks into footprints
@@ -47,5 +56,2 @@
 // if we use the footprints, the output peaks list contains both old and new peaks,
 // otherwise it only contains the new peaks.
-
-// if psf is defined, we should treat this as pass "2", not "1".  re-define this boolean to
-// be "have PSF"
