Index: trunk/magic/censorObjects/src/censor.h
===================================================================
--- trunk/magic/censorObjects/src/censor.h	(revision 24696)
+++ trunk/magic/censorObjects/src/censor.h	(revision 24714)
@@ -31,6 +31,7 @@
 bool censorParseCamera (pmConfig *config);
 bool censorLoop (pmConfig *config);
-bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view);
+bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view, bool badMaskFile);
 void censorCleanup (pmConfig *config);
+bool censorBadFileByView (bool badFile, pmFPAfile *file, pmConfig *config, pmFPAview *view);
 
 // Return version strings.
Index: trunk/magic/censorObjects/src/censorLoop.c
===================================================================
--- trunk/magic/censorObjects/src/censorLoop.c	(revision 24696)
+++ trunk/magic/censorObjects/src/censorLoop.c	(revision 24714)
@@ -43,5 +43,16 @@
     }
 
+    // select the input data sources
+    pmFPAfile *inMask = psMetadataLookupPtr (NULL, config->files, "CENSOR.INPUT.MASK");
+    if (!inMask) {
+	psError(CENSOR_ERR_CONFIG, true, "Can't find input masks!\n");
+	return false;
+    }
+
     pmFPAview *view = pmFPAviewAlloc (0);
+    bool badMaskFile = false;
+
+    // check on the mask file at this level if possible
+    badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
 
     // files associated with the science image
@@ -49,19 +60,31 @@
 
     while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
-        psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
-        if (!chip->process || !chip->file_exists) { continue; }
+	psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
+	if (!chip->process || !chip->file_exists) { continue; }
+
+	// check on the mask file at this level if possible
+	badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
+
 	if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
 
 	while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
-            psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
-            if (!cell->process || !cell->file_exists) { continue; }
+	    psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
+	    if (!cell->process || !cell->file_exists) { continue; }
+
+	    // check on the mask file at this level if possible
+	    badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
+
 	    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
 
 	    // process each of the readouts
 	    while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
+
+		// check on the mask file at this level if possible
+		badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
+
 		if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
 		if (!readout->data_exists) { continue; }
 
-		if (!censorReadout (readout, config, view)) ESCAPE;
+		if (!censorReadout (readout, config, view, badMaskFile)) ESCAPE;
 
 		if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
@@ -78,2 +101,26 @@
     return true;
 }
+
+bool censorBadFileByView (bool badFile, pmFPAfile *file, pmConfig *config, pmFPAview *view) {
+
+    // get the current level
+    pmFPALevel level = pmFPAviewLevel (view);
+
+    // can we try to open this file? (if not, leave the existing badView intact)
+    if (level != file->fileLevel) return badFile;
+
+    // free, and if needed, realloc badView below
+    badFile = false;
+
+    char *filename = pmFPAfileName(file, view, config);
+    if (filename) {
+	// activate the file
+	pmFPAfileActivate (config->files, true, file->name);
+	psFree (filename);
+	return false;
+    }
+
+    // de-activate the file
+    pmFPAfileActivate (config->files, false, file->name);
+    return true;
+}
Index: trunk/magic/censorObjects/src/censorReadout.c
===================================================================
--- trunk/magic/censorObjects/src/censorReadout.c	(revision 24696)
+++ trunk/magic/censorObjects/src/censorReadout.c	(revision 24714)
@@ -13,7 +13,13 @@
 # include "censor.h"
 
-bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view) {
+bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view, bool badMaskFile) {
 
     bool status;
+
+    // if there is no mask file for this readout drop all sources
+    if (badMaskFile) {
+      psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES");
+      return true;
+    }
 
     // select the current recipe
