Index: trunk/psModules/src/camera/pmHDUGenerate.c
===================================================================
--- trunk/psModules/src/camera/pmHDUGenerate.c	(revision 18227)
+++ trunk/psModules/src/camera/pmHDUGenerate.c	(revision 21363)
@@ -274,5 +274,5 @@
         pmReadout *readout = cell->readouts->data[0]; // The first readout, as representative
         // The proper image, used to get the size
-        psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout->weight);
+        psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout->variance);
         if (!image) {
             continue;
@@ -283,8 +283,8 @@
                      image->numCols, image->numRows, readout->mask->numCols, readout->mask->numRows);
         }
-        if (readout->weight &&
-                (readout->weight->numCols != image->numCols || readout->weight->numRows != image->numRows)) {
-            psWarning("Image and weight have different sizes (%dx%d vs %dx%d)!\n",
-                     image->numCols, image->numRows, readout->weight->numCols, readout->weight->numRows);
+        if (readout->variance &&
+                (readout->variance->numCols != image->numCols || readout->variance->numRows != image->numRows)) {
+            psWarning("Image and variance have different sizes (%dx%d vs %dx%d)!\n",
+                     image->numCols, image->numRows, readout->variance->numCols, readout->variance->numRows);
         }
         // New reference
@@ -355,5 +355,5 @@
     psElemType imageType = 0;           // Type of readout images
     psElemType maskType = 0;            // Type of readout masks
-    psElemType weightType = 0;          // Type of readout weights
+    psElemType varianceType = 0;        // Type of readout variances
     {
         psListIterator *iter = psListIteratorAlloc(cells, PS_LIST_HEAD, false); // Iterator for cells
@@ -381,6 +381,6 @@
                     maskType = checkTypes(maskType, readout->mask->type.type);
                 }
-                if (!hdu->weights && readout->weight) {
-                    weightType = checkTypes(weightType, readout->weight->type.type);
+                if (!hdu->variances && readout->variance) {
+                    varianceType = checkTypes(varianceType, readout->variance->type.type);
                 }
             }
@@ -388,5 +388,5 @@
         psFree(iter);
     }
-    if (numReadouts == 0 || (imageType == 0 && maskType == 0 && weightType == 0)) {
+    if (numReadouts == 0 || (imageType == 0 && maskType == 0 && varianceType == 0)) {
         // Nothing from which to create an HDU
         psFree(cells);
@@ -421,10 +421,10 @@
         }
     }
-    if (weightType) {
-        hdu->weights = psArrayAlloc(numReadouts);
+    if (varianceType) {
+        hdu->variances = psArrayAlloc(numReadouts);
         for (int i = 0; i < numReadouts; i++) {
-            psImage *weight = psImageAlloc(xSize, ySize, weightType);
-            psImageInit(weight, 0.0);
-            hdu->weights->data[i] = weight;
+            psImage *variance = psImageAlloc(xSize, ySize, varianceType);
+            psImageInit(variance, 0.0);
+            hdu->variances->data[i] = variance;
         }
     }
@@ -448,7 +448,8 @@
 
             psArray *readouts = cell->readouts; // Array of readouts
+
             psArray *hduImages = hdu->images; // Array of images in the HDU
             psArray *hduMasks = hdu->masks; // Array of masks in the HDU
-            psArray *hduWeights = hdu->weights; // Array of weights in the HDU
+            psArray *hduVariances = hdu->variances; // Array of variances in the HDU
             for (int i = 0; i < readouts->n; i++) {
                 pmReadout *readout = readouts->data[i]; // The readout of interest
@@ -467,8 +468,8 @@
                     readout->mask = new;
                 }
-                if (readout->weight) {
-                    psImage *new = pasteImage(hduWeights->data[i], readout->weight, trimsec);
-                    psFree(readout->weight);
-                    readout->weight = new;
+                if (readout->variance) {
+                    psImage *new = pasteImage(hduVariances->data[i], readout->variance, trimsec);
+                    psFree(readout->variance);
+                    readout->variance = new;
                 }
 
@@ -504,5 +505,5 @@
 
 // Return the level that an extension applies to
-static pmFPALevel extensionLevel(pmHDU *hdu // HDU to check
+static pmFPALevel extensionLevel(const pmHDU *hdu // HDU to check
                                 )
 {
@@ -512,5 +513,5 @@
     }
     bool mdok = true;                   // Status of MD lookup
-    psMetadata *file = psMetadataLookupMetadata(&mdok, hdu->format, "FILE"); // File information for camera format
+    psMetadata *file = psMetadataLookupMetadata(&mdok, hdu->format, "FILE"); // File info for camera format
     if (!mdok || !file) {
         psError(PS_ERR_UNEXPECTED_NULL, true, "Can't file FILE information for camera format "
@@ -581,5 +582,5 @@
         return false;
     }
-    if (hdu->images && hdu->masks && hdu->weights) {
+    if (hdu->images && hdu->masks && hdu->variances) {
         // It's already here!
         return true;
@@ -631,5 +632,5 @@
         return generateForCells(chip);
     }
-    if (hdu->images && hdu->masks && hdu->weights) {
+    if (hdu->images && hdu->masks && hdu->variances) {
         // It's already here!
         return true;
@@ -680,5 +681,5 @@
         return generateForChips(fpa);
     }
-    if (hdu->images && hdu->masks && hdu->weights) {
+    if (hdu->images && hdu->masks && hdu->variances) {
         // It's already here!
         return true;
