Index: trunk/psphot/src/psphotReadoutFindPSF.c
===================================================================
--- trunk/psphot/src/psphotReadoutFindPSF.c	(revision 21248)
+++ trunk/psphot/src/psphotReadoutFindPSF.c	(revision 21249)
@@ -3,10 +3,6 @@
 // in this psphotReadout-variant, we are only trying to determine the PSF given an existing set
 // of input source positions to use as initial PSF stars.
-bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view) {
+bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, psArray *inSources) {
 
-    // measure the total elapsed time in psphotReadout.  XXX the current threading plan
-    // for psphot envisions threading within psphotReadout, not multiple threads calling
-    // the same psphotReadout.  In the current plan, this dtime is the elapsed time used
-    // jointly by the multiple threads, not the total time used by all threads.
     psTimerStart ("psphotReadout");
 
@@ -28,7 +24,9 @@
     psphotVisualShowImage (readout);
 
-    // include externally-supplied sources
-    // XXX this requires sources to be supplied as PSPHOT.INPUT.CMF
-    pmDetections *detections = psphotLoadPSFSources (config, view);
+    // Note that in this implementation, we do NOT model the background and we do not
+    // attempt to detect the sources in the image
+
+    // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)
+    pmDetections *detections = psphotDetectionsFromSources (config, inSources);
     if (!detections || !detections->peaks) {
         psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars");
@@ -40,13 +38,15 @@
     if (!sources) return false;
 
-    // mark all sources as PSFSTAR
+    // peak flux is wrong : set based on previous image
+    // use the peak measured in the moments analysis:
     for (int i = 0; i < sources->n; i++) {
       pmSource *source = sources->data[i];
-      source->type = PM_SOURCE_TYPE_STAR;
-      source->mode |= PM_SOURCE_MODE_PSFSTAR;
+      source->peak->flux = source->moments->Peak;
+    }
 
-      // peak flux is wrong : set based on previous image
-      // use the peak measured in the moments analysis:
-      source->peak->flux = source->moments->Peak;
+    // classify sources based on moments, brightness (psf is not known)
+    if (!psphotRoughClass (readout, sources, recipe, false)) {
+        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
+        return psphotReadoutCleanup (config, readout, recipe, detections, NULL, sources);
     }
 
