Index: trunk/pswarp/src/pswarpArguments.c
===================================================================
--- trunk/pswarp/src/pswarpArguments.c	(revision 18839)
+++ trunk/pswarp/src/pswarpArguments.c	(revision 18924)
@@ -44,11 +44,11 @@
     if ((N = psArgumentGet(argc, argv, "-threads"))) {
         psArgumentRemove(N, &argc, argv);
-	int nThreads = atoi(argv[N]);
+        int nThreads = atoi(argv[N]);
         psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);
         psArgumentRemove(N, &argc, argv);
 
-	// create the thread pool with number of desired threads, supplying our thread launcher function
-	// XXX need to determine the number of threads from the config data
-	psThreadPoolInit (nThreads);
+        // create the thread pool with number of desired threads, supplying our thread launcher function
+        // XXX need to determine the number of threads from the config data
+        psThreadPoolInit (nThreads);
     }
     pswarpSetThreads ();
@@ -94,5 +94,5 @@
 {
     // Select the appropriate recipe
-    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
+    psMetadata *recipe  = psMetadataLookupPtr(NULL, config->recipes, PSWARP_RECIPE);
     if (!recipe) {
         psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE);
@@ -102,22 +102,27 @@
     // Get grid size
     bool status;                        // Status of MD lookup
-    int nGridX = psMetadataLookupS32 (&status, recipe, "GRID.NX");
-    if (!status) nGridX = 128;
-    int nGridY = psMetadataLookupS32 (&status, recipe, "GRID.NY");
-    if (!status) nGridY = 128;
+    int nGridX = psMetadataLookupS32(&status, recipe, "GRID.NX");
+    if (!status || nGridX <= 0) {
+        nGridX = 128;
+        psWarning("GRID.NX is not set in the recipe --- defaulting to %d", nGridX);
+    }
+    int nGridY = psMetadataLookupS32(&status, recipe, "GRID.NY");
+    if (!status) {
+        nGridY = 128;
+        psWarning("GRID.NY is not set in the recipe --- defaulting to %d", nGridY);
+    }
 
     // Get interpolation mode
-    psImageInterpolateMode interpolationMode; // Mode for interpolation
     const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode
     if (!name) {
+        name = "BILINEAR";
+        psLogMsg("pswarp", 3, "defaulting to %s interpolation", name);
+    }
+    psImageInterpolateMode interpolationMode = psImageInterpolateModeFromString(name); // Mode for interp.
+    if (interpolationMode == PS_INTERPOLATE_NONE) {
         interpolationMode = PS_INTERPOLATE_BILINEAR;
-        psLogMsg ("pswarp", 3, "defaulting to bilinear interpolation\n");
-    } else {
-        interpolationMode = psImageInterpolateModeFromString (name);
-        if (interpolationMode == PS_INTERPOLATE_NONE) {
-            interpolationMode = PS_INTERPOLATE_BILINEAR;
-            psLogMsg ("pswarp", 3,
-                      "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name);
-        }
+        psLogMsg ("pswarp", 3,
+                  "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name);
+        name = "BILINEAR";
     }
 
@@ -134,4 +139,16 @@
     }
 
+    // Set recipe values in the recipe (since we've possibly altered some)
+    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE,
+                     "Iso-astrom grid spacing in x", nGridX);
+    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE,
+                     "Iso-astrom grid spacing in y", nGridY);
+    psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE,
+                     "Interpolation mode", name);
+    psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
+                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
+    psMetadataAddF32(recipe, PS_LIST_TAIL, "ACCEPT.FRAC", PS_META_REPLACE,
+                     "Minimum fraction of good pixels for result to be accepted", acceptFrac);
+
     // Set recipe values in the arguments
     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0,
@@ -147,4 +164,17 @@
 
     psTrace("pswarp", 1, "Done with pswarpArguments...\n");
+
+    // Dump configuration, now that's it's settled
+    {
+        pmConfigCamerasCull(config);
+        pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS");
+
+        const char *outroot = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Output root name
+        psAssert(outroot, "Should be there, we put it there!");
+
+        pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file
+        pmConfigDump(config, input->fpa, outroot);
+    }
+
     return (config);
 }
