Index: /trunk/ppImage/src/ppImage.h
===================================================================
--- /trunk/ppImage/src/ppImage.h	(revision 35532)
+++ /trunk/ppImage/src/ppImage.h	(revision 35533)
@@ -315,5 +315,5 @@
 void ppImageRandomGaussianFree(void);
 
-bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options);
+bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options, psMetadata *stats);
 
 #endif
Index: /trunk/ppImage/src/ppImageAuxiliaryMask.c
===================================================================
--- /trunk/ppImage/src/ppImageAuxiliaryMask.c	(revision 35532)
+++ /trunk/ppImage/src/ppImageAuxiliaryMask.c	(revision 35533)
@@ -53,5 +53,5 @@
 
 // In this function, we augment the mask with the more conservative auxiliary mask
-bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options)
+bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options, psMetadata *stats)
 {
     psAssert(config, "Need configuration");
@@ -60,4 +60,5 @@
 
     if (!options->doAuxMask) {
+        psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary mask not enabled.");
         return true;
     }
@@ -139,4 +140,5 @@
          return false;
     }
+    psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary mask file: %s", auxMaskFileName);
 
     psFree(results);
@@ -160,4 +162,5 @@
             return false;
         }
+        psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary video mask file: %s", options->auxVideoMask);
         pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXVIDEOMASK", options->auxVideoMask);
         recordFileInHeader(chip, "DETREND.AUXVIDEOMASK", "auxiliary video mask", options->auxVideoMask);
@@ -179,5 +182,11 @@
     psImageMaskType maskDetector = pmConfigMaskGet("DETECTOR", config);
 
+    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PPIMAGE");
+    psAssert(recipe, "Need recipe!");
+    psImageMaskType staticMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.STATIC");
+    psAssert(staticMaskVal, "Need staticMaskVal!");
+
     int numCols = mask->numCols, numRows = mask->numRows; // Size of image
+    unsigned long numMasked = 0;
     for (int y = 0; y < numRows; y++) {
         for (int x = 0; x < numCols; x++) {
@@ -185,5 +194,9 @@
             // XXX: support other types and get the mask value from the header
             if (auxMask->data.F32[y][x] == 0) {
-                mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskDetector;
+                if ((mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & staticMaskVal) == 0) {
+                    // pixel was not previously included in the static mask so mask it
+                    ++numMasked;
+                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskDetector;
+                }
                 // I don't need to do this.
                 // The background subtraction code runs after us and will do it there
@@ -193,4 +206,11 @@
     }
 
+    float maskedFrac = (float) numMasked / (numRows * numCols);
+    psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary masks masked %ld aditional pixels. Masked fraction: %f", numMasked, maskedFrac);
+    if (stats) {
+        psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", PS_META_REPLACE,
+                   "Fraction of pixels masked by auxiliary masks", maskedFrac);
+    }
+
     psFree(auxMask);
 
Index: /trunk/ppImage/src/ppImageLoop.c
===================================================================
--- /trunk/ppImage/src/ppImageLoop.c	(revision 35532)
+++ /trunk/ppImage/src/ppImageLoop.c	(revision 35533)
@@ -189,5 +189,5 @@
         }
 
-        if (!ppImageAuxiliaryMask(config, view, options)) {
+        if (!ppImageAuxiliaryMask(config, view, options, stats)) {
             ESCAPE("Unable to apply auxiliary mask");
         }
