Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 21002)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 21017)
@@ -16,5 +16,5 @@
 #define FAINT_SOURCE_FRAC 1.0e-4         // Set minimum flux to this fraction of faintest source flux
 
-//#define TESTING                         // Enable debugging output
+#define TESTING                         // Enable debugging output
 
 #ifdef TESTING
@@ -310,4 +310,30 @@
 #endif
 
+
+#if 0
+            // Testing the normalisation of the fake image
+            {
+                pmReadout *test = pmReadoutAlloc(NULL); // Test readout
+                psArray *sources = psArrayAlloc(1);     // Array of sources
+                pmSource *source = pmSourceAlloc();     // Source
+                sources->data[0] = source;
+                source->peak = pmPeakAlloc(50, 50, 10000, PM_PEAK_LONE);
+                source->psfMag = -13.0;
+                pmReadoutFakeFromSources(test, 100, 100, sources, NULL, NULL, psf, 0.1, 0, false, true);
+                float sum = 0.0;
+                for (int y = 0; y < test->image->numRows; y++) {
+                    for (int x = 0; x < test->image->numCols; x++) {
+                        sum += test->image->data.F32[y][x];
+                    }
+                }
+                fprintf(stderr, "Photometry: %f --> %f = -13.0 ???\n", sum, -2.5*log10(sum));
+
+                psFits *fits = psFitsOpen("testphot.fits", "w");
+                psFitsWriteImage(fits, NULL, test->image, 0, NULL);
+                psFitsClose(fits);
+                exit(0);
+            }
+#endif
+
             pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
 
@@ -316,5 +342,5 @@
 
             if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows,
-                                          stampSources, NULL, NULL, psf, minFlux, 0, false, false)) {
+                                          stampSources, NULL, NULL, psf, minFlux, 0, false, true)) {
                 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake image with target PSF.");
                 psFree(fake);
