Index: /branches/eam_branches/20091201/ppImage/src/ppImageBurntoolMask.c
===================================================================
--- /branches/eam_branches/20091201/ppImage/src/ppImageBurntoolMask.c	(revision 26792)
+++ /branches/eam_branches/20091201/ppImage/src/ppImageBurntoolMask.c	(revision 26793)
@@ -3,5 +3,5 @@
 #endif
 
-#define PPIMAGE_BURNTOOL_DEBUG 1
+#define PPIMAGE_BURNTOOL_DEBUG 0
 
 #include "ppImage.h"
@@ -23,5 +23,5 @@
     return(false);
   }
-  long Nrows = psFitsTableSize(fits);  
+  long Nrows = psFitsTableSize(fits);
 
   long row = 0;
@@ -33,8 +33,8 @@
   psImage *image = mask->mask;
 
-  
+
   /* Set the maskValue from the recipes. */
   psImageMaskType maskValue = options->burntoolMask;
-#ifdef PPIMAGE_BURNTOOL_DEBUG
+#if PPIMAGE_BURNTOOL_DEBUG
   psLogMsg("ppImageBurntoolMask", 4, "Status: %ld %d\n",Nrows,maskValue);
 #endif
@@ -48,43 +48,43 @@
     if (psMetadataLookupS32(&status,rowMD,"cell") == burntool_cell) {
       if (((options->burntoolTrails & 0x01)&&(psMetadataLookupS32(&status,rowMD,"func") == 4))||
-	  (((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1))||
-	   ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)))) {
-	/*       If the fit fails, burntool reports zero here.  This
-		 signifies that it expected to see a trail (else why
-		 fit) but did not find it when it attempted to
-		 correct. */
-#ifdef PPIMAGE_BURNTOOL_DEBUG
-	psLogMsg ("ppImageBurntoolMask", 4, "Masking! %d (%d %d %d) %d %d",
-		  psMetadataLookupS32(&status,rowMD,"cell"),
-		  ((options->burntoolTrails & 0x0001)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0)),
-		  ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1)),
-		  ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)),
-		  options->burntoolTrails,
-		  maskValue
-		  );
+          (((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1))||
+           ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)))) {
+        /*       If the fit fails, burntool reports zero here.  This
+                 signifies that it expected to see a trail (else why
+                 fit) but did not find it when it attempted to
+                 correct. */
+#if PPIMAGE_BURNTOOL_DEBUG
+        psLogMsg ("ppImageBurntoolMask", 4, "Masking! %d (%d %d %d) %d %d",
+                  psMetadataLookupS32(&status,rowMD,"cell"),
+                  ((options->burntoolTrails & 0x0001)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0)),
+                  ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1)),
+                  ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)),
+                  options->burntoolTrails,
+                  maskValue
+                  );
 #endif
-	for (int i = psMetadataLookupS32(&status,rowMD,"sxfit");
-	     i <= psMetadataLookupS32(&status,rowMD,"exfit");
-	     i++) {
+        for (int i = psMetadataLookupS32(&status,rowMD,"sxfit");
+             i <= psMetadataLookupS32(&status,rowMD,"exfit");
+             i++) {
 
-	  if (psMetadataLookupS32(&status,rowMD,"up") == 0) {
-	    for (int j = 0; j <= psMetadataLookupS32(&status,rowMD,"y1p"); j++) {
-#ifdef PPIMAGE_BURNTOOL_DEBUG
-	      psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
-		       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
+          if (psMetadataLookupS32(&status,rowMD,"up") == 0) {
+            for (int j = 0; j <= psMetadataLookupS32(&status,rowMD,"y1p"); j++) {
+#if PPIMAGE_BURNTOOL_DEBUG
+              psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
+                       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
 #endif
-	      image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
-	    }
-	  }
-	  else {
-	    for (int j = psMetadataLookupS32(&status,rowMD,"y1m"); j < image->numRows ; j++) {
-#ifdef PPIMAGE_BURNTOOL_DEBUG
-	      psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
-		       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
+              image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
+            }
+          }
+          else {
+            for (int j = psMetadataLookupS32(&status,rowMD,"y1m"); j < image->numRows ; j++) {
+#if PPIMAGE_BURNTOOL_DEBUG
+              psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
+                       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
 #endif
-	      image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
-	    }
-	  }
-	}
+              image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
+            }
+          }
+        }
 
       }
@@ -95,6 +95,2 @@
   return(status);
 }
-	    
-
-
-    
Index: /branches/eam_branches/20091201/psphot/src/psphotLoadPSF.c
===================================================================
--- /branches/eam_branches/20091201/psphot/src/psphotLoadPSF.c	(revision 26792)
+++ /branches/eam_branches/20091201/psphot/src/psphotLoadPSF.c	(revision 26793)
@@ -17,5 +17,8 @@
     // find the currently selected readout
     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
-    psAssert (file, "missing file?");
+    if (file == NULL) {
+        psLogMsg ("psphot", 3, "no psf supplied for this chip");
+        return true;
+    }
 
     // find the currently selected chip
@@ -35,5 +38,5 @@
 
     if (!psphotPSFstats (readout, psf)) {
-	psAbort("cannot measure PSF shape terms");
+        psAbort("cannot measure PSF shape terms");
     }
 
@@ -42,5 +45,5 @@
     // save PSF on readout->analysis
     if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot psf model", psf)) {
-	psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
+        psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
         return false;
     }
@@ -60,9 +63,9 @@
     for (int i = 0; i < num; i++) {
 
-	// Generate the mask and weight images, including the user-defined analysis region of interest
-	if (!psphotLoadPSFReadout (config, view, "PSPHOT.PSF.LOAD", i)) {
+        // Generate the mask and weight images, including the user-defined analysis region of interest
+        if (!psphotLoadPSFReadout (config, view, "PSPHOT.PSF.LOAD", i)) {
             psError (PSPHOT_ERR_CONFIG, false, "failed to load PSF model for PSPHOT.PSF.LOAD entry %d", i);
-	    return false;
-	}
+            return false;
+        }
     }
     return true;
Index: /branches/eam_branches/20091201/psphot/src/psphotMergeSources.c
===================================================================
--- /branches/eam_branches/20091201/psphot/src/psphotMergeSources.c	(revision 26792)
+++ /branches/eam_branches/20091201/psphot/src/psphotMergeSources.c	(revision 26793)
@@ -15,8 +15,8 @@
     // loop over the available readouts
     for (int i = 0; i < num; i++) {
-	if (!psphotMergeSourcesReadout (config, view, "PSPHOT.INPUT", i)) {
+        if (!psphotMergeSourcesReadout (config, view, "PSPHOT.INPUT", i)) {
             psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);
-	    return false;
-	}
+            return false;
+        }
     }
     return true;
@@ -43,12 +43,12 @@
     // XXX TEST:
     if (detections->allSources) {
-	psphotMaskCosmicRayFootprintCheck(detections->allSources);
+        psphotMaskCosmicRayFootprintCheck(detections->allSources);
     }
     if (detections->newSources) {
-	psphotMaskCosmicRayFootprintCheck(detections->newSources);
+        psphotMaskCosmicRayFootprintCheck(detections->newSources);
     }
 
     if (!detections->allSources) {
-	detections->allSources = psArrayAllocEmpty(newSources->n);
+        detections->allSources = psArrayAllocEmpty(newSources->n);
     }
     psArray *allSources = detections->allSources;
@@ -87,5 +87,5 @@
     psAssert (detections, "missing detections?");
 
-    // XXX allSources of newSources?
+    // XXX allSources or newSources?
     psArray *sources = detections->allSources;
     psAssert (sources, "missing sources?");
@@ -96,9 +96,9 @@
         if (!readoutCMF) goto loadTXT;
 
-	extCMF = psMetadataLookupPtr (NULL, readoutCMF->analysis, "PSPHOT.DETECTIONS");
-	if (extCMF) {
-	    for (int i = 0; i < extCMF->allSources->n; i++) {
-		pmSource *source = extCMF->allSources->data[i];
-		source->mode |= PM_SOURCE_MODE_EXTERNAL;
+        extCMF = psMetadataLookupPtr (NULL, readoutCMF->analysis, "PSPHOT.DETECTIONS");
+        if (extCMF) {
+            for (int i = 0; i < extCMF->allSources->n; i++) {
+                pmSource *source = extCMF->allSources->data[i];
+                source->mode |= PM_SOURCE_MODE_EXTERNAL;
 
                 // the supplied peak flux needs to be re-normalized
@@ -106,11 +106,11 @@
                 source->peak->value = 1.0;
 
-		// drop the loaded source modelPSF
-		psFree (source->modelPSF);
-		source->modelPSF = NULL;
-
-		psArrayAdd (detections->allSources, 100, source);
-	    }
-	}
+                // drop the loaded source modelPSF
+                psFree (source->modelPSF);
+                source->modelPSF = NULL;
+
+                psArrayAdd (detections->allSources, 100, source);
+            }
+        }
     }
 
@@ -128,11 +128,11 @@
                 source->mode |= PM_SOURCE_MODE_EXTERNAL;
 
-		// drop the loaded source modelPSF
-		psFree (source->modelPSF);
-		source->modelPSF = NULL;
-
-		psArrayAdd (detections->allSources, 100, source);
-	    }
-	}
+                // drop the loaded source modelPSF
+                psFree (source->modelPSF);
+                source->modelPSF = NULL;
+
+                psArrayAdd (detections->allSources, 100, source);
+            }
+        }
     }
 
@@ -168,5 +168,5 @@
     if (!detections) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
-	return NULL;
+        return NULL;
     }
 
@@ -174,5 +174,5 @@
     if (!sources) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
-	return NULL;
+        return NULL;
     }
 
@@ -212,5 +212,5 @@
 
 // generate the detection structure for the supplied array of sources
-// XXX this currently assumes there is a single input file 
+// XXX this currently assumes there is a single input file
 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources) {
 
@@ -274,6 +274,6 @@
     // save detections on the readout->analysis
     if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detectinos", detections)) {
-	psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
-	return false;
+        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
+        return false;
     }
     psFree (detections);
@@ -343,44 +343,44 @@
 
     if (sources->n) {
-	// the user wants to make the psf from these stars; define them as psf stars:
-	for (int i = 0; i < sources->n; i++) {
-	    pmSource *source = sources->data[i];
-	    source->mode |= PM_SOURCE_MODE_PSFSTAR;
-	}
-	// force psphotChoosePSF to use all loaded sources
-	psMetadataAddS32 (recipe, PS_LIST_TAIL, "PSF_MAX_NSTARS", PS_META_REPLACE, "max number of sources for PSF model", sources->n);
-
-	// measure stats of externally specified sources
-	if (!psphotSourceStatsUpdate (sources, config, readout)) {
-	    psError(PSPHOT_ERR_CONFIG, false, "failure to measure stats of existing sources");
-	    return false;
-	}
+        // the user wants to make the psf from these stars; define them as psf stars:
+        for (int i = 0; i < sources->n; i++) {
+            pmSource *source = sources->data[i];
+            source->mode |= PM_SOURCE_MODE_PSFSTAR;
+        }
+        // force psphotChoosePSF to use all loaded sources
+        psMetadataAddS32 (recipe, PS_LIST_TAIL, "PSF_MAX_NSTARS", PS_META_REPLACE, "max number of sources for PSF model", sources->n);
+
+        // measure stats of externally specified sources
+        if (!psphotSourceStatsUpdate (sources, config, readout)) {
+            psError(PSPHOT_ERR_CONFIG, false, "failure to measure stats of existing sources");
+            return false;
+        }
     } else {
 
-	// find the detections (by peak and/or footprint) in the image.
-	if (!psphotFindDetections (config, view, true)) {
-	    psError(PSPHOT_ERR_CONFIG, false, "unable to find detections in this image");
-	    return psphotReadoutCleanup (config, view);
-	}
-
-	// construct sources and measure basic stats
-	psphotSourceStats (config, view, true);
-
-	// find blended neighbors of very saturated stars
-	psphotDeblendSatstars (config, view);
-
-	// mark blended peaks PS_SOURCE_BLEND
-	if (!psphotBasicDeblend (config, view)) {
-	    psLogMsg ("psphot", 3, "failed on deblend analysis");
-	    return psphotReadoutCleanup (config, view);
-	}
-
-	// classify sources based on moments, brightness
-	if (!psphotRoughClass (config, view)) {
-	    psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
-	    return psphotReadoutCleanup (config, view);
-	}
-    }
-
-    return true;
-}
+        // find the detections (by peak and/or footprint) in the image.
+        if (!psphotFindDetections (config, view, true)) {
+            psError(PSPHOT_ERR_CONFIG, false, "unable to find detections in this image");
+            return psphotReadoutCleanup (config, view);
+        }
+
+        // construct sources and measure basic stats
+        psphotSourceStats (config, view, true);
+
+        // find blended neighbors of very saturated stars
+        psphotDeblendSatstars (config, view);
+
+        // mark blended peaks PS_SOURCE_BLEND
+        if (!psphotBasicDeblend (config, view)) {
+            psLogMsg ("psphot", 3, "failed on deblend analysis");
+            return psphotReadoutCleanup (config, view);
+        }
+
+        // classify sources based on moments, brightness
+        if (!psphotRoughClass (config, view)) {
+            psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
+            return psphotReadoutCleanup (config, view);
+        }
+    }
+
+    return true;
+}
Index: /branches/eam_branches/20091201/psphot/src/psphotReadout.c
===================================================================
--- /branches/eam_branches/20091201/psphot/src/psphotReadout.c	(revision 26792)
+++ /branches/eam_branches/20091201/psphot/src/psphotReadout.c	(revision 26793)
@@ -56,8 +56,8 @@
         return psphotReadoutCleanup (config, view);
     }
-	
+
     // find the detections (by peak and/or footprint) in the image.
     if (!psphotFindDetections (config, view, true)) { // pass 1
-	// this only happens if we had an error in psphotFindDetections
+        // this only happens if we had an error in psphotFindDetections
         psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
         return psphotReadoutCleanup (config, view);
@@ -104,6 +104,6 @@
     // this step is skipped
     if (!psphotChoosePSF (config, view)) { // pass 1
-	psLogMsg ("psphot", 3, "failure to construct a psf model");
-	return psphotReadoutCleanup (config, view);
+        psLogMsg ("psphot", 3, "failure to construct a psf model");
+        return psphotReadoutCleanup (config, view);
     }
     if (!strcasecmp (breakPt, "PSFMODEL")) {
@@ -113,5 +113,5 @@
     // include externally-supplied sources
     // XXX fix this in the new multi-input context
-    psphotLoadExtSources (config, view); // pass 1
+    // psphotLoadExtSources (config, view); // pass 1
 
     // construct an initial model for each object, set the radius to fitRadius, set circular
@@ -121,5 +121,5 @@
     // merge the newly selected sources into the existing list
     // NOTE: merge OLD and NEW
-    psphotMergeSources (config, view); 
+    psphotMergeSources (config, view);
 
     // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
