Index: /trunk/ppImage/src/ppImage.h
===================================================================
--- /trunk/ppImage/src/ppImage.h	(revision 21363)
+++ /trunk/ppImage/src/ppImage.h	(revision 21364)
@@ -25,5 +25,5 @@
     // actions which ppImage should perform
     bool doMaskBuild;                   // Build internal mask
-    bool doWeightBuild;                   // Build internal mask
+    bool doVarianceBuild;               // Build internal variance map
     bool doMask;                        // Mask bad pixels
     bool doNonLin;                      // Non-linearity correction
@@ -44,9 +44,9 @@
     bool BaseFITS;
     bool BaseMaskFITS;
-    bool BaseWeightFITS;
+    bool BaseVarianceFITS;
 
     bool ChipFITS;
     bool ChipMaskFITS;
-    bool ChipWeightFITS;
+    bool ChipVarianceFITS;
 
     bool FPA1FITS;
@@ -58,10 +58,10 @@
 
     // make values for abstract concepts of masking
-    psImageMaskType maskValue;               // apply this bit-mask to choose masked bits
-    psImageMaskType markValue;               // apply this bit-mask to choose masked bits
-    psImageMaskType satMask;                 // Mask value to give saturated pixels
-    psImageMaskType badMask;                 // Mask value to give bad pixels
-    psImageMaskType flatMask;                // Mask value to give bad flat pixels
-    psImageMaskType blankMask;               // Mask value to give blank pixels
+    psImageMaskType maskValue;          // apply this bit-mask to choose masked bits
+    psImageMaskType markValue;          // apply this bit-mask to choose masked bits
+    psImageMaskType satMask;            // Mask value to give saturated pixels
+    psImageMaskType badMask;            // Mask value to give bad pixels
+    psImageMaskType flatMask;           // Mask value to give bad flat pixels
+    psImageMaskType blankMask;          // Mask value to give blank pixels
 
     // non-linear correction parameters
Index: /trunk/ppImage/src/ppImageDetrendReadout.c
===================================================================
--- /trunk/ppImage/src/ppImageDetrendReadout.c	(revision 21363)
+++ /trunk/ppImage/src/ppImageDetrendReadout.c	(revision 21364)
@@ -59,7 +59,7 @@
 
     // Weight on the basis of pixel value needs to be done after the overscan has been subtracted
-    if (options->doWeightBuild) {
-        // create the target mask and weight images
-        pmReadoutGenerateWeight(input, true);
+    if (options->doVarianceBuild) {
+        // create the target mask and variance images
+        pmReadoutGenerateVariance(input, true);
     }
 
Index: /trunk/ppImage/src/ppImageFileCheck.c
===================================================================
--- /trunk/ppImage/src/ppImageFileCheck.c	(revision 21363)
+++ /trunk/ppImage/src/ppImageFileCheck.c	(revision 21364)
@@ -20,5 +20,5 @@
         if (fpa->hdu) {
             if (fpa->hdu->images) fprintf (stderr, "  (%d,%d) images\n", -1, -1);
-            if (fpa->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", -1, -1);
+            if (fpa->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", -1, -1);
             if (fpa->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", -1, -1);
             if (fpa->hdu->header) fprintf (stderr, "  (%d,%d) header\n", -1, -1);
@@ -30,5 +30,5 @@
             if (chip->hdu) {
                 if (chip->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, -1);
-                if (chip->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, -1);
+                if (chip->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", i, -1);
                 if (chip->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, -1);
                 if (chip->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, -1);
@@ -40,5 +40,5 @@
                 if (cell->hdu) {
                     if (cell->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, j);
-                    if (cell->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, j);
+                    if (cell->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", i, j);
                     if (cell->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, j);
                     if (cell->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, j);
@@ -50,5 +50,5 @@
                     if (readout) {
                         if (readout->image) fprintf (stderr, "  (%d,%d,%d) image\n", i, j, k);
-                        if (readout->weight) fprintf (stderr, "  (%d,%d,%d) weight\n", i, j, k);
+                        if (readout->variance) fprintf (stderr, "  (%d,%d,%d) variance\n", i, j, k);
                         if (readout->mask) fprintf (stderr, "  (%d,%d,%d) masks\n", i, j, k);
                     }
Index: /trunk/ppImage/src/ppImageOptions.c
===================================================================
--- /trunk/ppImage/src/ppImageOptions.c	(revision 21363)
+++ /trunk/ppImage/src/ppImageOptions.c	(revision 21364)
@@ -19,5 +19,5 @@
     // actions which ppImage should perform
     options->doMaskBuild     = false;   // Build internal mask
-    options->doWeightBuild   = false;   // Build internal weight
+    options->doVarianceBuild   = false;   // Build internal variance
     options->doMask          = false;   // Mask bad pixels
     options->doNonLin        = false;   // Non-linearity correction
@@ -37,9 +37,9 @@
     options->BaseFITS        = false;   // create output image
     options->BaseMaskFITS    = false;   // create output mask image
-    options->BaseWeightFITS  = false;   // create output weight image
+    options->BaseVarianceFITS  = false;   // create output variance 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->ChipVarianceFITS  = false;   // create output chip-mosaic variance image
 
     options->FPA1FITS        = false;   // create fpa-mosaic binned image (scale 1)
@@ -194,5 +194,5 @@
     // for these images, even if not required otherwise
     options->doMaskBuild = psMetadataLookupBool(NULL, recipe, "MASK.BUILD");
-    options->doWeightBuild = psMetadataLookupBool(NULL, recipe, "WEIGHT.BUILD");
+    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
 
     // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
@@ -236,9 +236,9 @@
     options->BaseFITS       = psMetadataLookupBool(NULL, recipe, "BASE.FITS");
     options->BaseMaskFITS   = psMetadataLookupBool(NULL, recipe, "BASE.MASK.FITS");
-    options->BaseWeightFITS = psMetadataLookupBool(NULL, recipe, "BASE.WEIGHT.FITS");
+    options->BaseVarianceFITS = psMetadataLookupBool(NULL, recipe, "BASE.VARIANCE.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->ChipVarianceFITS = psMetadataLookupBool(NULL, recipe, "CHIP.VARIANCE.FITS");
 
     options->FPA1FITS       = psMetadataLookupBool(NULL, recipe, "FPA1.FITS");
@@ -255,9 +255,9 @@
     options->doBG           = psMetadataLookupBool(NULL, recipe, "BACKGROUND");
 
-    // even if not requested explicitly, if any of these are set, build an internal mask and weight:
+    // even if not requested explicitly, if any of these are set, build an internal mask and variance:
     if (options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat ||
         options->doPhotom) {
         options->doMaskBuild = true;
-        options->doWeightBuild = true;
+        options->doVarianceBuild = true;
     } else if (options->doMask || options->doBG) {
         options->doMaskBuild = true;
Index: /trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- /trunk/ppImage/src/ppImageParseCamera.c	(revision 21363)
+++ /trunk/ppImage/src/ppImageParseCamera.c	(revision 21364)
@@ -20,6 +20,6 @@
     }
 
-    // if MASK or WEIGHT was supplied on command line, bind files to 'input'.
-    // the mask and weight will be mosaicked with the image
+    // if MASK or VARIANCE was supplied on command line, bind files to 'input'.
+    // the mask and variance will be mosaicked with the image
     pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "PPIMAGE.INPUT.MASK");
     if (!status) {
@@ -34,11 +34,11 @@
     }
 
-    pmFPAfile *inputWeight = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.WEIGHT", "PPIMAGE.INPUT.WEIGHT");
+    pmFPAfile *inputVariance = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.VARIANCE", "PPIMAGE.INPUT.VARIANCE");
     if (!status) {
         psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
         return NULL;
     }
-    if (inputWeight && inputWeight->type != PM_FPA_FILE_WEIGHT) {
-        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.WEIGHT is not of type WEIGHT");
+    if (inputVariance && inputVariance->type != PM_FPA_FILE_VARIANCE) {
+        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.VARIANCE is not of type VARIANCE");
         return NULL;
     }
@@ -195,12 +195,12 @@
         return NULL;
     }
-    pmFPAfile *outWeight = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.WEIGHT");
-    if (!outWeight) {
-        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT.WEIGHT"));
-        psFree(options);
-        return NULL;
-    }
-    if (outWeight->type != PM_FPA_FILE_WEIGHT) {
-        psError(PS_ERR_IO, true, "PPIMAGE.OUTPUT.WEIGHT is not of type WEIGHT");
+    pmFPAfile *outVariance = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.VARIANCE");
+    if (!outVariance) {
+        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT.VARIANCE"));
+        psFree(options);
+        return NULL;
+    }
+    if (outVariance->type != PM_FPA_FILE_VARIANCE) {
+        psError(PS_ERR_IO, true, "PPIMAGE.OUTPUT.VARIANCE is not of type VARIANCE");
         psFree(options);
         return NULL;
@@ -230,12 +230,12 @@
         return NULL;
     }
-    pmFPAfile *chipWeight = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.WEIGHT");
-    if (!chipWeight) {
-        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHIP.WEIGHT"));
-        psFree(options);
-        return NULL;
-    }
-    if (chipWeight->type != PM_FPA_FILE_WEIGHT) {
-        psError(PS_ERR_IO, true, "PPIMAGE.CHIP.WEIGHT is not of type WEIGHT");
+    pmFPAfile *chipVariance = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.VARIANCE");
+    if (!chipVariance) {
+        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHIP.VARIANCE"));
+        psFree(options);
+        return NULL;
+    }
+    if (chipVariance->type != PM_FPA_FILE_VARIANCE) {
+        psError(PS_ERR_IO, true, "PPIMAGE.CHIP.VARIANCE is not of type VARIANCE");
         psFree(options);
         return NULL;
@@ -315,9 +315,9 @@
     outImage->save   = options->BaseFITS;
     outMask->save    = options->BaseMaskFITS;
-    outWeight->save  = options->BaseWeightFITS;
+    outVariance->save  = options->BaseVarianceFITS;
 
     chipImage->save  = options->ChipFITS;
     chipMask->save   = options->ChipMaskFITS;
-    chipWeight->save = options->ChipWeightFITS;
+    chipVariance->save = options->ChipVarianceFITS;
 
     byFPA1->save     = options->FPA1FITS;
@@ -329,15 +329,15 @@
     outImage->fileLevel = PS_MIN (outImage->fileLevel, outImage->dataLevel);
 
-    // outMask and outWeight must be freed at the same level as outImage (all freed by pmFPAFreeData)
+    // outMask and outVariance must be freed at the same level as outImage (all freed by pmFPAFreeData)
     outMask->freeLevel   = outImage->freeLevel;
-    outWeight->freeLevel = outImage->freeLevel;
+    outVariance->freeLevel = outImage->freeLevel;
     outMask->dataLevel   = outImage->dataLevel;
-    outWeight->dataLevel = outImage->dataLevel;
+    outVariance->dataLevel = outImage->dataLevel;
 
     // Ditto for the chip-mosaicked version
     chipMask->freeLevel   = chipImage->freeLevel;
-    chipWeight->freeLevel = chipImage->freeLevel;
+    chipVariance->freeLevel = chipImage->freeLevel;
     chipMask->dataLevel   = chipImage->dataLevel;
-    chipWeight->dataLevel = chipImage->dataLevel;
+    chipVariance->dataLevel = chipImage->dataLevel;
 
     // the input data is the same as the outImage data : force the free levels to match
@@ -434,12 +434,12 @@
     }
 
-    // Turn off mask and weight output if we're not doing anything interesting
+    // Turn off mask and variance output if we're not doing anything interesting
     if (!options->doMaskBuild && outMask->save) {
         psWarning("output mask image (BASE.MASK.FITS) requested, but not generated: skipping.\n");
         outMask->save = false;
     }
-    if (!options->doWeightBuild && outWeight->save) {
-        psWarning("output weight image (BASE.WEIGHT.FITS) requested, but not generated: skipping.\n");
-        outWeight->save = false;
+    if (!options->doVarianceBuild && outVariance->save) {
+        psWarning("output variance image (BASE.VARIANCE.FITS) requested, but not generated: skipping.\n");
+        outVariance->save = false;
     }
     if (!options->doMaskBuild && chipMask->save) {
@@ -447,7 +447,7 @@
         chipMask->save = false;
     }
-    if (!options->doWeightBuild && chipWeight->save) {
-        psWarning("output weight image (CHIP.WEIGHT.FITS) requested, but not generated: skipping.\n");
-        chipWeight->save = false;
+    if (!options->doVarianceBuild && chipVariance->save) {
+        psWarning("output variance image (CHIP.VARIANCE.FITS) requested, but not generated: skipping.\n");
+        chipVariance->save = false;
     }
 
Index: /trunk/ppImage/src/ppImageSetMaskBits.c
===================================================================
--- /trunk/ppImage/src/ppImageSetMaskBits.c	(revision 21363)
+++ /trunk/ppImage/src/ppImageSetMaskBits.c	(revision 21364)
@@ -7,7 +7,7 @@
 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options) {
 
-    if (!pmConfigMaskSetBits (&options->maskValue, &options->markValue, config)) {
-	psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
-	return false;
+    if (!pmConfigMaskSetBits(&options->maskValue, &options->markValue, config)) {
+        psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
+        return false;
     }
 
@@ -15,9 +15,9 @@
 
     // mask for non-linear flat corrections
-    options->flatMask = pmConfigMaskGet("FLAT", config); 
+    options->flatMask = pmConfigMaskGet("FLAT", config);
     psAssert (options->flatMask, "flat mask not set");
 
     // mask for non-existent data  (default to DETECTOR if not defined)
-    options->blankMask = pmConfigMaskGet("BLANK", config); 
+    options->blankMask = pmConfigMaskGet("BLANK", config);
     psAssert (options->blankMask, "blank mask not set");
 
@@ -25,5 +25,5 @@
     options->satMask = pmConfigMaskGet("SAT", config);
     psAssert (options->satMask, "sat mask not set");
-    
+
     // mask for below-range data  (default to RANGE if not defined)
     options->badMask = pmConfigMaskGet("BAD", config);
@@ -38,6 +38,8 @@
 
     // set maskValue and markValue in the psphot recipe
-    psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->maskValue);
-    psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->markValue);
+    psMetadataAddImageMask(recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask",
+                           options->maskValue);
+    psMetadataAddImageMask(recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask",
+                           options->markValue);
 
     return true;
