Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 17805)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 17826)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-05-12 21:52:18 $
+ *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-05-28 18:57:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -258,10 +258,10 @@
 
     // XXX if sources is NULL, skip the cell or write out empty tables?
-    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
+    // XXX if we use the file->name here, then we can use different pmFPAfiles for source output
+    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, file->name);
     if (!sources) {
         sources = psArrayAlloc(0);
-        psMetadataAddArray(readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE,
-                           "Blank array of sources", sources);
-        psFree(sources);                // Held onto by the metadata, so we can continue to use
+        psMetadataAddArray(readout->analysis, PS_LIST_TAIL, file->name, PS_META_REPLACE, "Blank array of sources", sources);
+        psFree(sources); // Held onto by the metadata, so we can continue to use
     }
 
@@ -872,5 +872,5 @@
     }
     readout->data_exists = true;
-    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);
+    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, file->name, PS_DATA_ARRAY, "input sources", sources);
     psFree (sources);
     return true;
@@ -886,5 +886,5 @@
 
     if (view->chip == -1) {
-        bool exists = pmFPACheckDataStatusForSources (fpa);
+        bool exists = pmFPACheckDataStatusForSources (fpa, name);
         return exists;
     }
@@ -896,5 +896,5 @@
 
     if (view->cell == -1) {
-        bool exists = pmChipCheckDataStatusForSources (chip);
+        bool exists = pmChipCheckDataStatusForSources (chip, name);
         return exists;
     }
@@ -906,5 +906,5 @@
 
     if (view->readout == -1) {
-        bool exists = pmCellCheckDataStatusForSources (cell);
+        bool exists = pmCellCheckDataStatusForSources (cell, name);
         return exists;
     }
@@ -916,9 +916,9 @@
     pmReadout *readout = cell->readouts->data[view->readout];
 
-    bool exists = pmReadoutCheckDataStatusForSources (readout);
+    bool exists = pmReadoutCheckDataStatusForSources (readout, file->name);
     return exists;
 }
 
-bool pmFPACheckDataStatusForSources (const pmFPA *fpa)
+bool pmFPACheckDataStatusForSources (const pmFPA *fpa, const char *name)
 {
     PS_ASSERT_PTR_NON_NULL(fpa, false);
@@ -928,10 +928,10 @@
         pmChip *chip = fpa->chips->data[i];
         if (!chip) continue;
-        if (pmChipCheckDataStatusForSources (chip)) return true;
+        if (pmChipCheckDataStatusForSources (chip, name)) return true;
     }
     return false;
 }
 
-bool pmChipCheckDataStatusForSources (const pmChip *chip)
+bool pmChipCheckDataStatusForSources (const pmChip *chip, const char *name)
 {
     PS_ASSERT_PTR_NON_NULL(chip, false);
@@ -941,10 +941,10 @@
         pmCell *cell = chip->cells->data[i];
         if (!cell) continue;
-        if (pmCellCheckDataStatusForSources (cell)) return true;
+        if (pmCellCheckDataStatusForSources (cell, name)) return true;
     }
     return false;
 }
 
-bool pmCellCheckDataStatusForSources (const pmCell *cell)
+bool pmCellCheckDataStatusForSources (const pmCell *cell, const char *name)
 {
     PS_ASSERT_PTR_NON_NULL(cell, false);
@@ -954,10 +954,10 @@
         pmReadout *readout = cell->readouts->data[i];
         if (!readout) continue;
-        if (pmReadoutCheckDataStatusForSources (readout)) return true;
+        if (pmReadoutCheckDataStatusForSources (readout, name)) return true;
     }
     return false;
 }
 
-bool pmReadoutCheckDataStatusForSources (const pmReadout *readout)
+bool pmReadoutCheckDataStatusForSources (const pmReadout *readout, const char *name)
 {
     PS_ASSERT_PTR_NON_NULL(readout, false);
@@ -966,5 +966,5 @@
 
     // select the psf of interest
-    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
+    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, name);
     if (!psf) return false;
     return true;
