Index: /trunk/psphot/src/psphotReadout.c
===================================================================
--- /trunk/psphot/src/psphotReadout.c	(revision 19910)
+++ /trunk/psphot/src/psphotReadout.c	(revision 19911)
@@ -36,6 +36,6 @@
     }
 
-    // set up the Visual display, display the image, weight, mask (ch 1,2,3)
-    psphotVisualShowImage (config, readout);
+    // display the image, weight, mask (ch 1,2,3)
+    psphotVisualShowImage (readout);
 
     // generate a background model (median, smoothed image)
@@ -69,8 +69,4 @@
     }
  
-    // display the peaks and footprints
-    psphotVisualShowPeaks (config, view, detections);
-    psphotVisualShowFootprints (config, view, detections);
-
     // construct sources and measure basic stats
     psArray *sources = psphotSourceStats (readout, recipe, detections);
@@ -80,6 +76,4 @@
     }
 
-    psphotVisualShowMoments (config, view, sources);
-
     // find blended neighbors of very saturated stars
     // XXX merge this with Basic Deblend?
@@ -93,5 +87,5 @@
 
     // classify sources based on moments, brightness
-    if (!psphotRoughClass (sources, recipe, havePSF)) {
+    if (!psphotRoughClass (readout, sources, recipe, havePSF)) {
         psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
         return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
@@ -101,6 +95,5 @@
     }
 
-    psphotVisualShowRoughClass (config, view, sources);
-    psphotVisualShowFlags (config, view, sources);
+    psphotImageQuality (recipe, sources);
 
     // if we were not supplied a PSF, choose one here
@@ -120,5 +113,5 @@
     }
 
-    psphotVisualShowPSFModel (config, readout, psf);
+    psphotVisualShowPSFModel (readout, psf);
 
     // Define source fitting parameters for everything that follows PSF fits
@@ -161,12 +154,8 @@
     psphotFitSourcesLinear (readout, sources, recipe, psf, FALSE);
 
-    // XXX we have to place this here because the models are not realized until psphotGuessModels
-    // or fitted until psphotFitSourcesLinear.  There is an example of generating a residual image 
-    // in pmPSFtry.c
-
-    psphotVisualShowPSFStars (config, view, psf, sources);
-    psphotVisualShowSatStars (config, view, psf, sources);
-    psphotVisualShowResidualImage (config, readout);
-    psphotVisualShowFlags (config, view, sources);
+    // We have to place these visualizations here because the models are not realized until
+    // psphotGuessModels or fitted until psphotFitSourcesLinear.
+    psphotVisualShowPSFStars (recipe, psf, sources);
+    psphotVisualShowSatStars (recipe, psf, sources);
 
     // identify CRs and extended sources
@@ -176,13 +165,7 @@
     }
 
-    psphotVisualPlotSourceSize (config, sources);
-    psphotVisualShowSourceSize (config, view, sources);
-
     // non-linear PSF and EXT fit to brighter sources
     psphotBlendFit (readout, sources, recipe, psf);
 
-    psphotVisualShowResidualImage (config, readout);
-    psphotVisualShowFlags (config, view, sources);
-
     // replace all sources
     psphotReplaceAllSources (sources, recipe);
@@ -190,7 +173,4 @@
     // 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
@@ -214,19 +194,12 @@
     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
     psArray *newSources = psphotSourceStats (readout, recipe, detections);
 
     // set source type
-    if (!psphotRoughClass (newSources, recipe, havePSF)) {
+    if (!psphotRoughClass (readout, newSources, recipe, havePSF)) {
         psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
         return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     }
-
-    psphotVisualShowRoughClass (config, view, sources);
-    psphotVisualShowFlags (config, view, sources);
 
     // create full input models
@@ -243,13 +216,8 @@
     psphotFitSourcesLinear (readout, sources, recipe, psf, TRUE);
 
-    psphotVisualShowResidualImage (config, readout);
-    psphotVisualShowFlags (config, view, sources);
-
 pass1finish:
 
     // measure source size for the remaining sources
     psphotSourceSize (config, readout, sources, recipe, 0);
-    psphotVisualPlotSourceSize (config, sources);
-    psphotVisualShowSourceSize (config, view, sources);
 
     psphotExtendedSourceAnalysis (readout, sources, recipe);
@@ -268,9 +236,6 @@
     }
 
-    psphotVisualPlotApResid (config, sources);
-
     // calculate source magnitudes
-    pmReadout *background = psphotSelectBackground (config, view, false);
-    psphotMagnitudes(sources, recipe, psf, background);
+    psphotMagnitudes(config, view, sources, recipe, psf);
 
     // replace failed sources?
