Index: trunk/psphot/src/psphotReadout.c
===================================================================
--- trunk/psphot/src/psphotReadout.c	(revision 19869)
+++ trunk/psphot/src/psphotReadout.c	(revision 19880)
@@ -69,14 +69,7 @@
     }
  
-    // display the backsub and backgnd images
+    // display the peaks and footprints
     psphotVisualShowPeaks (config, view, detections);
     psphotVisualShowFootprints (config, view, detections);
-
-    // XXX test write out the footprint image
-    if (0) {
-	psImage *footprintImage = pmSetFootprintArrayIDs (detections->footprints, true);
-	psphotSaveImage (NULL, footprintImage, "footprints.1.fits");
-	psFree (footprintImage);
-    }
 
     // construct sources and measure basic stats
@@ -109,4 +102,5 @@
 
     psphotVisualShowRoughClass (config, view, sources);
+    psphotVisualShowFlags (config, view, sources);
 
     // if we were not supplied a PSF, choose one here
@@ -173,25 +167,6 @@
     psphotVisualShowPSFStars (config, view, psf, sources);
     psphotVisualShowSatStars (config, view, psf, sources);
-    psphotVisualShowLinearFit (config, readout);
-
-    if (0) {
-        FILE *out = fopen ("out.pass1.dat", "w");
-
-        for (int i = 0; i < sources->n; i++) {
-            pmSource *source = sources->data[i];
-            if (!source) continue;
-            pmPeak *peak = source->peak;
-            if (!peak) continue;
-            pmModel *model = source->modelPSF;
-            if (!model) continue;
-            if (!model->params) continue;
-
-            fprintf (out, "%d %f %f  %f %f  %f %f\n",
-                     i, peak->xf, peak->yf, peak->flux, peak->SN,
-                     model->params->data.F32[PM_PAR_I0],
-                     model->dparams->data.F32[PM_PAR_I0]);
-        }
-        fclose (out);
-    }
+    psphotVisualShowResidualImage (config, readout);
+    psphotVisualShowFlags (config, view, sources);
 
     // identify CRs and extended sources
@@ -201,10 +176,11 @@
     }
 
-    // XXX psphotVisualShowSourceSize (config, view, sources);
+    psphotVisualShowSourceSize (config, view, sources);
 
     // non-linear PSF and EXT fit to brighter sources
     psphotBlendFit (readout, sources, recipe, psf);
 
-    // XXX psphotVisualShowNonLinearFit (config, view, sources);
+    psphotVisualShowResidualImage (config, readout);
+    psphotVisualShowFlags (config, view, sources);
 
     // replace all sources
@@ -213,4 +189,7 @@
     // linear fit to include all sources
     psphotFitSourcesLinear (readout, sources, recipe, psf, TRUE);
+
+    psphotVisualShowResidualImage (config, readout);
+    psphotVisualShowFlags (config, view, sources);
 
     // if we only do one pass, skip to extended source analysis
@@ -231,12 +210,10 @@
     detections = psphotFindDetections (detections, readout, recipe);
 
-    // XXX test write out the footprint image
-    if (0) {
-        psImage *footprintImage = pmSetFootprintArrayIDs (detections->footprints, true);
-        psphotSaveImage (NULL, footprintImage, "footprints.2.fits");
-        psFree (footprintImage);
-    }
     // remove noise for subtracted objects (ie, return to normal noise level)
     psphotSubNoise (readout, sources, recipe);
+
+    // display the new peaks and footprints
+    psphotVisualShowPeaks (config, view, detections);
+    psphotVisualShowFootprints (config, view, detections);
 
     // define new sources based on only the new peaks
@@ -249,4 +226,7 @@
     }
 
+    psphotVisualShowRoughClass (config, view, sources);
+    psphotVisualShowFlags (config, view, sources);
+
     // create full input models
     psphotGuessModels (readout, newSources, recipe, psf);
@@ -262,23 +242,6 @@
     psphotFitSourcesLinear (readout, sources, recipe, psf, TRUE);
 
-    if (0) {
-        FILE *out = fopen ("out.pass2.dat", "w");
-
-        for (int i = 0; i < sources->n; i++) {
-            pmSource *source = sources->data[i];
-            if (!source) continue;
-            pmPeak *peak = source->peak;
-            if (!peak) continue;
-            pmModel *model = source->modelPSF;
-            if (!model) continue;
-            if (!model->params) continue;
-
-            fprintf (out, "%d %f %f  %f %f  %f %f\n",
-                     i, peak->xf, peak->yf, peak->flux, peak->SN,
-                     model->params->data.F32[PM_PAR_I0],
-                     model->dparams->data.F32[PM_PAR_I0]);
-        }
-        fclose (out);
-    }
+    psphotVisualShowResidualImage (config, readout);
+    psphotVisualShowFlags (config, view, sources);
 
 pass1finish:
@@ -286,8 +249,6 @@
     // measure source size for the remaining sources
     psphotSourceSize (config, readout, sources, recipe, 0);
-    if (0) {
-        psphotSaveImage (NULL, readout->mask, "mask.fits");
-    }
-	
+    psphotVisualShowSourceSize (config, view, sources);
+
     psphotExtendedSourceAnalysis (readout, sources, recipe);
 
@@ -305,4 +266,6 @@
     }
 
+    psphotVisualPlotApResid (config, sources);
+
     // calculate source magnitudes
     pmReadout *background = psphotSelectBackground (config, view, false);
