Index: trunk/psphot/src/psphot.c
===================================================================
--- trunk/psphot/src/psphot.c	(revision 5993)
+++ trunk/psphot/src/psphot.c	(revision 6056)
@@ -5,5 +5,6 @@
 
     psMetadata  *config  = NULL;
-    eamReadout  *imdata  = NULL;
+    psMetadata  *header  = NULL;
+    pmReadout   *readout  = NULL;
     psArray     *sources = NULL;
     psArray     *peaks   = NULL;
@@ -18,21 +19,21 @@
 
     // load input data (config and images (signal, noise, mask)
-    imdata = psphotSetup (config);
+    readout = psphotSetup (config, &header);
 
     // run a single-model test if desired
-    psphotModelTest (imdata, config);
+    psphotModelTest (readout, config);
 
     // measure image stats for initial guess 
-    sky = psphotImageStats (imdata, config);
+    sky = psphotImageStats (readout, config);
 
     // generate a background model (currently, 2D polynomial)
     // XXX this should be available to be re-added to the original image
-    psphotImageBackground (imdata, config, sky);
+    psphotImageBackground (readout, config, sky);
 
     // find the peaks in the image
-    peaks = psphotFindPeaks (imdata, config, sky);
+    peaks = psphotFindPeaks (readout, config, sky);
 
     // construct sources and measure basic stats
-    sources = psphotSourceStats (imdata, config, peaks);
+    sources = psphotSourceStats (readout, config, peaks);
 
     // classify sources based on moments, brightness
@@ -49,33 +50,33 @@
     switch (FITMODE) {
       case 0:
-	psphotEnsemblePSF (imdata, config, sources, psf, sky);
+	psphotEnsemblePSF (readout, config, sources, psf, sky);
 	break;
 
       case 1:
-	psphotEnsemblePSF (imdata, config, sources, psf, sky);
-	psphotFullFit (imdata, config, sources, psf, sky);
+	psphotEnsemblePSF (readout, config, sources, psf, sky);
+	psphotFullFit (readout, config, sources, psf, sky);
 	psphotReplaceUnfit (sources);
-	psphotApResid (imdata, sources, config, psf);
+	psphotApResid (readout, sources, config, psf);
 	break;
 
       case 2:
-	psphotEnsemblePSF (imdata, config, sources, psf, sky);
-	psphotBlendFit (imdata, config, sources, psf, sky);
+	psphotEnsemblePSF (readout, config, sources, psf, sky);
+	psphotBlendFit (readout, config, sources, psf, sky);
 	psphotReplaceUnfit (sources);
-	psphotApResid (imdata, sources, config, psf);
+	psphotApResid (readout, sources, config, psf);
 	break;
 
       case 3:
-	psphotApplyPSF (imdata, config, sources, psf, sky);
+	psphotApplyPSF (readout, config, sources, psf, sky);
 	break;
 
       case 4:
-	psphotApplyPSF (imdata, config, sources, psf, sky);
-	psphotFitExtended (imdata, config, sources, sky);
+	psphotApplyPSF (readout, config, sources, psf, sky);
+	psphotFitExtended (readout, config, sources, sky);
 	break;
     }
 
     // write out data in appropriate format
-    psphotOutput (imdata, config, sources, psf, sky);
+    psphotOutput (readout, header, config, sources, psf, sky);
     psLogMsg ("psphot", 3, "wrote output: %f sec\n", psTimerMark ("psphot"));
     psLogMsg ("psphot", 3, "complete psphot run: %f sec\n", psTimerMark ("complete"));
