Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStack.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStack.c	(revision 30776)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStack.c	(revision 30777)
@@ -3,6 +3,6 @@
 int main (int argc, char **argv) {
 
-    // XXX add memory dumps
-    psMemDumpSetState(true);
+    // uncomment to turn on memory dumps (move this to an option)
+    // psMemDumpSetState(true);
 
     psTimerStart ("complete");
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackChisqImage.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackChisqImage.c	(revision 30776)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackChisqImage.c	(revision 30777)
@@ -101,7 +101,9 @@
         for (int ix = 0; ix < inImage->numCols; ix++) {
 	    if (inMask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue;
-	    chiImage->data.F32[iy][ix] += PS_SQR(inImage->data.F32[iy][ix]) / inVariance->data.F32[iy][ix];
+	    // XXX TEST chiImage->data.F32[iy][ix] += PS_SQR(inImage->data.F32[iy][ix]) / inVariance->data.F32[iy][ix];
+	    chiImage->data.F32[iy][ix] = 0.0;
 	    chiVariance->data.F32[iy][ix] = 1.0; // ?? what is the right value?  just init to this?
-	    chiMask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 0x00; // we have valid data so unmask this pixel
+	    // XXX TEST chiMask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 0x00; // we have valid data so unmask this pixel
+	    chiMask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] = 0x01; // we have valid data so unmask this pixel
         }
     }
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackParseCamera.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackParseCamera.c	(revision 30776)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackParseCamera.c	(revision 30777)
@@ -172,4 +172,23 @@
     }
 
+    // select the appropriate recipe information
+    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
+    bool saveCnv = psMetadataLookupBool(&status, recipe, "SAVE.CNV");
+    bool saveChisq = psMetadataLookupBool(&status, recipe, "SAVE.CHISQ");
+
+    // loop over the available readouts
+    for (int i = 0; i < nInputs; i++) {
+	pmFPAfile *file = NULL;
+
+	file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.IMAGE", i);
+	file->save = saveCnv;
+
+	file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.MASK", i);
+	file->save = saveCnv;
+
+	file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.VARIANCE", i);
+	file->save = saveCnv;
+    }
+
     // generate an pmFPAimage for the chisqImage
     // XXX output of these files should be optional
@@ -180,5 +199,5 @@
 	    return false;
 	}
-	chisqImage->save = true;
+	chisqImage->save = saveChisq;
 
 	pmFPAfile *chisqMask = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.MASK");
@@ -191,5 +210,5 @@
 	    return NULL;
 	}
-	chisqMask->save = true;
+	chisqMask->save = saveChisq;
 
 	pmFPAfile *chisqVariance = pmFPAfileDefineOutput(config, chisqImage->fpa, "PSPHOT.CHISQ.VARIANCE");
@@ -202,5 +221,5 @@
 	    return NULL;
 	}
-	chisqVariance->save = true;
+	chisqVariance->save = saveChisq;
     }
 
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackReadout.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackReadout.c	(revision 30776)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackReadout.c	(revision 30777)
@@ -127,4 +127,6 @@
     }
 
+    psMemDump("sourcestats");
+
     // generate the objects (object unify the sources from the different images)
     // XXX this could just match the detections for the chisq image, and not bother measuring the
@@ -132,4 +134,6 @@
     psArray *objects = psphotMatchSources (config, view, STACK_SRC);
 
+    psMemDump("matchsources");
+
     if (!strcasecmp (breakPt, "TEST2")) {
 	psFree(objects);
@@ -143,4 +147,6 @@
         return psphotReadoutCleanup (config, view, STACK_SRC);
     }
+
+    psMemDump("sourcestats");
 
     // find blended neighbors of very saturated stars (detections->newSources)
