Index: trunk/ppSim/src/ppSimPhotomReadout.c
===================================================================
--- trunk/ppSim/src/ppSimPhotomReadout.c	(revision 26900)
+++ trunk/ppSim/src/ppSimPhotomReadout.c	(revision 27657)
@@ -6,5 +6,8 @@
     PS_ASSERT_PTR_NON_NULL (readout, NULL);
 
-    psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
+    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
+    psAssert (detections, "missing detections?");
+
+    psArray *sources = detections->allSources;
     return sources;
 }
@@ -151,6 +154,4 @@
 
     // create the exported-metadata and free local data
-    // XXX this places the sources on readout->analysis as PSPHOT.SOURCES.  modify?
-    // (or don't supply the sources, and do this with a different function)
     psphotReadoutCleanup(config, readout, recipe, NULL, psf, NULL);
 
@@ -167,6 +168,14 @@
     psAssert (forceReadout, "no forceReadout?");
     pmChipSetDataStatus (forceChip, true);
-    psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "forced photometry ", forceSources);
-    psFree (forceSources);
+
+    pmDetections *detectionsForce = pmDetectionsAlloc();
+    detectionForce->allSources = forceSources;
+
+    // save detections on the readout->analysis
+    if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "force sources", detectionsForce)) {
+	psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
+	return false;
+    }
+    psFree(detectionsForce);
 
     pmCell    *fakeCell    = pmFPAfileThisCell (config->files, view, "PPSIM.FAKE.SOURCES"); psAssert (fakeCell, "no cell?");
@@ -179,5 +188,14 @@
     psAssert (fakeReadout, "no fakeReadout?");
     pmChipSetDataStatus (fakeChip, true);
-    psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "fake photometry ", fakeSources);
+
+    pmDetections *detectionsFake = pmDetectionsAlloc();
+    detectionFake->allSources = fakeSources;
+
+    // save detections on the readout->analysis
+    if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "fake sources", detectionsFake)) {
+	psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
+	return false;
+    }
+    psFree(detectionsFake);
 
     return true;
