Index: /trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- /trunk/psModules/src/objects/pmSourceIO.c	(revision 12480)
+++ /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;
     }
Index: /trunk/psModules/src/objects/pmSourceIO.h
===================================================================
--- /trunk/psModules/src/objects/pmSourceIO.h	(revision 12480)
+++ /trunk/psModules/src/objects/pmSourceIO.h	(revision 12481)
@@ -4,6 +4,6 @@
  * @author EAM, IfA; GLG, MHPCC
  *
- * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-03-15 20:44:55 $
+ * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-03-18 22:03:21 $
  * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  *
@@ -23,6 +23,6 @@
 bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header);
 
-bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *header, char *extname);
-bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *header, char *extname);
+bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
+bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
 
 psArray *pmSourcesReadCMP (char *filename, psMetadata *header);
Index: /trunk/psModules/src/objects/pmSourceIO_PS1_DEV_0.c
===================================================================
--- /trunk/psModules/src/objects/pmSourceIO_PS1_DEV_0.c	(revision 12480)
+++ /trunk/psModules/src/objects/pmSourceIO_PS1_DEV_0.c	(revision 12481)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-15 20:44:25 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-18 22:03:21 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -40,5 +40,5 @@
 // XXX how do I generate the source tables which I need to send to PSPS?
 
-bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *header, char *extname)
+bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
 {
 
@@ -107,5 +107,5 @@
 
     if (table->n == 0) {
-        psFitsWriteBlank (fits, header, extname);
+        psFitsWriteBlank (fits, tableHeader, extname);
         psFree (table);
         return true;
@@ -113,5 +113,5 @@
 
     psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
-    if (!psFitsWriteTable (fits, header, table, extname)) {
+    if (!psFitsWriteTable (fits, tableHeader, table, extname)) {
         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
         psFree(table);
Index: /trunk/psModules/src/objects/pmSourceIO_SMPDATA.c
===================================================================
--- /trunk/psModules/src/objects/pmSourceIO_SMPDATA.c	(revision 12480)
+++ /trunk/psModules/src/objects/pmSourceIO_SMPDATA.c	(revision 12481)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-11 18:56:38 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-18 22:03:21 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,5 +35,5 @@
 // this format consists of a header derived from the image header
 // followed by a zero-size matrix, followed by the table data
-bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *header, char *extname)
+bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
 {
 
@@ -48,5 +48,5 @@
 
     // find config information for output header
-    float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT");
+    float ZERO_POINT = psMetadataLookupF32 (&status, imageHeader, "ZERO_PT");
 
     table = psArrayAllocEmpty (sources->n);
@@ -89,5 +89,5 @@
 
     if (table->n == 0) {
-        psFitsWriteBlank (fits, header, extname);
+        psFitsWriteBlank (fits, tableHeader, extname);
         psFree (table);
         return true;
@@ -95,5 +95,5 @@
 
     psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
-    if (!psFitsWriteTable (fits, header, table, extname)) {
+    if (!psFitsWriteTable (fits, tableHeader, table, extname)) {
         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
         psFree(table);
