Index: /branches/eam_branch_20080511/ppSim/src/ppSimLoadForceSources.c
===================================================================
--- /branches/eam_branch_20080511/ppSim/src/ppSimLoadForceSources.c	(revision 17929)
+++ /branches/eam_branch_20080511/ppSim/src/ppSimLoadForceSources.c	(revision 17930)
@@ -12,18 +12,6 @@
     pmFPAfileActivate (config->files, true, "PSASTRO.OUT.REFSTARS");
 
-    // this loop selects the matched stars for all chips
-    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
-        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
-        if (!chip->process || !chip->file_exists) { continue; }
-	if (!chip->fromFPA) { continue; }
-
-        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
-            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
-            if (!cell->process || !cell->file_exists) { continue; }
-
-            // process each of the readouts
-            // XXX there can only be one readout per chip in astrometry, right?
-            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
-                if (! readout->data_exists) { continue; }
+    readout = pmFPAviewThisReadout (view, fpa);
+    if (! readout->data_exists) { continue; }
 
                 // read WCS data from the corresponding header
Index: /branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
===================================================================
--- /branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c	(revision 17929)
+++ /branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c	(revision 17930)
@@ -1,18 +1,15 @@
 # include "ppSim.h"
 
-bool ppSimLoadSpots (pmFPA *fpa, pmConfig *config) {
+// need to specify an alternative CATDIR for the force positions
+bool ppSimLoadSpots (psArray *spots, pmFPA *fpa, pmConfig *config) {
 
-# if (0)
+    bool status;
 
-    bool mdok;
-    assert (stars);
+    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe
 
-    psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSIM_RECIPE); // Recipe
-
-    bool forcedPhot = psMetadataLookupBool(&mdok, recipe, "FORCED.PHOT"); // Density of fakes
+    bool forcedPhot = psMetadataLookupBool(&status, recipe, "FORCED.PHOT"); // Density of fakes
     if (!forcedPhot) return true;
 
-    // Read catalogue stars using psastro
-    // XXX probably need to modify this...
+    // We read the catalogue stars using psastroLoadRefstars
     psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE);
     if (!astroRecipe) {
@@ -20,4 +17,8 @@
         return NULL;
     }
+
+    float ra0     = psMetadataLookupF32(NULL, recipe, "RA");        // Boresight RA (radians)
+    float dec0    = psMetadataLookupF32(NULL, recipe, "DEC");       // Boresight Dec (radians)
+    float scale   = psMetadataLookupF32(NULL, recipe, "PIXEL.SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel)
 
     // Size of FPA
@@ -44,27 +45,25 @@
     // convert the pmAstromObj sources to the storage format used by the CMF files
 
-    long oldSize = stars->n;
-    stars = psArrayRealloc (stars, refStars->n);
+    long oldSize = spots->n;
+    spots = psArrayRealloc (spots, oldSize + refStars->n);
 
     // Conversion loop
     for (long i = 0; i < refStars->n; i++) {
-        ppSimStar *star = ppSimStarAlloc ();
+        ppSimStar *spot = ppSimStarAlloc ();
 
         pmAstromObj *ref = refStars->data[i]; // Reference star
-        star->ra  = ref->sky->r; // RA of star
-        star->dec = ref->sky->d; // Dec of star
-        star->mag = ref->Mag;       // Magnitude of star
+        spot->ra  = ref->sky->r; // RA of star
+        spot->dec = ref->sky->d; // Dec of star
+        spot->mag = ref->Mag;       // Magnitude of star
 
         // Apply rotation, make FPA center of boresite
 	// convert the ra,dec to x,y using examples in psastro.
-        // star->x = cos(pa) * xi - sin(pa) * eta + x0fpa;
-        // star->y = sin(pa) * xi + cos(pa) * eta + y0fpa;
+        // spot->x = cos(pa) * xi - sin(pa) * eta + x0fpa;
+        // spot->y = sin(pa) * xi + cos(pa) * eta + y0fpa;
 
-        stars->data[oldSize + i] = star;
+        spots->data[oldSize + i] = star;
 
-        psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", star->x, star->y, star->flux);
+        psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", spot->x, spot->y, ref->Mag);
     }
-
-# endif
 
     // XXX these need to be saved on PSPHOT.INPUT.CMF
Index: /branches/eam_branch_20080511/ppSim/src/ppSimLoadStars.c
===================================================================
--- /branches/eam_branch_20080511/ppSim/src/ppSimLoadStars.c	(revision 17929)
+++ /branches/eam_branch_20080511/ppSim/src/ppSimLoadStars.c	(revision 17930)
@@ -18,5 +18,5 @@
     }
 
-    // XXX push these into the recipe in ppSimArguments()
+    // relevant metadata
     float zp      = psMetadataLookupF32(NULL, recipe, "ZEROPOINT"); // Photometric zero point
     float ra0     = psMetadataLookupF32(NULL, recipe, "RA");        // Boresight RA (radians)
Index: /branches/eam_branch_20080511/ppSim/src/ppSimLoop.c
===================================================================
--- /branches/eam_branch_20080511/ppSim/src/ppSimLoop.c	(revision 17929)
+++ /branches/eam_branch_20080511/ppSim/src/ppSimLoop.c	(revision 17930)
@@ -27,9 +27,10 @@
     int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y
 
+    psArray *spots = psArrayAllocEmpty (1);
     psArray *stars = psArrayAllocEmpty (1);
     psArray *galaxies = psArrayAllocEmpty (1);
     if (type == PPSIM_TYPE_OBJECT) {
 	// Load forced-photometry positions
-	if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
+	if (!ppSimLoadSpots (spots, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
 
 	// Load catalogue stars
