Index: trunk/psModules/src/camera/pmFPAMaskWeight.c
===================================================================
--- trunk/psModules/src/camera/pmFPAMaskWeight.c	(revision 11216)
+++ trunk/psModules/src/camera/pmFPAMaskWeight.c	(revision 11225)
@@ -142,4 +142,7 @@
 }
 
+// XXX this function creates the mask pixels, or uses the existing mask
+// pixels.  currently, it will set mask bits if (value <= BAD) or (value >= SATURATION)
+// should we optionally ignore these tests?
 bool pmReadoutGenerateMask(pmReadout *readout)
 {
@@ -230,4 +233,6 @@
 }
 
+// this function creates the weight pixels, or uses the existing weight pixels.  it will set
+// the noise pixel values only if the weight image is not supplied
 bool pmReadoutGenerateWeight(pmReadout *readout, bool poisson)
 {
@@ -238,38 +243,39 @@
 
     // Create the weight image if required
-    if (!readout->weight) {
-        psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
-        if (!mdok || psRegionIsNaN(*trimsec)) {
-            psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set weight.\n");
-            return false;
-        }
-
-        pmHDU *hdu = pmHDUFromCell(cell);   // The HDU containing the cell's pixels
-        PS_ASSERT_PTR_NON_NULL(hdu, false);
-        if (!hdu->images && !pmHDUGenerateForCell(cell)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell.\n");
-            return false;
-        }
-
-        createParentWeights(hdu);
-
-        // Need to identify which readout we're working with....
-        long index = identifyReadout(hdu, readout); // Index of the readout
-        if (index == -1) {
-            psError(PS_ERR_UNKNOWN, true, "Unable to identify readout image in HDU.\n");
-            return false;
-        }
-
-        psImage *weight = psImageSubset(hdu->weights->data[index], *trimsec); // The weight pixels
-        if (!weight) {
-            psString trimsecString = psRegionToString(*trimsec);
-            psError(PS_ERR_UNKNOWN, false, "Unable to set weight from HDU with trimsec: %s.\n",
-                    trimsecString);
-            psFree(trimsecString);
-            return false;
-        }
-        psImageInit(weight, 0);
-        readout->weight = weight;
-    }
+    if (readout->weight)
+        return true;
+
+    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
+    if (!mdok || psRegionIsNaN(*trimsec)) {
+        psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set weight.\n");
+        return false;
+    }
+
+    pmHDU *hdu = pmHDUFromCell(cell);   // The HDU containing the cell's pixels
+    PS_ASSERT_PTR_NON_NULL(hdu, false);
+    if (!hdu->images && !pmHDUGenerateForCell(cell)) {
+        psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell.\n");
+        return false;
+    }
+
+    createParentWeights(hdu);
+
+    // Need to identify which readout we're working with....
+    long index = identifyReadout(hdu, readout); // Index of the readout
+    if (index == -1) {
+        psError(PS_ERR_UNKNOWN, true, "Unable to identify readout image in HDU.\n");
+        return false;
+    }
+
+    psImage *weight = psImageSubset(hdu->weights->data[index], *trimsec); // The weight pixels
+    if (!weight) {
+        psString trimsecString = psRegionToString(*trimsec);
+        psError(PS_ERR_UNKNOWN, false, "Unable to set weight from HDU with trimsec: %s.\n",
+                trimsecString);
+        psFree(trimsecString);
+        return false;
+    }
+    psImageInit(weight, 0);
+    readout->weight = weight;
 
     return pmReadoutSetWeight(readout, poisson);
