Index: trunk/psphot/src/psphotModelTest.c
===================================================================
--- trunk/psphot/src/psphotModelTest.c	(revision 17396)
+++ trunk/psphot/src/psphotModelTest.c	(revision 18555)
@@ -12,9 +12,14 @@
     pmSourceFitMode fitMode;
 
-    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
-    psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
-    psMaskType mark    = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels
+    // bit-masks to test for good/bad pixels
+    psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT");
     assert (maskVal);
-    assert (mark);
+
+    // bit-mask to mark pixels not used in analysis
+    psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT");
+    assert (markVal);
+
+    // maskVal is used to test for rejected pixels, and must include markVal
+    maskVal |= markVal;
 
     // run model fitting tests on a single source?
@@ -130,5 +135,5 @@
 
     // find the local sky
-    status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, mark);
+    status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);
     if (!status) psAbort("pmSourceLocalSky error");
 
@@ -195,5 +200,5 @@
 
     // define the pixels used for the fit
-    psImageKeepCircle (source->maskObj, xObj, yObj, RADIUS, "OR", mark);
+    psImageKeepCircle (source->maskObj, xObj, yObj, RADIUS, "OR", markVal);
     psphotSaveImage (NULL, source->maskObj, "mask1.fits");
 
@@ -213,5 +218,5 @@
 	assert (status);
 
-        model = psphotPSFConvModel (readout, source, modelType, maskVal, psfSize);
+        model = psphotPSFConvModel (readout, source, modelType, maskVal, markVal, psfSize);
         params = model->params->data.F32;
     } else {
