Index: trunk/ippconfig/recipes/psphot.config
===================================================================
--- trunk/ippconfig/recipes/psphot.config	(revision 34201)
+++ trunk/ippconfig/recipes/psphot.config	(revision 34202)
@@ -69,4 +69,5 @@
 FOOTPRINT_CULL_NSIGMA_PAD           F32   0.01       	  # Fractional Padding for stdev
 FOOTPRINT_USE_UNSUBTRACTED          BOOL  TRUE            # find footprints without sources subtracted
+FOOTPRINT_SET_NANS_TO_ZERO          BOOL  FALSE           # set nan pixels in smoothed image to zero when culling peaks
 
 # parameter for the simple deblending
@@ -274,5 +275,5 @@
 
 # psphotFitSourcesLinear has 3 options for the weighting: CONSTANT,
-# IMAGE_VAR, MODEL_VA the first of these used to be folded into the
+# IMAGE_VAR, MODEL_VAR the first of these used to be folded into the
 # boolean CONSTANT_PHOTOMETRIC_WEIGHTS above.
 LINEAR_FIT_VARIANCE_MODE	    STR  CONSTANT
@@ -340,4 +341,5 @@
 PSPHOT.CR.MAX.MAG		    F32   0		  # guess for limit on Kron Mag
 PSPHOT.CR.AUTOSCALE		    BOOL  FALSE
+PSPHOT.CR.MAX.WINDOW                S32   50              # maximum window to seach for cosmic rays
 
 # Detection efficiency
Index: trunk/psphot/src/psphotCullPeaks.c
===================================================================
--- trunk/psphot/src/psphotCullPeaks.c	(revision 34201)
+++ trunk/psphot/src/psphotCullPeaks.c	(revision 34202)
@@ -63,4 +63,15 @@
 # if (PM_PEAKS_CULL_WITH_SMOOTHED_IMAGE)
     psLogMsg ("psphot", PS_LOG_INFO, "Culling peaks from footprints using the smoothed image");
+    bool setNaNsToZero = psMetadataLookupF32 (&status, recipe, "FOOTPRINT_SET_NANS_TO_ZERO");
+    if (setNaNsToZero) {
+        // Set NaN pixels to zero so that they do not considered in the footprint analysis
+        // XXX: Currently the caller does nothing further with the significance readout so
+        // modifiying the image does no harm
+        // XXX: Note: signifR->weight is not used by pmFootprintCullPeaks so we don't
+        // need to touch it
+        psImageClipNaN(signifR->image, 0);
+    }
+        
+
 # else
     psLogMsg ("psphot", PS_LOG_INFO, "Culling peaks from footprints using the raw (unsmoothed) image");
