Index: /branches/eam_branches/ipp-20220316/pswarp/src/pswarpMapGrid.c
===================================================================
--- /branches/eam_branches/ipp-20220316/pswarp/src/pswarpMapGrid.c	(revision 42368)
+++ /branches/eam_branches/ipp-20220316/pswarp/src/pswarpMapGrid.c	(revision 42369)
@@ -38,5 +38,4 @@
     int nYpts = (int)(Ny / nYpix) + 1;
 
-    psLogMsg("pswarp", 3, "in grid sampling\n");
     // create the grid of maps
     pswarpMapGrid *grid = pswarpMapGridAlloc (nXpts, nYpts);
@@ -50,5 +49,5 @@
     }
 
-    //if (0) {
+    if (0) {
 	// test the transformation sky<->chip for chip in smf:
 	if (fout == NULL) { fout = fopen ("map.grid.txt", "w");	}
@@ -89,8 +88,4 @@
 		fprintf (fout, "%f %f < %f %f < %f %f \n", TP1->x, TP1->y, FP1->x, FP1->y, CH1->x, CH1->y);
 
-                psLogMsg("pswarp", 3, "testing grid sampling\n");
-                psLogMsg("pswarp", 3, "%f %f > %f %f > %f %f > %f %f | ", CH0->x, CH0->y, FP0->x, FP0->y, TP0->x, TP0->y, sky->r*180/M_PI, sky->d*180/M_PI);
-                psLogMsg("pswarp", 3, "%f %f < %f %f < %f %f \n", TP1->x, TP1->y, FP1->x, FP1->y, CH1->x, CH1->y);
-
 	    }
 	}
@@ -106,5 +101,5 @@
 
 	psFree (sky);
-    //}
+    }
 
     grid->nXpix = nXpix;
Index: /branches/eam_branches/ipp-20220316/pswarp/src/pswarpSetMaskBits.c
===================================================================
--- /branches/eam_branches/ipp-20220316/pswarp/src/pswarpSetMaskBits.c	(revision 42368)
+++ /branches/eam_branches/ipp-20220316/pswarp/src/pswarpSetMaskBits.c	(revision 42369)
@@ -20,4 +20,5 @@
  * updated in the config metadata.
  */
+ 
 bool pswarpSetMaskBits (pmConfig *config)
 {
@@ -26,10 +27,27 @@
     psImageMaskType maskOut = 0x00;                     // mask for the output image
 
+    // Look up recipe values
+    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PSWARP_RECIPE); // Recipe for ppSim
+    psAssert(recipe, "We checked this earlier, so it should be here.");
+    bool doDetectCTE = psMetadataLookupBool(NULL, recipe, "DETECT.CTE"); // Do detections on pixels underneath CTE masks
+
     // this function sets the required single-image mask bits
-    if (!pmConfigMaskSetBits (&maskIn, &markIn, config)) {
-        psError (psErrorCodeLast(), false, "Unable to define the mask bit values");
-        return false;
+    if(!doDetectCTE) {
+      if (!pmConfigMaskSetBits (&maskIn, &markIn, config)) {
+          psError (psErrorCodeLast(), false, "Unable to define the mask bit values");
+          return false;
+      }
+    } else {
+      psMetadata *maskrecipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe
+      if (!maskrecipe) {
+          psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find MASKS recipe.");
+          return false;
+      }
+      if (!pswarpMaskSetInMetadata(&maskIn, &markIn, maskrecipe)) {
+          psError (psErrorCodeLast(), false, "Unable to determine the mask value");
+          return false;
+      }
     }
-
+    
     // mask for non-linear flat regions (default to DETECTOR if not defined)
     psImageMaskType badMask = pmConfigMaskGet("CONV.BAD", config);
Index: /branches/eam_branches/ipp-20220316/pswarp/src/pswarpTransformReadout.c
===================================================================
--- /branches/eam_branches/ipp-20220316/pswarp/src/pswarpTransformReadout.c	(revision 42368)
+++ /branches/eam_branches/ipp-20220316/pswarp/src/pswarpTransformReadout.c	(revision 42369)
@@ -104,5 +104,4 @@
     // pswarpMapGridFromImage builds a set of locally-linear maps which convert the
     // output coordinates to input coordinates
-    psLogMsg("pswarp", 3, "going into MapGrid \n");
     pswarpMapGrid *grid = pswarpMapGridFromImage(input, output, nGridX, nGridY);
     
