Index: trunk/ppStack/src/ppStackMatch.c
===================================================================
--- trunk/ppStack/src/ppStackMatch.c	(revision 21199)
+++ trunk/ppStack/src/ppStackMatch.c	(revision 21366)
@@ -16,4 +16,5 @@
                      PM_SOURCE_MODE_CR_LIMIT) // Mask to apply to input sources
 #define FAINT_SOURCE_FRAC 1.0e-4         // Set minimum flux to this fraction of faintest source flux
+#define COVAR_FRAC 0.01                 // Truncation fraction for covariance matrix
 
 //#define TESTING                         // Enable debugging output
@@ -233,24 +234,24 @@
         }
 
-        // Read image, mask, weight
+        // Read image, mask, variance
         const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for image
         const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for mask
-        const char *tempWeight = psMetadataLookupStr(NULL, recipe, "TEMP.WEIGHT"); // Suffix for weight map
-        psString imageName = NULL, maskName = NULL, weightName = NULL; // Names for convolved images
+        const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for variance map
+        psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images
         psStringAppend(&imageName, "%s.%d.%s", outName, numInput, tempImage);
         psStringAppend(&maskName, "%s.%d.%s", outName, numInput, tempMask);
-        psStringAppend(&weightName, "%s.%d.%s", outName, numInput, tempWeight);
+        psStringAppend(&varianceName, "%s.%d.%s", outName, numInput, tempVariance);
 
         if (!readImage(&readout->image, imageName, config) || !readImage(&readout->mask, maskName, config) ||
-            !readImage(&readout->weight, weightName, config)) {
+            !readImage(&readout->variance, varianceName, config)) {
             psError(PS_ERR_IO, false, "Unable to read previously produced image.");
             psFree(imageName);
             psFree(maskName);
-            psFree(weightName);
+            psFree(varianceName);
             return false;
         }
         psFree(imageName);
         psFree(maskName);
-        psFree(weightName);
+        psFree(varianceName);
 
         psRegion *region = psMetadataLookupPtr(NULL, output->analysis,
@@ -374,5 +375,5 @@
                                                                                          "RENORM.STDEV"));
 
-                if (!pmReadoutWeightRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
+                if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
                     psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
                     psFree(output);
@@ -444,8 +445,10 @@
             psFree(readout->image);
             psFree(readout->mask);
-            psFree(readout->weight);
+            psFree(readout->variance);
+            psFree(readout->covariance);
             readout->image  = psMemIncrRefCounter(output->image);
             readout->mask   = psMemIncrRefCounter(output->mask);
-            readout->weight = psMemIncrRefCounter(output->weight);
+            readout->variance = psMemIncrRefCounter(output->variance);
+            readout->covariance = psImageCovarianceTruncate(output->covariance, COVAR_FRAC);
         } else {
             // Fake the convolution
@@ -559,5 +562,5 @@
                                                                                  "RENORM.STDEV"));
 
-        if (!pmReadoutWeightRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
+        if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");
             psFree(output);
@@ -583,5 +586,4 @@
     psFree(bg);
 
-
 #if 0
 #define RADIUS 10                       // Radius of photometry
