Index: branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c
===================================================================
--- branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c	(revision 26642)
+++ branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c	(revision 26643)
@@ -1,5 +1,5 @@
 # include "psphotInternal.h"
 
-bool psphotBasicDeblend (psArray *sources, psMetadata *recipe) {
+bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
 
     int N;
@@ -8,7 +8,21 @@
     pmSource *source, *testSource;
 
+    psTimerStart ("psphot.deblend.basic");
+
     int Nblend = 0;
 
-    psTimerStart ("psphot.deblend.basic");
+    // find the currently selected readout
+    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
+    psAssert (readout, "missing file?");
+
+    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
+    psAssert (readout, "missing readout?");
+
+    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
+    psAssert (sources, "missing sources?");
+
+    // select the appropriate recipe information
+    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
+    psAssert (recipe, "missing recipe?");
 
     float FRACTION = psMetadataLookupF32 (&status, recipe, "DEBLEND_PEAK_FRACTION");
@@ -128,2 +142,20 @@
     return true;
 }
+
+// for now, let's store the detections on the readout->analysis for each readout
+bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view)
+{
+    bool status = true;
+
+    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
+    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
+
+    // loop over the available readouts
+    for (int i = 0; i < num; i++) {
+	if (!psphotBasicDeblendReadout (config, view, "PSPHOT.INPUT", i)) {
+            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+	    return false;
+	}
+    }
+    return true;
+}
