Index: trunk/psphot/src/psphotMergeSources.c
===================================================================
--- trunk/psphot/src/psphotMergeSources.c	(revision 20329)
+++ trunk/psphot/src/psphotMergeSources.c	(revision 20339)
@@ -71,8 +71,23 @@
     detections->peaks = psArrayAllocEmpty(100);
 
+    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
+    if (!recipe) {
+        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
+        return false;
+    }
+    float snMin = psMetadataLookupF32(NULL, recipe, "MOMENTS_SN_MIN");
+    if (!isfinite(snMin)) {
+        return NULL;
+    }
+
     for (int i = 0; i < sources->n; i++) {
         pmSource *source = sources->data[i];
         pmModel *model = source->modelPSF;
 
+        if (!isfinite(source->psfMag)) {
+            continue;
+        }
+
+        float flux = powf(10.0, -0.4 * source->psfMag);
         float xpos = model->params->data.F32[PM_PAR_XPOS];
         float ypos = model->params->data.F32[PM_PAR_YPOS];
@@ -81,6 +96,6 @@
         peak->xf = xpos;
         peak->yf = ypos;
-        peak->flux = 1.0;
-        peak->SN = INFINITY;
+        peak->flux = flux;
+        peak->SN = snMin + flux;
 
         psArrayAdd (detections->peaks, 100, peak);
