Index: trunk/pswarp/src/pswarpTransformReadout.c
===================================================================
--- trunk/pswarp/src/pswarpTransformReadout.c	(revision 21323)
+++ trunk/pswarp/src/pswarpTransformReadout.c	(revision 21368)
@@ -6,6 +6,6 @@
  *
  *  @author IfA
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-02-05 20:44:04 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 03:10:36 $
  *  Copyright 2009 Institute for Astronomy, University of Hawaii
  */
@@ -41,5 +41,9 @@
     psAssert(mdok, "MASK.INPUT was not defined");
 
-    int nThreads = psMetadataLookupS32(&mdok, config->arguments, "NTHREADS"); ///< Number of threads
+    if (!input->covariance) {
+        input->covariance = psImageCovarianceNone();
+    }
+
+    int nThreads = psMetadataLookupS32(&mdok, config->arguments, "NTHREADS"); // Number of threads
     if (!mdok) {
         nThreads = 0;
@@ -85,11 +89,11 @@
     // Interpolation options : move these from the arguments to explicit assignments
     psImageInterpolation *interp = psImageInterpolationAlloc(interpolationMode, input->image,
-                                                             input->weight, input->mask, maskIn,
+                                                             input->variance, input->mask, maskIn,
                                                              NAN, NAN, maskBad, maskPoor, poorFrac,
                                                              numKernels);
 
-    if (input->weight && !output->weight) {
-        output->weight = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
-        psImageInit(output->weight, NAN);
+    if (input->variance && !output->variance) {
+        output->variance = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
+        psImageInit(output->variance, NAN);
     }
     if ((input->mask || maskPoor || maskBad) && !output->mask) {
@@ -135,5 +139,12 @@
     psThreadJob *job = NULL;
     int xMin = output->image->numCols, xMax = 0, yMin = output->image->numRows, yMax = 0; // Bounds
-    int goodPixels = 0;                 ///< total number of good pixels across all tiles
+    int goodPixels = 0;                 // total number of good pixels across all tiles
+    psList *covariances = psMetadataLookupPtr(&mdok, output->analysis,
+                                              PSWARP_ANALYSIS_COVARIANCES); // Collection of covar. matrices
+    if (!covariances) {
+        covariances = psListAlloc(NULL);
+        psMetadataAddList(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_COVARIANCES, 0,
+                          "Collection of covariance matrices", covariances);
+    }
     while ((job = psThreadJobGetDone()) != NULL) {
         if (job->args->n < 1) {
@@ -147,4 +158,7 @@
             yMin = PS_MIN(args->yMin, yMin);
             yMax = PS_MAX(args->yMax, yMax);
+            if (args->covariance) {
+                psListAdd(covariances, PS_LIST_TAIL, args->covariance);
+            }
         }
         psFree(job);
