Index: trunk/psphot/src/psphotOutput.c
===================================================================
--- trunk/psphot/src/psphotOutput.c	(revision 5993)
+++ trunk/psphot/src/psphotOutput.c	(revision 6056)
@@ -2,5 +2,5 @@
 
 // output functions: we have several fixed modes (sx, obj, cmp)
-void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
+void psphotOutput (pmReadout *readout, psMetadata *header, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
 
     bool status;
@@ -13,6 +13,6 @@
     char *psfFile    = psMetadataLookupPtr (&status, config, "PSF_OUTPUT_FILE");
 
-    if (residImage != NULL) psphotSaveImage (imdata->header, imdata->image, residImage);
-    psphotSamplePSFs (config, psf, imdata->image);
+    if (residImage != NULL) psphotSaveImage (header, readout->image, residImage);
+    psphotSamplePSFs (config, psf, readout->image);
 
     if (psfFile != NULL) {
@@ -30,21 +30,21 @@
     }
     if (!strcasecmp (outputMode, "OBJ")) {
-	pmSourcesWriteOBJ (imdata, config, outputFile, sources, psf, sky);
+	pmSourcesWriteOBJ (readout, config, outputFile, sources, psf, sky);
 	return;
     }
     if (!strcasecmp (outputMode, "SX")) {
-	pmSourcesWriteSX (imdata, config, outputFile, sources, psf, sky);
+	pmSourcesWriteSX (readout, config, outputFile, sources, psf, sky);
 	return;
     }
     if (!strcasecmp (outputMode, "CMP")) {
-	pmSourcesWriteCMP (imdata, config, outputFile, sources, psf, sky);
+	pmSourcesWriteCMP (readout, header, config, outputFile, sources, psf, sky);
 	return;
     }
     if (!strcasecmp (outputMode, "CMF")) {
-	pmSourcesWriteCMF (imdata, config, outputFile, sources, psf, sky);
+	pmSourcesWriteCMF (readout, header, config, outputFile, sources, psf, sky);
 	return;
     }
     if (!strcasecmp (outputMode, "TEXT")) {
-	pmSourcesWriteText (imdata, config, outputFile, sources, psf, sky);
+	pmSourcesWriteText (readout, config, outputFile, sources, psf, sky);
 	return;
     }
@@ -54,5 +54,5 @@
 
 // dophot-style output list with fixed line width
-bool pmSourcesWriteOBJ (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
+bool pmSourcesWriteOBJ (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
 
     int type;
@@ -106,5 +106,5 @@
 
 // elixir-mode / sextractor-style output list with fixed line width
-bool pmSourcesWriteSX (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
+bool pmSourcesWriteSX (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
 
     pmModel *model;
@@ -157,5 +157,5 @@
 
 // elixir-style pseudo FITS table (header + ascii list)
-bool pmSourcesWriteCMP (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
+bool pmSourcesWriteCMP (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
 
     int i, type;
@@ -172,6 +172,6 @@
 
     // write necessary information to output header
-    psphotUpdateHeader (imdata->header, config);
-    psMetadataAdd (imdata->header, PS_LIST_TAIL, "NSTARS",   PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n);
+    psphotUpdateHeader (header, config);
+    psMetadataAdd (header, PS_LIST_TAIL, "NSTARS",   PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n);
 
     // create file, write-out header
@@ -179,10 +179,10 @@
 
     // set NAXIS to 0 : CFITSIO requires isolated header to have NAXIS = 0
-    mdi = psMetadataLookup (imdata->header, "NAXIS");
+    mdi = psMetadataLookup (header, "NAXIS");
     mdi->data.S32 = 0;
     mdi->type = PS_DATA_S32;
 
-    // psMetadataAdd (imdata->header, PS_LIST_HEAD, "NAXIS", PS_DATA_S32 | PS_META_REPLACE, "", 0);
-    psFitsWriteHeader (imdata->header, fits);
+    // psMetadataAdd (header, PS_LIST_HEAD, "NAXIS", PS_DATA_S32 | PS_META_REPLACE, "", 0);
+    psFitsWriteHeader (header, fits);
     psFitsClose (fits);
 
@@ -232,5 +232,5 @@
 // this format consists of a header derived from the image header
 // followed by a zero-size matrix, followed by the table data
-bool pmSourcesWriteCMF (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
+bool pmSourcesWriteCMF (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
 
     psArray *table;
@@ -249,5 +249,5 @@
 
     // write necessary information to output header
-    psphotUpdateHeader (imdata->header, config);
+    psphotUpdateHeader (header, config);
 
     table = psArrayAlloc (sources->n);
@@ -286,9 +286,9 @@
 
     // write the correct number of sources in the header
-    psMetadataAdd (imdata->header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", table->n);
-    psMetadataAdd (imdata->header, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true);
+    psMetadataAdd (header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", table->n);
+    psMetadataAdd (header, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true);
 
     // set NAXIS to 0 (we don't write out the data array)
-    mdi = psMetadataLookup (imdata->header, "NAXIS");
+    mdi = psMetadataLookup (header, "NAXIS");
     mdi->data.S32 = 0;
     mdi->type = PS_DATA_S32;
@@ -300,5 +300,5 @@
     // write out the header and table
     psFits *fits = psFitsOpen (filename, "w");
-    psFitsWriteHeader (imdata->header, fits);
+    psFitsWriteHeader (header, fits);
     psFitsWriteTable (fits, theader, table);
     psFitsClose (fits);
@@ -309,5 +309,5 @@
 /***** Text Output Methods *****/
 
-bool pmSourcesWriteText (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) {
+bool pmSourcesWriteText (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) {
 
     char *name = (char *) psAlloc (strlen(filename) + 10);
