Index: trunk/psModules/test/camera/tap_pmFPAReadWrite.c
===================================================================
--- trunk/psModules/test/camera/tap_pmFPAReadWrite.c	(revision 21221)
+++ trunk/psModules/test/camera/tap_pmFPAReadWrite.c	(revision 21474)
@@ -56,5 +56,5 @@
     readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
     readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8);
-    readout->weight = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
+    readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
     for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) {
         psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
@@ -94,12 +94,12 @@
     cell->hdu->images = psArrayAlloc(NUM_HDUS);
     cell->hdu->masks = psArrayAlloc(NUM_HDUS);
-    cell->hdu->weights = psArrayAlloc(NUM_HDUS);
+    cell->hdu->variances = psArrayAlloc(NUM_HDUS);
     for (int k = 0 ; k < NUM_HDUS ; k++) {
         cell->hdu->images->data[k]  = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
         cell->hdu->masks->data[k]   = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_MASK);
-        cell->hdu->weights->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
+        cell->hdu->variances->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);
         psImageInit(cell->hdu->images->data[k], (float) (BASE_IMAGE+k));
         psImageInit(cell->hdu->masks->data[k], (psU8) (BASE_MASK+k));
-        psImageInit(cell->hdu->weights->data[k], (float) (BASE_WEIGHT+k));
+        psImageInit(cell->hdu->variances->data[k], (float) (BASE_WEIGHT+k));
     }
 
@@ -298,16 +298,16 @@
     // ----------------------------------------------------------------------
     // ----------------------------------------------------------------------
-    // pmCellWriteWeight(): tests
-    // Verify pmCellWriteWeight() with NULL pmCell arg
+    // pmCellWriteVariance(): tests
+    // Verify pmCellWriteVariance() with NULL pmCell arg
     {
         psMemId id = psMemGetId();
         psFits* fitsFileW = psFitsOpen(".tmp00", "w");
-        ok(!pmCellWriteWeight(NULL, fitsFileW, NULL, false), "pmCellWriteWeight() returned FALSE with NULL pmCell input");
-        psFitsClose(fitsFileW);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmCellWriteWeight() with NULL pmFits arg
+        ok(!pmCellWriteVariance(NULL, fitsFileW, NULL, false), "pmCellWriteVariance() returned FALSE with NULL pmCell input");
+        psFitsClose(fitsFileW);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmCellWriteVariance() with NULL pmFits arg
     {
         psMemId id = psMemGetId();
@@ -317,14 +317,14 @@
         pmCell *cell = chip->cells->data[0];
         ok(cell != NULL, "Allocated a pmCell successfully");
-        ok(!pmCellWriteWeight(cell, NULL, NULL, false), "pmCellWriteWeight() returned FALSE with NULL psFits param");
-        psFree(fpa);
-        psFree(camera);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmCellWriteWeight() with acceptable input params
-    // We first write a FITS file with the pmCellWriteWeight(), then we read it and verify.
-    // First call pmCellWriteWeight()
+        ok(!pmCellWriteVariance(cell, NULL, NULL, false), "pmCellWriteVariance() returned FALSE with NULL psFits param");
+        psFree(fpa);
+        psFree(camera);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmCellWriteVariance() with acceptable input params
+    // We first write a FITS file with the pmCellWriteVariance(), then we read it and verify.
+    // First call pmCellWriteVariance()
     {
         psMemId id = psMemGetId();
@@ -337,7 +337,7 @@
         ok(cell != NULL, "Allocated a pmCell successfully");
 
-        //  Use pmCellWriteWeight() to write weight data to the FITS file
-        bool rc = pmCellWriteWeight(cell, fitsFileW, NULL, false);
-        ok(rc, "pmCellWriteWeight() returned TRUE");
+        //  Use pmCellWriteVariance() to write weight data to the FITS file
+        bool rc = pmCellWriteVariance(cell, fitsFileW, NULL, false);
+        ok(rc, "pmCellWriteVariance() returned TRUE");
 
         //  Close the FITS file, free memory
@@ -350,16 +350,16 @@
 
     // ----------------------------------------------------------------------
-    // pmCellReadWeight() tests 
-    // Verify pmCellReadWeight() with NULL pmCell param
-    {
-        psMemId id = psMemGetId();
-        psFits* fitsFileR = psFitsOpen(".tmp00", "r");
-        ok(!pmCellReadWeight(NULL, fitsFileR, NULL), "pmCellReadWeight() returned FALSE with NULL pmCell param");
-        psFitsClose(fitsFileR);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmCellReadWeight() with NULL pmFits param
+    // pmCellReadVariance() tests 
+    // Verify pmCellReadVariance() with NULL pmCell param
+    {
+        psMemId id = psMemGetId();
+        psFits* fitsFileR = psFitsOpen(".tmp00", "r");
+        ok(!pmCellReadVariance(NULL, fitsFileR, NULL), "pmCellReadVariance() returned FALSE with NULL pmCell param");
+        psFitsClose(fitsFileR);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmCellReadVariance() with NULL pmFits param
     {
         psMemId id = psMemGetId();
@@ -368,12 +368,12 @@
         pmChip *chip = fpa->chips->data[0];
         pmCell *cell = chip->cells->data[0];
-        ok(!pmCellReadWeight(cell, NULL, NULL), "pmCellReadWeight() returned FALSE with NULL pmFits param");
-        psFree(fpa);
-        psFree(camera);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmCellReadWeight() with acceptable data (using the FITS file created above)
+        ok(!pmCellReadVariance(cell, NULL, NULL), "pmCellReadVariance() returned FALSE with NULL pmFits param");
+        psFree(fpa);
+        psFree(camera);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmCellReadVariance() with acceptable data (using the FITS file created above)
     {
         psMemId id = psMemGetId();
@@ -385,13 +385,13 @@
         pmCell *cell = chip->cells->data[0];
         // Free the existing cell hdu weight data (so we can verify that pmCellReadWeight() actually reads the data
-        psFree(cell->hdu->weights);
-        cell->hdu->weights = NULL;
-        psFits* fitsFileR = psFitsOpen(".tmp00", "r");
-
-        rc = pmCellReadWeight(cell, fitsFileR, NULL);
-        ok(rc, "pmCellReadWeight() returned TRUE");
-        for (int k = 0 ; k < cell->hdu->weights->n ; k++) {
+        psFree(cell->hdu->variances);
+        cell->hdu->variances = NULL;
+        psFits* fitsFileR = psFitsOpen(".tmp00", "r");
+
+        rc = pmCellReadVariance(cell, fitsFileR, NULL);
+        ok(rc, "pmCellReadVariance() returned TRUE");
+        for (int k = 0 ; k < cell->hdu->variances->n ; k++) {
             bool errorFlag = false;
-            psImage *msk = cell->hdu->weights->data[k];
+            psImage *msk = cell->hdu->variances->data[k];
             for (int i = 0 ; i < msk->numRows ; i++) {
                 for (int j = 0 ; j < msk->numCols ; j++) {
@@ -403,5 +403,5 @@
 		}
 	    }
-            ok(!errorFlag, "pmCellWriteWeight()/pmCellReadWeight() properly set the weight data (image %d)", k);
+            ok(!errorFlag, "pmCellWriteVariance()/pmCellReadVariance() properly set the weight data (image %d)", k);
         }
         psFitsClose(fitsFileR);
@@ -661,16 +661,16 @@
 
     // ----------------------------------------------------------------------
-    // pmChipWriteWeight() tests
-    // Verify pmChipWriteWeight() with NULL pmChip param
+    // pmChipWriteVariance() tests
+    // Verify pmChipWriteVariance() with NULL pmChip param
     {
         psMemId id = psMemGetId();
         psFits* fitsFileW = psFitsOpen(".tmp01", "w");
-        ok(!pmChipWriteWeight(NULL, fitsFileW, NULL, false, true), "pmChipWriteWeight() returned NULL with NULL pmChip param");
-        psFitsClose(fitsFileW);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmChipWriteWeight() with NULL pmFits param
+        ok(!pmChipWriteVariance(NULL, fitsFileW, NULL, false, true), "pmChipWriteVariance() returned NULL with NULL pmChip param");
+        psFitsClose(fitsFileW);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmChipWriteVariance() with NULL pmFits param
     {
         psMemId id = psMemGetId();
@@ -680,12 +680,12 @@
         pmChip *chip = fpa->chips->data[0];
         ok(chip != NULL, "Allocated a pmChip successfully");
-        ok(!pmChipWriteWeight(chip, NULL, NULL, false, true), "pmChipWriteWeight() returned NULL with NULL pmFits param");
-        psFree(fpa);
-        psFree(camera);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmChipWriteWeight() with acceptable data
+        ok(!pmChipWriteVariance(chip, NULL, NULL, false, true), "pmChipWriteVariance() returned NULL with NULL pmFits param");
+        psFree(fpa);
+        psFree(camera);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmChipWriteVariance() with acceptable data
     {
         psMemId id = psMemGetId();
@@ -697,7 +697,7 @@
         ok(chip != NULL, "Allocated a pmChip successfully");
 
-        //  Use pmChipWriteWeight() to write image data to the FITS file
-        bool rc = pmChipWriteWeight(chip, fitsFileW, NULL, false, true);
-        ok(rc, "pmChipWriteWeight() returned TRUE");
+        //  Use pmChipWriteVariance() to write image data to the FITS file
+        bool rc = pmChipWriteVariance(chip, fitsFileW, NULL, false, true);
+        ok(rc, "pmChipWriteVariance() returned TRUE");
 
         //  Close the FITS file, free memory
@@ -757,7 +757,7 @@
             if (VERBOSE) diag("Reading cell %d\n", chipID);
             pmCell *cell = (pmCell *) chip->cells->data[chipID];
-            for (int k = 0 ; k < cell->hdu->weights->n ; k++) {
+            for (int k = 0 ; k < cell->hdu->variances->n ; k++) {
                 if (VERBOSE) diag("NOTE: image %d\n", k);
-                psImage *wgt = cell->hdu->weights->data[k];
+                psImage *wgt = cell->hdu->variances->data[k];
                 for (int i = 0 ; i < wgt->numRows ; i++) {
                     for (int j = 0 ; j < wgt->numCols ; j++) {
@@ -770,5 +770,5 @@
 		}
 	    }
-            ok(!errorFlag, "pmChipWriteWeight()/pmChipReadWeight() properly set the weight data (cell %d)", chipID);
+            ok(!errorFlag, "pmChipWriteVariance()/pmChipReadVariance() properly set the variance data (cell %d)", chipID);
 	}
 
@@ -975,17 +975,17 @@
     // ----------------------------------------------------------------------
     // ----------------------------------------------------------------------
-    // pmFPAWriteWeight() tests
-    // pmFPAWriteWeight(pmFPA *fpa, psFits *fits, psDB *db, bool blank, bool recurse)
-    // Verify pmFPAWriteWeight() with NULL pmFPA param
+    // pmFPAWriteVariance() tests
+    // pmFPAWriteVariance(pmFPA *fpa, psFits *fits, psDB *db, bool blank, bool recurse)
+    // Verify pmFPAWriteVariance() with NULL pmFPA param
     {
         psMemId id = psMemGetId();
         psFits* fitsFileW = psFitsOpen(".tmp01", "w");
-        ok(!pmFPAWriteWeight(NULL, fitsFileW, NULL, false, true), "pmFPAWriteWeight() returned NULL with NULL pmFPA param");
-        psFitsClose(fitsFileW);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmFPAWriteWeight() with NULL pmFits param
+        ok(!pmFPAWriteVariance(NULL, fitsFileW, NULL, false, true), "pmFPAWriteVariance() returned NULL with NULL pmFPA param");
+        psFitsClose(fitsFileW);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmFPAWriteVariance() with NULL pmFits param
     {
         psMemId id = psMemGetId();
@@ -994,12 +994,12 @@
         pmFPA* fpa = generateSimpleFPA(camera);
         ok(fpa != NULL, "Allocated a pmFPA successfully");
-        ok(!pmFPAWriteWeight(fpa, NULL, NULL, false, true), "pmFPAWriteWeight() returned NULL with NULL pmFits param");
-        psFree(fpa);
-        psFree(camera);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmFPAWriteWeight() with acceptable data
+        ok(!pmFPAWriteVariance(fpa, NULL, NULL, false, true), "pmFPAWriteVariance() returned NULL with NULL pmFits param");
+        psFree(fpa);
+        psFree(camera);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmFPAWriteVariance() with acceptable data
     {
         psMemId id = psMemGetId();
@@ -1009,6 +1009,6 @@
         pmFPA* fpa = generateSimpleFPA(camera);
         ok(fpa != NULL, "Allocated a pmFPA successfully");
-        bool rc = pmFPAWriteWeight(fpa, fitsFileW, NULL, false, true);
-        ok(rc, "pmFPAWriteWeight() returned TRUE");
+        bool rc = pmFPAWriteVariance(fpa, fitsFileW, NULL, false, true);
+        ok(rc, "pmFPAWriteVariance() returned TRUE");
         //  Close the FITS file, free memory
         psFitsClose(fitsFileW);
@@ -1020,28 +1020,28 @@
 
     // ----------------------------------------------------------------------
-    // pmFPAReadWeight() tests
+    // pmFPAReadVariance() tests
     // Verify pmFPAReadWeight() with NULL pmFPA param
     {
         psMemId id = psMemGetId();
         psFits* fitsFileR = psFitsOpen(".tmp00", "r");
-        ok(!pmFPARead(NULL, fitsFileR, NULL), "pmFPAReadWeight() returned NULL with NULL pmFPA param");
-        psFitsClose(fitsFileR);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmFPAReadWeight() with NULL pmFits param
-    {
-        psMemId id = psMemGetId();
-        psMetadata *camera = psMetadataAlloc();
-        pmFPA* fpa = generateSimpleFPA(camera);
-        ok(!pmFPARead(fpa, NULL, NULL), "pmFPAReadWeight() returned NULL with NULL pmFits param");
-        psFree(fpa);
-        psFree(camera);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Verify pmFPAReadWeight() with acceptable input data
+        ok(!pmFPARead(NULL, fitsFileR, NULL), "pmFPAReadVariance() returned NULL with NULL pmFPA param");
+        psFitsClose(fitsFileR);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmFPAReadVariance() with NULL pmFits param
+    {
+        psMemId id = psMemGetId();
+        psMetadata *camera = psMetadataAlloc();
+        pmFPA* fpa = generateSimpleFPA(camera);
+        ok(!pmFPARead(fpa, NULL, NULL), "pmFPAReadVariance() returned NULL with NULL pmFits param");
+        psFree(fpa);
+        psFree(camera);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify pmFPAReadVariance() with acceptable input data
     {
         psMemId id = psMemGetId();
@@ -1051,5 +1051,5 @@
         pmFPA* fpa = generateSimpleFPA(camera);
         pmChip *chip = fpa->chips->data[0];
-        // Free the cells for chip 0 so we can verify that pmFPAReadWeight() actually reads the data from file
+        // Free the cells for chip 0 so we can verify that pmFPAReadVariance() actually reads the data from file
         if (0) {
             for (int chipID = 0 ; chipID < chip->cells->n ; chipID++) {
@@ -1062,5 +1062,5 @@
         psFits* fitsFileR = psFitsOpen(".tmp00", "r");
         rc = pmFPARead(fpa, fitsFileR, NULL);
-        ok(rc, "pmFPAReadWeight() returned TRUE");
+        ok(rc, "pmFPAReadVariance() returned TRUE");
         bool errorFlag = false;
         // XXX: fpaID should be chipID
@@ -1071,7 +1071,7 @@
                 if (VERBOSE) diag("Reading cell %d\n", chipID);
                 pmCell *cell = (pmCell *) chip->cells->data[chipID];
-                for (int k = 0 ; k < cell->hdu->weights->n ; k++) {
+                for (int k = 0 ; k < cell->hdu->variances->n ; k++) {
                     if (VERBOSE) diag("NOTE: image %d\n", k);
-                    psImage *wgt = cell->hdu->weights->data[k];
+                    psImage *wgt = cell->hdu->variances->data[k];
                     for (int i = 0 ; i < wgt->numRows ; i++) {
                         for (int j = 0 ; j < wgt->numCols ; j++) {
@@ -1084,5 +1084,5 @@
         		}
         	    }
-                ok(!errorFlag, "pmFPAWriteWeight()/pmFPAReadWeight() properly set the image data (chip %d, cell %d)", fpaID, chipID);
+                ok(!errorFlag, "pmFPAWriteVariance()/pmFPAReadVariance() properly set the image data (chip %d, cell %d)", fpaID, chipID);
     	    }
 	}
