Index: trunk/psModules/src/camera/pmFPAfileIO.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileIO.c	(revision 13034)
+++ trunk/psModules/src/camera/pmFPAfileIO.c	(revision 13193)
@@ -16,4 +16,5 @@
 #include "pmFPAMaskWeight.h"
 #include "pmFPAview.h"
+#include "pmFPAFlags.h"
 #include "pmFPAfile.h"
 #include "pmFPACopy.h"
@@ -320,4 +321,27 @@
     }
 
+    // do we have data to write at this level?
+    if (!pmFPAviewCheckDataStatus (file->fpa, view)) {
+        psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name);
+        return true;
+    }
+
+    // note that for CMF and PSF, the test above is not sufficient to determine if there
+    // is actually any data to write out.  this is because these types of output files
+    // have their data stored on the readout->analysis metadata structure of another
+    // (existing) fpa
+    if (file->type == PM_FPA_FILE_PSF) {
+      if (!pmFPAviewCheckDataStatusForPSFmodel (view, file)) {
+        psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name);
+        return true;
+      }
+    }
+    if (file->type == PM_FPA_FILE_CMF) {
+      if (!pmFPAviewCheckDataStatusForSources (view, file)) {
+        psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name);
+        return true;
+      }
+    }
+
     // open the file if not yet opened
     // XXX do we need to test mosaicLevel?
@@ -637,4 +661,7 @@
       case PM_FPA_FILE_HEADER:
       case PM_FPA_FILE_FRINGE:
+	// XXX note that for CMF and PSF, we do not know yet if there is actually any data to 
+	// write out.  this is because these types of output files have their data stored on the
+	// readout->analysis metadata structure of another (existing) fpa
       case PM_FPA_FILE_CMF:
       case PM_FPA_FILE_PSF:
