Index: /branches/eam_branches/psphot.stack.20100120/src/psphotAddNoise.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotAddNoise.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotAddNoise.c	(revision 26772)
@@ -24,5 +24,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotAddOrSubNoiseReadout (config, view, "PSPHOT.INPUT", i, recipe, add)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on to modify noise for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotApResid.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotApResid.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotApResid.c	(revision 26772)
@@ -19,5 +19,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotApResidReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to measure aperture residual for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
@@ -352,5 +352,6 @@
     psFree (mag);
     psFree (dMag);
-    return false;
+    return true;
+    // this is a quality error, not a programming error
 }
 
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c	(revision 26772)
@@ -12,5 +12,5 @@
     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);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on basic deblend analysis for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotBlendFit.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotBlendFit.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotBlendFit.c	(revision 26772)
@@ -16,5 +16,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotBlendFitReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (non-linear) for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotChoosePSF.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotChoosePSF.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotChoosePSF.c	(revision 26772)
@@ -16,5 +16,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotEfficiency.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotEfficiency.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotEfficiency.c	(revision 26772)
@@ -164,5 +164,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotEfficiencyReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceAnalysis.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceAnalysis.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceAnalysis.c	(revision 26772)
@@ -22,5 +22,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotExtendedSourceAnalysisReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceFits.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceFits.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotExtendedSourceFits.c	(revision 26772)
@@ -22,5 +22,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotExtendedSourceFitsReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on to fit extended sources for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotFitSourcesLinear.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotFitSourcesLinear.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotFitSourcesLinear.c	(revision 26772)
@@ -23,5 +23,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotFitSourcesLinearReadout (config, view, "PSPHOT.INPUT", i, final)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotGuessModels.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotGuessModels.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotGuessModels.c	(revision 26772)
@@ -18,5 +18,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotGuessModelsReadout (config, view, "PSPHOT.INPUT", i)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on to guess models for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotImageQuality.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotImageQuality.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotImageQuality.c	(revision 26772)
@@ -19,5 +19,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotImageQualityReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on to measure image quality for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotMagnitudes.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotMagnitudes.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotMagnitudes.c	(revision 26772)
@@ -15,5 +15,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotMagnitudesReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c	(revision 26772)
@@ -168,4 +168,5 @@
     if (!detections) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
+	return NULL;
     }
 
@@ -173,4 +174,5 @@
     if (!sources) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
+	return NULL;
     }
 
@@ -178,4 +180,7 @@
 }
 
+// this function is used to fix sources which were loaded externally, but have passed from
+// psphotDetectionsFromSources to psphotSourceStats and are now stored on
+// detections->newSources.
 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view) {
 
@@ -193,5 +198,5 @@
     }
 
-    psArray *sources = detections->allSources;
+    psArray *sources = detections->newSources;
     psAssert (sources, "missing sources?");
 
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutFindPSF.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutFindPSF.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutFindPSF.c	(revision 26772)
@@ -26,5 +26,5 @@
     }
 
-    // construct sources and measure basic stats (moments, local sky)
+    // construct detections->newSources and measure basic stats (moments, local sky)
     if (!psphotSourceStats(config, view, true)) {
         psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
@@ -60,5 +60,11 @@
     // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
     psphotGuessModels (config, view);
+# endif
 
+    // merge the newly selected sources into the existing list
+    // NOTE: merge OLD and NEW
+    psphotMergeSources (config, view); 
+
+# if 0
     // measure aperture photometry corrections
     if (!psphotApResid (config, view)) {
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutKnownSources.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutKnownSources.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotReadoutKnownSources.c	(revision 26772)
@@ -51,4 +51,8 @@
     psphotGuessModels (config, view);
 
+    // merge the newly selected sources into the existing list
+    // NOTE: merge OLD and NEW
+    psphotMergeSources (config, view); 
+
     // linear PSF fit to source peaks
     psphotFitSourcesLinear (config, view, false);
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotReplaceUnfit.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotReplaceUnfit.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotReplaceUnfit.c	(revision 26772)
@@ -37,5 +37,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotReplaceAllSourcesReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotRoughClass.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotRoughClass.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotRoughClass.c	(revision 26772)
@@ -22,5 +22,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotRoughClassReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotSkyReplace.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotSkyReplace.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotSkyReplace.c	(revision 26772)
@@ -11,5 +11,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotSkyReplaceReadout (config, view, "PSPHOT.INPUT", i)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to replace sky for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotSourceFreePixels.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotSourceFreePixels.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotSourceFreePixels.c	(revision 26772)
@@ -11,5 +11,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotSourceFreePixelsReadout (config, view, "PSPHOT.INPUT", i)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed to free source pixels for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
Index: /branches/eam_branches/psphot.stack.20100120/src/psphotSourceSize.c
===================================================================
--- /branches/eam_branches/psphot.stack.20100120/src/psphotSourceSize.c	(revision 26771)
+++ /branches/eam_branches/psphot.stack.20100120/src/psphotSourceSize.c	(revision 26772)
@@ -44,5 +44,5 @@
     for (int i = 0; i < num; i++) {
 	if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i, recipe, getPSFsize)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
+            psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for PSPHOT.INPUT entry %d", i);
 	    return false;
 	}
