Index: /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.c
===================================================================
--- /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.c	(revision 21286)
+++ /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.c	(revision 21287)
@@ -500,5 +500,11 @@
     PS_ASSERT_PTR_NON_NULL(cell, false);
     PS_ASSERT_PTR_NON_NULL(fits, false);
-    return cellWrite(cell, fits, config, blank, FPA_WRITE_TYPE_VARIANCE);
+    if (!cellWrite(cell, fits, config, blank, FPA_WRITE_TYPE_VARIANCE)) {
+        return false;
+    }
+    if (!pmCellWriteCovariance(fits, cell)) {
+        return false;
+    }
+    return true;
 }
 
@@ -507,5 +513,11 @@
     PS_ASSERT_PTR_NON_NULL(chip, false);
     PS_ASSERT_PTR_NON_NULL(fits, false);
-    return chipWrite(chip, fits, config, blank, recurse, FPA_WRITE_TYPE_VARIANCE);
+    if (!chipWrite(chip, fits, config, blank, recurse, FPA_WRITE_TYPE_VARIANCE)) {
+        return false;
+    }
+    if (!pmChipWriteCovariance(fits, chip)) {
+        return false;
+    }
+    return true;
 }
 
@@ -514,5 +526,11 @@
     PS_ASSERT_PTR_NON_NULL(fpa, false);
     PS_ASSERT_PTR_NON_NULL(fits, false);
-    return fpaWrite(fpa, fits, config, blank, recurse, FPA_WRITE_TYPE_VARIANCE);
+    if (!fpaWrite(fpa, fits, config, blank, recurse, FPA_WRITE_TYPE_VARIANCE)) {
+        return false;
+    }
+    if (!pmFPAWriteCovariance(fits, fpa)) {
+        return false;
+    }
+    return true;
 }
 
Index: /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.h
===================================================================
--- /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.h	(revision 21286)
+++ /branches/pap_branch_20090128/psModules/src/camera/pmFPAWrite.h	(revision 21287)
@@ -4,6 +4,6 @@
  * @author Paul Price, IfA
  *
- * @version $Revision: 1.11.44.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2009-01-29 00:33:51 $
+ * @version $Revision: 1.11.44.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2009-02-04 21:07:14 $
  * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
  */
@@ -165,4 +165,20 @@
     );
 
+/// Write covariance matrix to a FITS file
+///
+/// The covariance matrices for a cell are written to an independent extension, named after the chip and cell
+/// name.
+bool pmCellWriteCovariance(psFits *fits,///< FITS file to which to write
+                           const pmCell *cell ///< Cell for which to write covariance
+    );
+
+bool pmChipWriteCovariance(psFits *fits,///< FITS file to which to write
+                           const pmChip *chip ///< Chip for which to write covariance
+    );
+
+bool pmFPAWriteCovariance(psFits *fits,///< FITS file to which to write
+                          const pmFPA *fpa ///< FPA for which to write covariance
+    );
+
 // XXX better name, please
 bool pmFPAUpdateNames(pmFPA *fpa, pmChip *chip, pmCell *cell);
