Index: trunk/ppImage/src/ppImageOptions.c
===================================================================
--- trunk/ppImage/src/ppImageOptions.c	(revision 13970)
+++ trunk/ppImage/src/ppImageOptions.c	(revision 14209)
@@ -17,46 +17,40 @@
     psMemSetDeallocator(options, (psFreeFunc)imageOptionsFree);
 
-    // Initialise options
-    options->nonLinearData = NULL;
-    options->nonLinearSource = NULL;
+    // actions which ppImage should perform
+    options->doMask          = false;	// Mask bad pixels
+    options->doNonLin        = false;	// Non-linearity correction
+    options->doOverscan      = false;	// Overscan subtraction
+    options->doBias          = false;	// Bias subtraction
+    options->doDark          = false;	// Dark subtraction
+    options->doShutter       = false;	// Shutter correction
+    options->doFlat          = false;	// Flat-field normalisation
+    options->doFringe        = false;	// Fringe subtraction
+    options->doPhotom        = false;	// Source identification and photometry
+    options->doAstromChip    = false;	// Astrometry (per-chip)
+    options->doAstromMosaic  = false;	// Astrometry (full-mosaic)
+    options->doStats         = false;	// Measure and save image statistics
+
+    // output files requested
+    options->BaseFITS        = false;	// create output image
+    options->BaseMaskFITS    = false;	// create output mask image
+    options->BaseWeightFITS  = false;	// create output weight image
+
+    options->ChipFITS        = false;	// create output chip-mosaic image
+    options->ChipMaskFITS    = false;	// create output chip-mosaic mask image
+    options->ChipWeightFITS  = false;	// create output chip-mosaic weight image
+
+    options->FPA1FITS        = false;	// create fpa-mosaic binned image (scale 1)
+    options->FPA2FITS        = false;	// create fpa-mosaic binned image (scale 2)
+    options->Bin1FITS        = false;	// create binned image (scale 1)
+    options->Bin2FITS        = false;	// create binned image (scale 2)
+    options->Bin1JPEG        = false;	// create jpeg of binned image (scale 1)
+    options->Bin2JPEG        = false;	// create jpeg of binned image (scale 2)
 
     // default flags for various activities
-    options->doMask     = false;        // Mask bad pixels
-    options->maskValue  = 0x00;         // Default mask value
-    options->satMask    = 0x00;         // Saturated pixels
-    options->badMask    = 0x00;         // Bad pixels
-    options->flatMask   = 0x00;         // Bad flat pixels
-    options->blankMask  = 0x00;         // Blank (no data, cell gap) pixels
-
-    options->doNonLin   = false;        // Non-linearity correction
-    options->doBias     = false;        // Bias subtraction
-    options->doDark     = false;        // Dark subtraction
-    options->doOverscan = false;        // Overscan subtraction
-    options->doShutter  = false;        // Shutter correction
-    options->doFlat     = false;        // Flat-field normalisation
-    options->doFringe   = false;        // Fringe subtraction
-    options->doPhotom   = false;        // Source identification and photometry
-    options->doAstromChip = false;      // Astrometry
-    options->doAstromMosaic = false;    // Astrometry
-
-    options->doStats    = false;        // Measure and save image statistics
-
-    options->BaseFITS   = false;        // create binned image (scale 1)
-    options->ChipFITS   = false;        // create binned image (scale 1)
-    options->FPA1FITS   = false;        // create binned image (scale 1)
-    options->FPA2FITS   = false;        // create binned image (scale 1)
-
-    options->Bin1FITS   = false;        // create binned image (scale 1)
-    options->Bin2FITS   = false;        // create binned image (scale 2)
-    options->Bin1JPEG   = false;        // create jpeg of binned image (scale 1)
-    options->Bin2JPEG   = false;        // create jpeg of binned image (scale 2)
-
-    // Overscan defaults
-    options->overscan   = NULL;      // Overscan options
-
-    // Fringe defaults
-    options->fringeRej = NAN;
-    options->fringeIter = 0;
-    options->fringeKeep = 1.0;
+    options->maskValue       = 0x00;	// Default mask value
+    options->satMask         = 0x00;	// Saturated pixels
+    options->badMask         = 0x00;	// Bad pixels
+    options->flatMask        = 0x00;	// Bad flat pixels
+    options->blankMask       = 0x00;	// Blank (no data, cell gap) pixels
 
     // Non-linearity default options
@@ -64,4 +58,18 @@
     options->nonLinearData   = NULL;    // The non-linearity data
     options->nonLinearSource = NULL;    // If the non-linearity data is a menu, this provides the key
+
+    // Overscan defaults
+    options->overscan        = NULL;	// Overscan options
+
+    // binning parameters
+    options->xBin1 	     = 16;	// x-binning, scale 1
+    options->yBin1 	     = 16;	// y-binning, scale 1
+    options->xBin2 	     = 16;	// x-binning, scale 2
+    options->yBin2 	     = 16;	// y-binning, scale 2
+
+    // Fringe defaults
+    options->fringeRej       = NAN;	// Fringe rejection limit
+    options->fringeIter      = 0;	// Fringe iterations
+    options->fringeKeep      = 1.0;	// Fringe keep fraction
 
     return options;
@@ -199,5 +207,4 @@
     if (!status) {
         psWarning("BIN1.XBIN not found in recipe: setting to default value.\n");
-        options->xBin1 = 16;
     }
     options->yBin1 = psMetadataLookupS32(&status, recipe, "BIN1.YBIN");
@@ -218,25 +225,26 @@
     }
 
-    options->BaseFITS = psMetadataLookupBool(NULL, recipe, "BASE.FITS");
-    options->ChipFITS = psMetadataLookupBool(NULL, recipe, "CHIP.FITS");
-    options->FPA1FITS = psMetadataLookupBool(NULL, recipe, "FPA1.FITS");
-    options->FPA2FITS = psMetadataLookupBool(NULL, recipe, "FPA2.FITS");
-
-    options->Bin1FITS = psMetadataLookupBool(NULL, recipe, "BIN1.FITS");
-    options->Bin1JPEG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
-    options->Bin2FITS = psMetadataLookupBool(NULL, recipe, "BIN2.FITS");
-    options->Bin2JPEG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
-
-    options->doPhotom = psMetadataLookupBool(NULL, recipe, "PHOTOM");
-    options->doAstromChip = psMetadataLookupBool(NULL, recipe, "ASTROM.CHIP");
+    options->BaseFITS       = psMetadataLookupBool(NULL, recipe, "BASE.FITS");
+    options->BaseMaskFITS   = psMetadataLookupBool(NULL, recipe, "BASE.MASK.FITS");
+    options->BaseWeightFITS = psMetadataLookupBool(NULL, recipe, "BASE.WEIGHT.FITS");
+
+    options->ChipFITS       = psMetadataLookupBool(NULL, recipe, "CHIP.FITS");
+    options->ChipMaskFITS   = psMetadataLookupBool(NULL, recipe, "CHIP.MASK.FITS");
+    options->ChipWeightFITS = psMetadataLookupBool(NULL, recipe, "CHIP.WEIGHT.FITS");
+
+    options->FPA1FITS 	    = psMetadataLookupBool(NULL, recipe, "FPA1.FITS");
+    options->FPA2FITS 	    = psMetadataLookupBool(NULL, recipe, "FPA2.FITS");
+
+    options->Bin1FITS 	    = psMetadataLookupBool(NULL, recipe, "BIN1.FITS");
+    options->Bin1JPEG 	    = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
+    options->Bin2FITS 	    = psMetadataLookupBool(NULL, recipe, "BIN2.FITS");
+    options->Bin2JPEG 	    = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
+
+    options->doPhotom       = psMetadataLookupBool(NULL, recipe, "PHOTOM");
+    options->doAstromChip   = psMetadataLookupBool(NULL, recipe, "ASTROM.CHIP");
     options->doAstromMosaic = psMetadataLookupBool(NULL, recipe, "ASTROM.MOSAIC");
+
     if ((options->doAstromChip || options->doAstromMosaic) && !options->doPhotom) {
         psLogMsg(__func__, PS_LOG_ERROR, "Invalid PPIMAGE options: cannot do ASTROMetry without PHOTOMetry");
-        exit(EXIT_FAILURE);
-    }
-
-    options->doAddstar = psMetadataLookupBool(NULL, recipe, "ADDSTAR");
-    if (options->doAddstar && !(options->doAstromChip || options->doAstromMosaic)) {
-        psLogMsg(__func__, PS_LOG_ERROR, "Invalid PPIMAGE options: cannot Addstar without Astrometry");
         exit(EXIT_FAILURE);
     }
