Index: trunk/psModules/src/imcombine/pmReadoutCombine.c
===================================================================
--- trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 21183)
+++ trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 21363)
@@ -37,5 +37,5 @@
     params->iter = 1;
     params->rej = INFINITY;
-    params->weights = false;
+    params->variances = false;
 
     return params;
@@ -75,5 +75,5 @@
     psStringAppend(&comment, "Combining using statistic: %x", params->combine);
     if (!hdu->header) {
-	hdu->header = psMetadataAlloc();
+        hdu->header = psMetadataAlloc();
     }
     psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
@@ -82,14 +82,14 @@
     // note the clipping parameters, if used
     if (params->combine == PS_STAT_CLIPPED_MEAN) {
-	psString comment = NULL;    // Comment to add to header
-	psStringAppend(&comment, "Combination clipping: %d iterations, rejection at %f sigma", params->iter, params->rej);
-	psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
-	psFree(comment);
-    }
-
-    // note the use of weights
-    if (params->weights) {
+        psString comment = NULL;    // Comment to add to header
+        psStringAppend(&comment, "Combination clipping: %d iterations, rejection at %f sigma", params->iter, params->rej);
+        psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
+        psFree(comment);
+    }
+
+    // note the use of variances
+    if (params->variances) {
         psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK,
-                         "Using input weights to combine images", "");
+                         "Using input variances to combine images", "");
     }
 
@@ -121,5 +121,5 @@
 
     // generate the required output images based on the specified sizes
-    pmReadoutStackDefineOutput(output, col0, row0, numCols, numRows, true, params->weights, params->blank);
+    pmReadoutStackDefineOutput(output, col0, row0, numCols, numRows, true, params->variances, params->blank);
     psTrace("psModules.imcombine", 7, "Output minimum: %d,%d\n", output->col0, output->row0);
 
@@ -177,7 +177,7 @@
             return false;
         }
-        if (params->weights && !readout->weight) {
+        if (params->variances && !readout->variance) {
             psError(PS_ERR_UNEXPECTED_NULL, true,
-                    "Rejection based on weights requested, but no weights supplied for image %d.\n", i);
+                    "Rejection based on variances requested, but no variances supplied for image %d.\n", i);
             return false;
         }
@@ -190,10 +190,12 @@
     }
 
-    // pthread_t id = pthread_self();
-    // char name[64];
-    // sprintf (name, "%x", (unsigned int) id);
-    // psTimerStart (name);
-
-    psStatsOptions combineStdev = 0; // Statistics option for weights
+#if 0
+    pthread_t id = pthread_self();
+    char name[64];
+    sprintf(name, "%x", (unsigned int)id);
+    psTimerStart(name);
+#endif
+
+    psStatsOptions combineStdev = 0; // Statistics option for variances
     switch (params->combine) {
       case PS_STAT_SAMPLE_MEAN:
@@ -250,10 +252,10 @@
     psVectorMaskType *maskData = mask->data.PS_TYPE_VECTOR_MASK_DATA;     // Dereference mask
 
-    psVector *weights = NULL;           // Stack of weights
-    psVector *errors = NULL;            // Stack of errors (sqrt of variance/weights), for psVectorStats
-    psF32 *weightsData = NULL;          // Dereference weights
-    if (params->weights) {
-        weights = psVectorAlloc(inputs->n, PS_TYPE_F32); // Stack of weights
-        weightsData = weights->data.F32;
+    psVector *variances = NULL;           // Stack of variances
+    psVector *errors = NULL;            // Stack of errors (sqrt of variance), for psVectorStats
+    psF32 *variancesData = NULL;          // Dereference variances
+    if (params->variances) {
+        variances = psVectorAlloc(inputs->n, PS_TYPE_F32); // Stack of variances
+        variancesData = variances->data.F32;
     }
     psVector *index = NULL;             // The indices to sort the pixels
@@ -279,7 +281,7 @@
     psF32 **outputImage  = output->image->data.F32; // Output image
     psImageMaskType **outputMask   = output->mask->data.PS_TYPE_IMAGE_MASK_DATA; // Output mask
-    psF32 **outputWeight = NULL; // Output weight map
-    if (output->weight) {
-        outputWeight = output->weight->data.F32;
+    psF32 **outputVariance = NULL; // Output variance map
+    if (output->variance) {
+        outputVariance = output->variance->data.F32;
     }
 
@@ -323,6 +325,6 @@
                 }
 
-                if (params->weights) {
-                    weightsData[r] = readout->weight->data.F32[yIn][xIn];
+                if (params->variances) {
+                    variancesData[r] = readout->variance->data.F32[yIn][xIn];
                 }
 
@@ -332,6 +334,6 @@
                 if (scale) {
                     pixelsData[r] *= invScale->data.F32[r];
-                    if (params->weights) {
-                        weightsData[r] *= invScale->data.F32[r] * invScale->data.F32[r];
+                    if (params->variances) {
+                        variancesData[r] *= invScale->data.F32[r] * invScale->data.F32[r];
                     }
                 }
@@ -376,6 +378,6 @@
 
             // XXXXX this step probably is very expensive : convert errors to variance everywhere?
-            if (params->weights) {
-                errors = (psVector*)psUnaryOp(errors, weights, "sqrt");
+            if (params->variances) {
+                errors = (psVector*)psUnaryOp(errors, variances, "sqrt");
             }
 
@@ -386,6 +388,6 @@
                 outputImage[yOut][xOut] = NAN;
                 outputMask[yOut][xOut] = params->blank;
-                if (params->weights) {
-                    outputWeight[yOut][xOut] = NAN;
+                if (params->variances) {
+                    outputVariance[yOut][xOut] = NAN;
                 }
                 sigma->data.F32[yOut][xOut] = NAN;
@@ -393,7 +395,7 @@
                 outputImage[yOut][xOut] = psStatsGetValue(stats, params->combine);
                 outputMask[yOut][xOut] = isfinite(outputImage[yOut][xOut]) ? 0 : params->blank;
-                if (params->weights) {
+                if (params->variances) {
                     float stdev = psStatsGetValue(stats, combineStdev);
-                    outputWeight[yOut][xOut] = PS_SQR(stdev); // Variance
+                    outputVariance[yOut][xOut] = PS_SQR(stdev); // Variance
                     // XXXX this is not the correct formal error.
                     // also, the weighted mean is not obviously the correct thing here
@@ -412,5 +414,5 @@
     psFree(pixels);
     psFree(mask);
-    psFree(weights);
+    psFree(variances);
     psFree(errors);
     psFree(stats);
