Index: trunk/ppMerge/src/ppMergeArguments.c
===================================================================
--- trunk/ppMerge/src/ppMergeArguments.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeArguments.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -25,6 +25,6 @@
             "\tIMAGE(STR):     Image filename\n"
             "\tMASK(STR):      Mask filename\n"
-            "\tWEIGHT(STR)     Weight map filename\n"
-            "where MASK and WEIGHT are optional.",
+            "\tVARIANCE(STR)   Variance map filename\n"
+            "where MASK and VARIANCE are optional.",
             program);
     fprintf(stderr, "\n");
@@ -155,5 +155,5 @@
     psMetadataAddF32(arguments, PS_LIST_TAIL, "-frachigh", 0, "Fraction of low pixels to discard", NAN);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-nkeep",    0, "Minimum number of pixels in stack to keep", 0);
-    psMetadataAddBool(arguments, PS_LIST_TAIL, "-weights", 0, "Use image weights in combination?", false);
+    psMetadataAddBool(arguments, PS_LIST_TAIL, "-variances", 0, "Use image variances in combination?", false);
 
     // XXX EAM : not clear this should be allowed on the command line.
@@ -300,5 +300,5 @@
     VALUE_ARG_RECIPE_FLOAT("-frachigh", "FRACHIGH", F32);
     VALUE_ARG_RECIPE_INT("-nkeep",      "NKEEP",    S32, 0);
-    VALUE_ARG_RECIPE_BOOL("-weights",   "WEIGHTS");
+    VALUE_ARG_RECIPE_BOOL("-variances", "VARIANCES");
 
     // XXX we do not supply this on the command line
Index: trunk/ppMerge/src/ppMergeCamera.c
===================================================================
--- trunk/ppMerge/src/ppMergeCamera.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeCamera.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -96,5 +96,5 @@
 {
     bool haveMasks = false;             // Do we have masks?
-    bool haveWeights = false;           // Do we have weight maps?
+    bool haveVariances = false;           // Do we have variance maps?
 
     ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame
@@ -121,6 +121,6 @@
 
         bool mdok;
-        psString mask = psMetadataLookupStr(&mdok, input, "MASK"); ///< Name of mask
-        psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); ///< Name of weight map
+        psString mask = psMetadataLookupStr(&mdok, input, "MASK"); // Name of mask
+        psString variance = psMetadataLookupStr(&mdok, input, "VARIANCE"); // Name of variance map
 
         // Add the image file
@@ -164,25 +164,26 @@
         }
 
-        // Optionally add the weight file
-        if (weight && strlen(weight) > 0) {
-            haveWeights = true;
-            psArray *weightFiles = psArrayAlloc(1); ///< Array of filenames for this FPA
-            weightFiles->data[0] = psMemIncrRefCounter(weight);
-            psMetadataAddArray(config->arguments, PS_LIST_TAIL, "WEIGHT.FILENAMES", PS_META_REPLACE,
-                               "Filenames of weight files", weightFiles);
-            psFree(weightFiles);
+        // Optionally add the variance file
+        if (variance && strlen(variance) > 0) {
+            haveVariances = true;
+            psArray *varianceFiles = psArrayAlloc(1); // Array of filenames for this FPA
+            varianceFiles->data[0] = psMemIncrRefCounter(variance);
+            psMetadataAddArray(config->arguments, PS_LIST_TAIL, "VARIANCE.FILENAMES", PS_META_REPLACE,
+                               "Filenames of variance files", varianceFiles);
+            psFree(varianceFiles);
 
             bool status;
-            pmFPAfile *weightFile = pmFPAfileBindFromArgs(&status, imageFile, config, "PPMERGE.INPUT.WEIGHT",
-                                                          "WEIGHT.FILENAMES");
+            pmFPAfile *varianceFile = pmFPAfileBindFromArgs(&status, imageFile, config,
+                                                            "PPMERGE.INPUT.VARIANCE", "VARIANCE.FILENAMES");
             if (!status) {
-                psError(PS_ERR_UNKNOWN, false, "Unable to define file from weight %d (%s)", numFiles, weight);
-                return false;
-            }
-            if (weightFile->type != PM_FPA_FILE_WEIGHT) {
-                psError(PS_ERR_IO, true, "PPMERGE.INPUT.WEIGHT is not of type WEIGHT");
-                return false;
-            }
-            haveWeights = true;
+                psError(PS_ERR_UNKNOWN, false, "Unable to define file from variance %d (%s)",
+                        numFiles, variance);
+                return false;
+            }
+            if (varianceFile->type != PM_FPA_FILE_VARIANCE) {
+                psError(PS_ERR_IO, true, "PPMERGE.INPUT.VARIANCE is not of type VARIANCE");
+                return false;
+            }
+            haveVariances = true;
         }
 
@@ -194,6 +195,6 @@
         psMetadataRemoveKey(config->arguments, "MASK.FILENAMES");
     }
-    if (psMetadataLookup(config->arguments, "WEIGHT.FILENAMES")) {
-        psMetadataRemoveKey(config->arguments, "WEIGHT.FILENAMES");
+    if (psMetadataLookup(config->arguments, "VARIANCE.FILENAMES")) {
+        psMetadataRemoveKey(config->arguments, "VARIANCE.FILENAMES");
     }
     if (psMetadataLookup(config->arguments, "PSF.FILENAMES")) {
@@ -203,6 +204,6 @@
     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INPUTS.NUM", 0, "Number of input files", numFiles);
     psMetadataAddBool(config->arguments, PS_LIST_TAIL, "INPUTS.MASKS", 0, "Got input masks?", haveMasks);
-    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "INPUTS.WEIGHTS", 0,
-                      "Got input weights?", haveWeights);
+    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "INPUTS.VARIANCES", 0,
+                      "Got input variances?", haveVariances);
 
 
Index: trunk/ppMerge/src/ppMergeFiles.c
===================================================================
--- trunk/ppMerge/src/ppMergeFiles.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeFiles.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -13,9 +13,9 @@
 #include "ppMerge.h"
 
-const char *allFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT",
+const char *allFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.VARIANCE",
                            "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA",
-                           NULL };      ///< All files
-const char *inputFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT",
-                             NULL };    ///< Input files
+                           NULL };      // All files
+const char *inputFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.VARIANCE",
+                             NULL };    // Input files
 const char *outputFiles[] = { "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA",
                               NULL };   ///< Output files
@@ -51,8 +51,8 @@
         }
     }
-    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS")) {
-        pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.WEIGHT", num);
-        if (!pmReadoutReadChunkWeight(readout, file->fits, 0, rows, 0, config)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to read readout weight.");
+    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES")) {
+        pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.VARIANCE", num);
+        if (!pmReadoutReadChunkVariance(readout, file->fits, 0, rows, 0, config)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to read readout variance.");
             return false;
         }
@@ -91,9 +91,10 @@
         psFree(fileView);
     }
-    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS")) {
-        pmFPAfile *weight = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.WEIGHT", num); // Weight file
-        pmFPAview *fileView = pmFPAviewForLevel(weight->fileLevel, view);
-        if (!pmFPAfileOpen(weight, fileView, config)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to open weight file %d", num);
+    if (psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES")) {
+        pmFPAfile *variance = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.VARIANCE",
+                                                    num); // Variance file
+        pmFPAview *fileView = pmFPAviewForLevel(variance->fileLevel, view);
+        if (!pmFPAfileOpen(variance, fileView, config)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to open variance file %d", num);
             psFree(fileView);
             return false;
@@ -127,5 +128,5 @@
     bool mdok;                          // Status of MD lookup
     bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS"); // Got weights?
+    bool haveVariances = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES"); // Got variances?
 
     const char **fileList = selectFiles(files); // Files to activate
@@ -134,5 +135,5 @@
             continue;
         }
-        if (!haveWeights && strcmp(fileList[i], "PPMERGE.INPUT.WEIGHT") == 0) {
+        if (!haveVariances && strcmp(fileList[i], "PPMERGE.INPUT.VARIANCE") == 0) {
             continue;
         }
@@ -163,5 +164,5 @@
     bool mdok;                          // Status of MD lookup
     bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS"); // Got weights?
+    bool haveVariances = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES"); // Got variances?
 
     psList *list = psListAlloc(NULL);   // List of files
@@ -171,5 +172,5 @@
             continue;
         }
-        if (!haveWeights && strcmp(fileList[i], "PPMERGE.INPUT.WEIGHT") == 0) {
+        if (!haveVariances && strcmp(fileList[i], "PPMERGE.INPUT.VARIANCE") == 0) {
             continue;
         }
Index: trunk/ppMerge/src/ppMergeLoop_Threaded.c
===================================================================
--- trunk/ppMerge/src/ppMergeLoop_Threaded.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeLoop_Threaded.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -36,13 +36,13 @@
     bool mdok;                          ///< Status of MD lookup
     bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); ///< Do we have weights?
-
-    psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); ///< Input images
-    psArray *masks = NULL, *weights = NULL; ///< Input masks and weights
+    bool haveVariances = psMetadataLookupBool(&mdok, arguments, "INPUTS.VARIANCES"); // Do we have variances?
+
+    psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images
+    psArray *masks = NULL, *variances = NULL; // Input masks and variances
     if (haveMasks) {
         masks = ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK", PM_FPA_LEVEL_READOUT);
     }
-    if (haveWeights) {
-        weights = ppMergeFileDataLevel(config, "PPMERGE.INPUT.WEIGHT", PM_FPA_LEVEL_READOUT);
+    if (haveVariances) {
+        variances = ppMergeFileDataLevel(config, "PPMERGE.INPUT.VARIANCE", PM_FPA_LEVEL_READOUT);
     }
 
@@ -50,23 +50,22 @@
     if (!mdok) nThreads = 0;
 
-    /** General combination parameters */
-    int iter = psMetadataLookupS32(NULL, arguments, "ITER"); ///< Number of rejection iterations
-    float rej = psMetadataLookupF32(NULL, arguments, "REJ"); ///< Rejection level
-    float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); ///< Reject fraction of low pixels
-    float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); ///< Reject fraction of hi pixels
-    int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); ///< Minimum number of values to keep
-    psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); ///< Combination statistic
-    bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); ///< Use weights?
-
-    /** Fringe parameters */
-    int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); ///< Number of fringe points
-    int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); ///< Size of fringe regions
-    int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); ///< Smoothing regions in x
-    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); ///< Smoothing regions in y
+    // General combination parameters
+    int iter = psMetadataLookupS32(NULL, arguments, "ITER"); // Number of rejection iterations
+    float rej = psMetadataLookupF32(NULL, arguments, "REJ"); // Rejection level
+    float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); // Reject fraction of low pixels
+    float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels
+    int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep
+    psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic
+    bool useVariances = psMetadataLookupBool(NULL, arguments, "VARIANCES"); // Use variances?
+
+    // Fringe parameters
+    int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); // Number of fringe points
+    int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); // Size of fringe regions
+    int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x
+    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
 
     // set the mask and mark bit values based on the named masks
-    psImageMaskType maskVal;
-    psImageMaskType markVal;
-    if (!pmConfigMaskSetBits (&maskVal, &markVal, config)) {
+    psImageMaskType maskVal, markVal;
+    if (!pmConfigMaskSetBits(&maskVal, &markVal, config)) {
         psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
         return false;
@@ -81,5 +80,5 @@
     combination->iter = iter;
     combination->rej = rej;
-    combination->weights = useWeights;
+    combination->variances = useVariances;
 
     psMetadata *stats = NULL;           ///< Statistics for output
@@ -344,11 +343,11 @@
                 psFree(countsRO);
 
-		// XXX EAM 2009.01.18 : sigmaCell and countsCell need to have their concepts copied from outCell.
-		// This was causing segfaults for VYSOS5; Why did this ever work for SIMTEST?
-		if (!pmConceptsCopyCell(countsCell, outCell)) {
-		    psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
-		    psFree(outRO);
-		    goto ERROR;
-		}
+                // XXX EAM 2009.01.18 : sigmaCell and countsCell need to have their concepts copied from outCell.
+                // This was causing segfaults for VYSOS5; Why did this ever work for SIMTEST?
+                if (!pmConceptsCopyCell(countsCell, outCell)) {
+                    psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
+                    psFree(outRO);
+                    goto ERROR;
+                }
 
                 pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA");
@@ -360,9 +359,9 @@
                 psFree(sigmaRO);
 
-		if (!pmConceptsCopyCell(sigmaCell, outCell)) {
-		    psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
-		    psFree(outRO);
-		    goto ERROR;
-		}
+                if (!pmConceptsCopyCell(sigmaCell, outCell)) {
+                    psError(PS_ERR_UNKNOWN, false, "Unable to copy cell concepts.");
+                    psFree(outRO);
+                    goto ERROR;
+                }
             }
 
@@ -447,5 +446,5 @@
     psFree(inputs);
     psFree(masks);
-    psFree(weights);
+    psFree(variances);
     psFree(stats);
     return true;
@@ -456,5 +455,5 @@
     psFree(inputs);
     psFree(masks);
-    psFree(weights);
+    psFree(variances);
     psFree(stats);
     return false;
Index: trunk/ppMerge/src/ppMergeMask.c
===================================================================
--- trunk/ppMerge/src/ppMergeMask.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeMask.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -38,9 +38,8 @@
     float smoothScale = psMetadataLookupF32(&mdok, config->arguments, "MASK.SMOOTH.SCALE"); ///< Radius to grow mask
 
-    psImageMaskType markVal;
-    psImageMaskType maskValRaw;
-    if (!pmConfigMaskSetBits (&maskValRaw, &markVal, config)) {
-	psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
-	return false;
+    psImageMaskType markVal, maskValRaw;
+    if (!pmConfigMaskSetBits(&maskValRaw, &markVal, config)) {
+        psError(PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
+        return false;
     }
 
@@ -48,23 +47,23 @@
     psImageMaskType maskValOut = pmConfigMaskGet (maskOutName, config);
     if (!maskValOut) {
-	psError (PS_ERR_UNKNOWN, true, "Undefined output mask bit value");
-	return false;
-    }
-    
-    psStats *statistics = psStatsAlloc(meanStat | stdevStat); ///< Statistics for background
+        psError (PS_ERR_UNKNOWN, true, "Undefined output mask bit value");
+        return false;
+    }
+
+    psStats *statistics = psStatsAlloc(meanStat | stdevStat); // Statistics for background
 
     psString outName = ppMergeOutputFile(config); ///< Name of output file
     pmChip *outChip = pmFPAfileThisChip(config->files, view, outName); ///< Output chip
     psFree(outName);
-    
+
     int numCells = 1;
     if (chipStats) {
-	// count the number of active cells for this chip:
-	numCells = 0;
-	for (int i = 0; i < outChip->cells->n; i++) {
-	    pmCell *cell = outChip->cells->data[i];
-	    if (!cell->process) continue;
-	    numCells ++;
-	}
+        // count the number of active cells for this chip:
+        numCells = 0;
+        for (int i = 0; i < outChip->cells->n; i++) {
+            pmCell *cell = outChip->cells->data[i];
+            if (!cell->process) continue;
+            numCells ++;
+        }
     }
 
@@ -85,7 +84,7 @@
         while ((inCell = pmFPAviewNextCell(inView, inFPA, 1))) {
 
-	    // the output FPA structure carries the information about which cells to process
-            pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); ///< Output cell
-	    if (!outCell->process) continue;
+            // the output FPA structure carries the information about which cells to process
+            pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); // Output cell
+            if (!outCell->process) continue;
 
             pmHDU *hdu = pmHDUFromCell(inCell); ///< HDU for cell
@@ -150,6 +149,6 @@
                 int y = pixel / numCols;
                 if (mask && (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValRaw)) continue;
-		if (outMask && (outMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValOut)) continue;
-		if (!isfinite(image->data.F32[y][x])) continue;
+                if (outMask && (outMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValOut)) continue;
+                if (!isfinite(image->data.F32[y][x])) continue;
 
                 values->data.F32[valueIndex++] = image->data.F32[y][x];
@@ -165,9 +164,9 @@
                 }
 
-		float mean = psStatsGetValue(statistics, meanStat);
-		float stdev = psStatsGetValue(statistics, stdevStat);
-
-		// this function increments the count for each suspect pixel in each input plane
-		// maskValRaw is used to test for valid input pixels
+                float mean = psStatsGetValue(statistics, meanStat);
+                float stdev = psStatsGetValue(statistics, stdevStat);
+
+                // this function increments the count for each suspect pixel in each input plane
+                // maskValRaw is used to test for valid input pixels
                 if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) {
                     psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
@@ -197,8 +196,7 @@
             inView->cell = -1;
             while ((inCell = pmFPAviewNextCell(inView, inFPA, 1))) {
-
-		// the output FPA structure carries the information about which cells to process
-		pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); ///< Output cell
-		if (!outCell->process) continue;
+                // the output FPA structure carries the information about which cells to process
+                pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); // Output cell
+                if (!outCell->process) continue;
 
                 pmHDU *hdu = pmHDUFromCell(inCell); ///< HDU for cell
@@ -210,8 +208,8 @@
                 pmReadout *outRO = pmFPAfileThisReadout(config->files, inView, "PPMERGE.OUTPUT.MASK");
 
-		float mean = psStatsGetValue(statistics, meanStat);
-		float stdev = psStatsGetValue(statistics, stdevStat);
-
-		if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) {
+                float mean = psStatsGetValue(statistics, meanStat);
+                float stdev = psStatsGetValue(statistics, stdevStat);
+
+                if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) {
                     psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
                     goto MERGE_MASK_ERROR;
@@ -243,6 +241,6 @@
     while ((outCell = pmFPAviewNextCell(outView, outFPA, 1))) {
 
-	// skip inactive cells
-	if (!outCell->process) continue;
+        // skip inactive cells
+        if (!outCell->process) continue;
 
         pmHDU *hdu = pmHDUFromCell(outCell); ///< HDU for cell
@@ -254,12 +252,12 @@
         pmReadout *outRO = outCell->readouts->data[0]; ///< Output readout
 
-	if (smoothSuspect) {
-	    // XXX test output of suspect pixel image
-	    psImage *suspects = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT); ///< Suspect img
-	    assert (suspects);
-	    psImageSmooth (suspects, smoothScale, 3); ///< extend smoothing region to 3-sigma
-	}
-
-	// set the bad pixels to the value 'maskVal'
+        if (smoothSuspect) {
+            // XXX test output of suspect pixel image
+            psImage *suspects = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT); // Suspect img
+            assert (suspects);
+            psImageSmooth (suspects, smoothScale, 3); // extend smoothing region to 3-sigma
+        }
+
+        // set the bad pixels to the value 'maskVal'
         if (!pmMaskIdentifyBadPixels(outRO, maskValOut, maskBad, maskMode)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to mask bad pixels");
@@ -352,9 +350,9 @@
     assert(config);
 
-    bool mdok;                          ///< Status of MD lookup
-    int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); ///< Number of inputs
-    bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); ///< Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS"); ///< Do we have weights?
-    int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); ///< Number of rejection iterations
+    bool mdok;                          // Status of MD lookup
+    int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs
+    bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?
+    bool haveVariances = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.VARIANCES"); // Got variances?
+    int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); // Number of rejection iterations
 
     PS_ASSERT_INT_POSITIVE(iter, false);
@@ -375,7 +373,7 @@
         psFree(masks);
     }
-    if (haveWeights) {
-        psArray *weights = ppMergeFileDataLevel(config, "PPMERGE.INPUT.WEIGHT", PM_FPA_LEVEL_READOUT);
-        psFree(weights);
+    if (haveVariances) {
+        psArray *variances = ppMergeFileDataLevel(config, "PPMERGE.INPUT.VARIANCE", PM_FPA_LEVEL_READOUT);
+        psFree(variances);
     }
 
@@ -417,21 +415,21 @@
         }
 
-	if (outChip->data_exists) {
-	    psList *inChips = psListAlloc(NULL);
-	    for (int i=0; i < numFiles; i++) {
-		pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< Input file
-		pmChip *chip = pmFPAviewThisChip(view, file->fpa);
-		psListAdd(inChips, PS_LIST_TAIL, chip);
-	    }
-
-	    // XXX I need to call pmConfigMaskWriteHeader for the PHU somewhere, after it is created!
-
-	    if (!pmConceptsAverageChips(outChip, inChips, true)) {
-		psError(PS_ERR_UNKNOWN, false, "Unable to average Chip concepts.");
-		psFree(inChips);
-		goto PPMERGE_MASK_ERROR;
-	    }
-	    psFree(inChips);
-	}
+        if (outChip->data_exists) {
+            psList *inChips = psListAlloc(NULL);
+            for (int i=0; i < numFiles; i++) {
+                pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // Input file
+                pmChip *chip = pmFPAviewThisChip(view, file->fpa);
+                psListAdd(inChips, PS_LIST_TAIL, chip);
+            }
+
+            // XXX I need to call pmConfigMaskWriteHeader for the PHU somewhere, after it is created!
+
+            if (!pmConceptsAverageChips(outChip, inChips, true)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to average Chip concepts.");
+                psFree(inChips);
+                goto PPMERGE_MASK_ERROR;
+            }
+            psFree(inChips);
+        }
         if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
             goto PPMERGE_MASK_ERROR;
Index: trunk/ppMerge/src/ppMergeReadChunk.c
===================================================================
--- trunk/ppMerge/src/ppMergeReadChunk.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeReadChunk.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-01 21:43:05 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -20,7 +20,8 @@
 
     bool mdok;
-    bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); ///< Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS");///< Do we have weights?
-    int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); ///< Number of rows to read per chunk
+    bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?
+    bool haveVariances = psMetadataLookupBool(&mdok, config->arguments,
+                                              "INPUTS.VARIANCES");// Do we have variances?
+    int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); // Number of rows to read per chunk
 
     // select an available fileGroup
@@ -52,5 +53,5 @@
                 // override the recorded last scan
                 inRO->thisImageScan  = fileGroup->firstScan;
-                inRO->thisWeightScan = fileGroup->firstScan;
+                inRO->thisVarianceScan = fileGroup->firstScan;
                 inRO->thisMaskScan   = fileGroup->firstScan;
                 inRO->forceScan      = true;
@@ -81,9 +82,10 @@
                 }
 
-                if (haveWeights && pmReadoutMoreWeight(inRO, file->fits, 0, rows, config)) {
+                if (haveVariances && pmReadoutMoreVariance(inRO, file->fits, 0, rows, config)) {
                     keepReading = true;
-                    pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.WEIGHT", i);
-                    if (!pmReadoutReadChunkWeight(inRO, file->fits, 0, rows, 0, config)) {
-                        psError(PS_ERR_IO, false, "Unable to read chunk %d for file PPMERGE.INPUT.WEIGHT %d",
+                    pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT.VARIANCE", i);
+                    if (!pmReadoutReadChunkVariance(inRO, file->fits, 0, rows, 0, config)) {
+                        psError(PS_ERR_IO, false,
+                                "Unable to read chunk %d for file PPMERGE.INPUT.VARIANCE %d",
                                 numChunk, i);
                         *status = false;
Index: trunk/ppMerge/src/ppMergeScaleZero.c
===================================================================
--- trunk/ppMerge/src/ppMergeScaleZero.c	(revision 21265)
+++ trunk/ppMerge/src/ppMergeScaleZero.c	(revision 21365)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-02 20:26:26 $
+ *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:44:31 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -56,9 +56,9 @@
     for (int i = 0; i < numInputs; i++) {
         pmFPAfileActivate(config->files, false, NULL);
-        psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); ///< Activated files
-        pmFPAfile *input = files->data[0]; ///< Representative file; should be the image (not mask or weight)
-        pmFPA *fpa = input->fpa;        ///< FPA of interest
-        view = pmFPAviewAlloc(0);       ///< View to component of interest
-        int cellNum = 0;                ///< Index for cell
+        psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); // Activated files
+        pmFPAfile *input = files->data[0]; // Representative file; should be the image (not mask or variance)
+        pmFPA *fpa = input->fpa;        // FPA of interest
+        view = pmFPAviewAlloc(0);       // View to component of interest
+        int cellNum = 0;                // Index for cell
         if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
             goto ERROR;
