Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 12464)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 12481)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-16 01:48:55 $
+ *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-18 22:03:08 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,5 @@
 #include "pmFPAview.h"
 #include "pmFPAfile.h"
+#include "pmConcepts.h"
 
 #include "pmPeaks.h"
@@ -333,19 +334,8 @@
         }
 
-        // create a header to hold the output data
-        outhead = psMetadataAlloc ();
-
-	// save psphot and psastro metadata in the image and table headers
-	// XXX this is a bit silly: we are duplicating these because I'm not sure which
-	// I need to keep for multi-readout images...
-	updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER");
-	if (updates) {
-	    psMetadataCopy (outhead, updates);
-	}
-	updates = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.HEADER");
-	if (updates) {
-	    psMetadataCopy (outhead, updates);
-	}
-
+	// create a header to hold the output data
+	outhead = psMetadataAlloc ();
+
+	// determine the output table format 
 	psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
 	if (!status) {
@@ -358,4 +348,5 @@
 	} 
 
+	// write the links to the image header
         psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTHEAD", PS_META_REPLACE, "name of image extension w/", headname);
         psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", exttype);
@@ -365,8 +356,8 @@
 	status = false;
 	if (!strcmp (exttype, "SMPDATA")) {
-	    status = pmSourcesWrite_SMPDATA (file->fits, sources, outhead, dataname);
+	    status = pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname);
 	}
 	if (!strcmp (exttype, "PS1_DEV_0")) {
-	    status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, outhead, dataname);
+	    status = pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname);
 	}
 
@@ -466,4 +457,12 @@
         pmReadout *readout = cell->readouts->data[i];
         pmReadoutReadObjects (readout, view, file, config);
+
+	// load in the concept information for this cell
+	if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
+	    //psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for cell");
+	    //return false;
+	    psWarning("Difficulty reading concepts for cell; attempting to proceed.");
+	}
+
         cell->data_exists = true;
     }
