Index: /branches/eam_branches/20091201/ppImage/src/ppImageParseCamera.c
===================================================================
--- /branches/eam_branches/20091201/ppImage/src/ppImageParseCamera.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppImage/src/ppImageParseCamera.c	(revision 26543)
@@ -256,4 +256,7 @@
         PS_ASSERT (psphotInput, false);
 
+	// specify the number of psphot input images
+	psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
+	
         // define associated psphot input/output files
         if (!psphotDefineFiles (config, psphotInput)) {
Index: /branches/eam_branches/20091201/ppImage/src/ppImageReplaceBackground.c
===================================================================
--- /branches/eam_branches/20091201/ppImage/src/ppImageReplaceBackground.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppImage/src/ppImageReplaceBackground.c	(revision 26543)
@@ -80,5 +80,5 @@
     // the background model has not been defined, or at least not generated
     if (!modelFile || !modelRO) {
-        if (!psphotModelBackground(config, &roView, "PPIMAGE.CHIP")) {
+        if (!psphotModelBackgroundReadoutFileIndex(config, &roView, "PPIMAGE.CHIP", 0)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to model background");
             return false;
Index: /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadout.c
===================================================================
--- /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadout.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadout.c	(revision 26543)
@@ -39,5 +39,5 @@
 # if 0    
     // set the photcode for this image
-    if (!psphotAddPhotcode (recipe, config, view, "PPSIM.CHIP")) {
+    if (!psphotAddPhotcodeReadout (recipe, config, view, "PPSIM.CHIP", 0)) {
         psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
         return false;
@@ -74,5 +74,5 @@
 
     // Generate the mask and weight images, including the user-defined analysis region of interest
-    psphotSetMaskAndWeight (config, readout, recipe);
+    psphotSetMaskAndWeight (config, view, recipe);
 
     // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved in the recipe
@@ -85,8 +85,8 @@
 
     // generate a background model (median, smoothed image)
-    if (!psphotModelBackground (config, view, "PPSIM.CHIP")) {
+    if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
-    if (!psphotSubtractBackground (config, view, "PPSIM.CHIP")) {
+    if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
Index: /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutFake.c
===================================================================
--- /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutFake.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutFake.c	(revision 26543)
@@ -14,5 +14,5 @@
 # if 0
     // set the photcode for this image
-    if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
+    if (!psphotAddPhotcodeReadout (recipe, config, view, "PPSIM.FAKE.CHIP", 0)) {
         psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
         return false;
@@ -36,5 +36,5 @@
 
     // Generate the mask and variance images, including the user-defined analysis region of interest
-    psphotSetMaskAndVariance (config, readout, recipe);
+    psphotSetMaskAndVariance (config, view, recipe);
 
     // XXX need to define the source pixels
@@ -65,8 +65,8 @@
 
     // generate a background model (median, smoothed image)
-    if (!psphotModelBackground (config, view, "PPSIM.FAKE.CHIP")) {
+    if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.FAKE.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
-    if (!psphotSubtractBackground (config, view, "PPSIM.FAKE.CHIP")) {
+    if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.FAKE.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
Index: /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutForce.c
===================================================================
--- /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutForce.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppSim/src/ppSimPhotomReadoutForce.c	(revision 26543)
@@ -14,5 +14,5 @@
 # if 0
     // set the photcode for this image
-    if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
+    if (!psphotAddPhotcodeReadout (recipe, config, view, "PPSIM.FAKE.CHIP", 0)) {
         psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
         return false;
@@ -36,5 +36,5 @@
 
     // Generate the mask and variance images, including the user-defined analysis region of interest
-    psphotSetMaskAndVariance (config, readout, recipe);
+    psphotSetMaskAndVariance (config, view, recipe);
 
     // XXX need to define the source pixels
@@ -58,8 +58,8 @@
 
     // generate a background model (median, smoothed image)
-    if (!psphotModelBackground (config, view, "PPSIM.FORCE.CHIP")) {
+    if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.FORCE.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
-    if (!psphotSubtractBackground (config, view, "PPSIM.FORCE.CHIP")) {
+    if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.FORCE.CHIP", 0)) {
         return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);
     }
Index: /branches/eam_branches/20091201/ppStack/src/ppStackCamera.c
===================================================================
--- /branches/eam_branches/20091201/ppStack/src/ppStackCamera.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppStack/src/ppStackCamera.c	(revision 26543)
@@ -373,6 +373,6 @@
         psMetadataLookupBool(&mdok, config->arguments, "-photometry"); // perform photometry
     if (doPhotom) {
-        // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by
-        // psphotDefineFiles
+        // This pmFPAfile, PSPHOT.INPUT, is just used as a carrier; output files (eg,
+        // PSPHOT.RESID) are defined by psphotDefineFiles
         pmFPAfile *psphotInput = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
         if (!psphotInput) {
@@ -380,4 +380,6 @@
             return false;
         }
+	// specify the number of psphot input images
+	psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
 
         // Define associated psphot input/output files
Index: /branches/eam_branches/20091201/ppStack/src/ppStackMatch.c
===================================================================
--- /branches/eam_branches/20091201/ppStack/src/ppStackMatch.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppStack/src/ppStackMatch.c	(revision 26543)
@@ -144,5 +144,5 @@
     psMetadataAddU8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad);
 
-    psImage *binned = psphotBackgroundModel(ro, config); // Binned background model
+    psImage *binned = psphotModelBackgroundReadoutNoFile(ro, config); // Binned background model
     psImageBinning *binning = psMetadataLookupPtr(NULL, ro->analysis,
                                                   "PSPHOT.BACKGROUND.BINNING"); // Binning for model
Index: /branches/eam_branches/20091201/ppSub/src/ppSubBackground.c
===================================================================
--- /branches/eam_branches/20091201/ppSub/src/ppSubBackground.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppSub/src/ppSubBackground.c	(revision 26543)
@@ -42,5 +42,5 @@
     if (!modelRO) {
         // Create the background model
-        if (!psphotModelBackground(config, view, "PPSUB.OUTPUT")) {
+        if (!psphotModelBackgroundReadoutFileIndex(config, view, "PPSUB.OUTPUT", 0)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to model background");
             psFree(view);
Index: /branches/eam_branches/20091201/ppSub/src/ppSubCamera.c
===================================================================
--- /branches/eam_branches/20091201/ppSub/src/ppSubCamera.c	(revision 26542)
+++ /branches/eam_branches/20091201/ppSub/src/ppSubCamera.c	(revision 26543)
@@ -317,4 +317,6 @@
             return false;
         }
+	// specify the number of psphot input images
+	psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
         pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
 
Index: /branches/eam_branches/20091201/pswarp/src/pswarpParseCamera.c
===================================================================
--- /branches/eam_branches/20091201/pswarp/src/pswarpParseCamera.c	(revision 26542)
+++ /branches/eam_branches/20091201/pswarp/src/pswarpParseCamera.c	(revision 26543)
@@ -142,4 +142,6 @@
         }
         psphotInput->src = psMemIncrRefCounter(output->fpa);
+	// specify the number of psphot input images
+	psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
 
         pmFPAfile *psphotInSources = pmFPAfileDefineSkycell(config, output->fpa, "PSPHOT.INPUT.CMF");
