Index: trunk/ppSub/src/ppSubLoop.c
===================================================================
--- trunk/ppSub/src/ppSubLoop.c	(revision 28121)
+++ trunk/ppSub/src/ppSubLoop.c	(revision 29003)
@@ -17,6 +17,16 @@
 #include <pslib.h>
 #include <psmodules.h>
+#include <psphot.h>
 
 #include "ppSub.h"
+
+bool dumpout(pmConfig *config, char *name) 
+{
+  pmFPAview *view = ppSubViewReadout(); // View to readout
+  pmReadout *out = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");
+  psphotSaveImage (NULL, out->image, name);
+  return true;
+}
+
 
 bool ppSubLoop(ppSubData *data)
@@ -105,4 +115,5 @@
         return false;
     }
+    // dumpout(config, "diff.1.fits");
 
     // Close convolved files
@@ -111,4 +122,5 @@
         return false;
     }
+    // dumpout(config, "diff.2a.fits");
 
     // Higher order background subtraction using psphot
@@ -117,4 +129,5 @@
         return false;
     }
+    // dumpout(config, "diff.2b.fits");
 
     // Perform Variance correction (rescale within a modest range)
@@ -123,4 +136,5 @@
         return false;
     }
+    // dumpout(config, "diff.2c.fits");
 
     if (data->quality) {
@@ -138,4 +152,5 @@
         return false;
     }
+    // dumpout(config, "diff.3.fits");
 
     if (!ppSubFilesIterateUp(config, PPSUB_FILES_PHOT_SUB)) {
@@ -157,4 +172,5 @@
       }
     }
+    // dumpout(config, "diff.4.fits");
     
     // generate the binned image used to write the jpeg
@@ -204,4 +220,5 @@
     } else {
         // Close subtraction files
+	// dumpout(config, "diff.5.fits");
         if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) {
             psError(PPSUB_ERR_IO, false, "Unable to close subtraction files.");
