Index: /trunk/pswarp/src/pswarpArguments.c
===================================================================
--- /trunk/pswarp/src/pswarpArguments.c	(revision 15603)
+++ /trunk/pswarp/src/pswarpArguments.c	(revision 15604)
@@ -78,81 +78,90 @@
 }
 
-    // Parse the recipe and format into the arguments
+// Parse the recipe and format into the arguments
 bool pswarpOptions(pmConfig *config)
 {
-        // Select the appropriate recipe
-        psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
-        if (!recipe) {
-            psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE);
-            return false;
+    // Select the appropriate recipe
+    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
+    if (!recipe) {
+        psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE);
+        return false;
+    }
+
+    // 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;
+
+    // Get interpolation mode
+    psImageInterpolateMode interpolationMode; // Mode for interpolation
+    const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode
+    if (!name) {
+        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);
         }
+    }
 
-        // 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;
+    // Get mask parameters
+    psMaskType maskIn, maskPoor, maskBad; // Mask values for input, "poor" and "bad" pixels
 
-        // Get interpolation mode
-        psImageInterpolateMode interpolationMode; // Mode for interpolation
-        const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode
-        if (!name) {
-            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);
-            }
-        }
+    psString maskNames = psMetadataLookupStr(&status, recipe, "MASK.IN");
+    if (!status) {
+        maskIn = 0x00;
+        psWarning("MASK.IN is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskIn);
+    }
+    maskIn = pmConfigMask(maskNames, config); // Mask for input data
 
-        // Get mask parameters
-        psMaskType maskIn, maskPoor, maskBad; // Mask values for input, "poor" and "bad" pixels
+    maskNames = psMetadataLookupStr(&status, recipe, "MASK.POOR");
+    if (!status) {
+        maskPoor = 0x00;
+        psWarning("MASK.POOR is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskPoor);
+    }
+    maskPoor = pmConfigMask(maskNames, config); // Mask for "poor" warped data
 
-        psString maskNames = psMetadataLookupStr(&status, recipe, "MASK.IN");
-         if (!status) {
-            maskIn = 0x00;
-            psWarning("MASK.IN is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskIn);
-        }
-        maskIn = pmConfigMask(maskNames, config); // Mask for input data
+    maskNames = psMetadataLookupStr(&status, recipe, "MASK.BAD");
+    if (!status) {
+        maskBad = 0x00;
+        psWarning("MASK.BAD is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskBad);
+    }
+    maskBad = pmConfigMask(maskNames, config); // Mask for bad warped data
 
-        maskNames = psMetadataLookupStr(&status, recipe, "MASK.POOR");
-        if (!status) {
-            maskPoor = 0x00;
-            psWarning("MASK.POOR is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskPoor);
-        }
-        maskPoor = pmConfigMask(maskNames, config); // Mask for "poor" warped data
+    float poorFrac = psMetadataLookupF32(&status, recipe, "POOR.FRAC"); // Frac of bad flux for a "poor"
+    if (!status) {
+        poorFrac = 0.0;
+        psWarning("POOR.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
+    }
 
-        maskNames = psMetadataLookupStr(&status, recipe, "MASK.BAD");
-        if (!status) {
-            maskBad = 0x00;
-            psWarning("MASK.BAD is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskBad);
-        }
-        maskBad = pmConfigMask(maskNames, config); // Mask for bad warped data
+    float acceptFrac = psMetadataLookupF32(&status, recipe, "ACCEPT.FRAC"); // Min fraction of good pixels
+    if (!status) {
+        acceptFrac = 0.0;
+        psWarning("ACCEPT.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
+    }
 
-        float poorFrac = psMetadataLookupF32(&status, recipe, "POOR.FRAC"); // Frac of bad flux for a "poor"
-        if (!status) {
-            poorFrac = 0.0;
-            psWarning("POOR.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
-        }
+    // Set recipe values in the arguments
+    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0,
+                     "Iso-astrom grid spacing in x", nGridX);
+    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0,
+                     "Iso-astrom grid spacing in y", nGridY);
+    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0,
+                     "Interpolation mode", interpolationMode);
+    psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.IN", 0,
+                    "Mask for input data", maskIn);
+    psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.POOR", 0,
+                    "Mask for poor warped data", maskPoor);
+    psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.BAD", 0,
+                    "Mask for bad warped data", maskBad);
+    psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
+                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
+    psMetadataAddF32(config->arguments, PS_LIST_TAIL, "ACCEPT.FRAC", 0,
+                     "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,
-                         "Iso-astrom grid spacing in x", nGridX);
-        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0,
-                         "Iso-astrom grid spacing in y", nGridY);
-        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0,
-                         "Interpolation mode", interpolationMode);
-        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.IN", 0,
-                         "Mask for input data", maskIn);
-        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.POOR", 0,
-                         "Mask for poor warped data", maskPoor);
-        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.BAD", 0,
-                         "Mask for bad warped data", maskBad);
-        psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
-                         "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
     psTrace("pswarp", 1, "Done with pswarpArguments...\n");
     return (config);
