Index: trunk/psastro/src/psastroMosaicDistortion.c
===================================================================
--- trunk/psastro/src/psastroMosaicDistortion.c	(revision 19518)
+++ trunk/psastro/src/psastroMosaicDistortion.c	(revision 19519)
@@ -1,5 +1,6 @@
 # include "psastroInternal.h"
+# define DEBUG 0
 
-bool psastroMosaicDistortion (pmFPA *fpa, psMetadata *recipe) {
+bool psastroMosaicDistortion (pmFPA *fpa, psMetadata *recipe, int pass) {
 
     // fit a linear transformation from reference TP to observed FP coords
@@ -9,4 +10,6 @@
         return false;
     }
+
+    if (DEBUG && (pass == 0)) psastroDumpCorners ("corners.up.v1.dat", "corners.dn.v1.dat", fpa);
 
     // Correct the current reference star TP coordinates to the nearly-FP
@@ -21,4 +24,6 @@
     }
 
+    if (DEBUG && (pass == 0)) psastroDumpCorners ("corners.up.v2.dat", "corners.dn.v2.dat", fpa);
+
     if (!psastroMosaicDistortionFromGradients (fpa, recipe)) {
 	psError(PSASTRO_ERR_UNKNOWN, false, "failed to fit the distortion field\n");
@@ -26,4 +31,6 @@
         return false;
     }
+
+    if (DEBUG && (pass == 0)) psastroDumpCorners ("corners.up.v3.dat", "corners.dn.v3.dat", fpa);
 
     if (!psastroMosaicCorrectDistortion (fpa, TPtoFP)) {
@@ -33,4 +40,6 @@
     }
 	
+    if (DEBUG && (pass == 0)) psastroDumpCorners ("corners.up.v4.dat", "corners.dn.v4.dat", fpa);
+
     if (!psastroMosaicSetAstrom (fpa)) {
 	psError(PSASTRO_ERR_UNKNOWN, false, "failed to apply mosaic distortion terms\n");
@@ -39,4 +48,6 @@
     }
 
+    if (DEBUG && (pass == 0)) psastroDumpCorners ("corners.up.v5.dat", "corners.dn.v5.dat", fpa);
+
     psFree (TPtoFP);
     return true;
