Index: trunk/ppStats/src/ppStatsReadout.c
===================================================================
--- trunk/ppStats/src/ppStatsReadout.c	(revision 14010)
+++ trunk/ppStats/src/ppStatsReadout.c	(revision 14359)
@@ -2,8 +2,8 @@
 
 psExit ppStatsReadout(psMetadata *cellResults, // Metadata holding the chip results
-		      pmReadout *readout,	// Cell for which to get statistics
-		      int nReadout,	// readout number
-		      ppStatsData *data,	// The data
-		      const pmConfig *config // Configuration
+                      pmReadout *readout,       // Cell for which to get statistics
+                      int nReadout,     // readout number
+                      ppStatsData *data,        // The data
+                      const pmConfig *config // Configuration
     )
 {
@@ -14,6 +14,6 @@
 
     /*** psphot and psastro put their results on the readout->analysis metadata (PSPHOT.HEADER,
-	 PSASTRO.HEADER).  we need to pull quantities of interest from those locations. to do
-	 this, we need to select the appropriate readout.  ***/
+         PSASTRO.HEADER).  we need to pull quantities of interest from those locations. to do
+         this, we need to select the appropriate readout.  ***/
 
     // Extract Header and Concept values from the Cell and Readout->analysis level
@@ -31,8 +31,8 @@
     // Extract Header values
     if (psListLength(data->headers)) {
-	// extract from data->analysis output MD entries
-	if (psListLength(data->analysis)) {
-	    p_ppStatsGetAnalysis (readoutResults, data->headers, readout->analysis, data->analysis);
-	}
+        // extract from data->analysis output MD entries
+        if (psListLength(data->analysis)) {
+            p_ppStatsGetAnalysis (readoutResults, data->headers, readout->analysis, data->analysis);
+        }
     }
 
@@ -62,4 +62,5 @@
         psVector *sampleValues = psVectorAlloc(numSamples, PS_TYPE_F32); // Vector of samples
         psVector *sampleMask = NULL;  // Corresponding mask
+        bool warnNonFinite = false;     // Have we warned about non-finite values?
         if (mask) {
             sampleMask = psVectorAlloc(numSamples, PS_TYPE_U8);
@@ -70,4 +71,11 @@
             int x = j % image->numCols;
             sampleValues->data.F32[i] = image->data.F32[y][x];
+            if (!isfinite(sampleValues->data.F32[i])) {
+                if (!warnNonFinite) {
+                    psWarning("Non-finite value detected at %d,%d", x, y);
+                    warnNonFinite = true;
+                }
+                sampleMask->data.U8[i] = data->maskVal;
+            }
             if (mask) {
                 sampleMask->data.U8[i] = mask->data.U8[y][x];
