Index: trunk/psastro/src/psastroMosaicAstrom.c
===================================================================
--- trunk/psastro/src/psastroMosaicAstrom.c	(revision 20269)
+++ trunk/psastro/src/psastroMosaicAstrom.c	(revision 20800)
@@ -13,6 +13,6 @@
     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     if (!recipe) {
-	psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n");
-	return false;
+        psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n");
+        return false;
     }
 
@@ -20,6 +20,6 @@
     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     if (!input) {
-	psError(PSASTRO_ERR_CONFIG, false, "Can't find input data!\n");
-	return false;
+        psError(PSASTRO_ERR_CONFIG, false, "Can't find input data!\n");
+        return false;
     }
 
@@ -27,13 +27,13 @@
 
     // before we do object matches, we need to (optionally) fix failed chips.  We compare chips with
-    // the supplied mosaic model.  Adjust significant outliers to match model.  
+    // the supplied mosaic model.  Adjust significant outliers to match model.
     # if (0)
     if (!psastroFixChips (config, recipe)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");
+        return false;
     }
     if (!psastroFixChipsTest (config, recipe)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips");
+        return false;
     }
     # endif
@@ -50,14 +50,14 @@
     // first, re-perform the match with a slightly tighter circle
     if (!psastroMosaicSetMatch (fpa, recipe, 4)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass)");
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (4th pass)");
+        return false;
     }
     if (!psastroMosaicChipAstrom (fpa, recipe, 4)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (4th pass)");
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (4th pass)");
+        return false;
     }
-    if (psTraceGetLevel("psastro.dump") > 0) { 
-	snprintf (filename, 256, "%s.10.dat", outroot);
-	psastroDumpMatches (fpa, filename); 
+    if (psTraceGetLevel("psastro.dump") > 0) {
+        snprintf (filename, 256, "%s.10.dat", outroot);
+        psastroDumpMatches (fpa, filename);
     }
 
@@ -66,10 +66,10 @@
     psMetadata *updates = psMetadataLookupMetadata (&status, fpa->analysis, "PSASTRO.HEADER");
     if (!updates) {
-	updates = psMetadataAlloc ();
-	psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
-	psFree (updates);
+        updates = psMetadataAlloc ();
+        psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
+        psFree (updates);
     }
     if (!pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL)) {
-	psAbort ("failed to save header terms");
+        psAbort ("failed to save header terms");
     }
 
@@ -103,11 +103,11 @@
     // is this needed? yes, if we didn't do SingleChip astrometry first
     if (!psastroMosaicSetMatch (fpa, recipe, pass)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", pass);
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to match raw and ref stars for mosaic (pass %d)", pass);
+        return false;
     }
 
-    if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 
-	snprintf (filename, 256, "%s.0.dat", rootname);
-	psastroDumpMatches (fpa, filename); 
+    if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) {
+        snprintf (filename, 256, "%s.0.dat", rootname);
+        psastroDumpMatches (fpa, filename);
     }
 
@@ -116,11 +116,11 @@
     // then recalculate raw and ref positions
     if (!psastroMosaicCommonScale (fpa, recipe)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to set a common scale for the chips (pass %d)", pass);
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to set a common scale for the chips (pass %d)", pass);
+        return false;
     }
 
-    if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) { 
-	snprintf (filename, 256, "%s.1.dat", rootname);
-	psastroDumpMatches (fpa, filename); 
+    if ((pass == 0) && (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1)) {
+        snprintf (filename, 256, "%s.1.dat", rootname);
+        psastroDumpMatches (fpa, filename);
     }
 
@@ -129,24 +129,20 @@
     // refit the per-chip terms with linear fits only
     if (!psastroMosaicDistortion (fpa, recipe, pass)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure mosaic gradients (pass %d)", pass);
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure mosaic gradients (pass %d)", pass);
+        return false;
     }
 
     snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 2);
     if (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1) { psastroDumpMatches (fpa, filename); }
-    
+
     // measure the astrometry for the chips under the distortion term
     if (!psastroMosaicChipAstrom (fpa, recipe, pass)) {
-	psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", pass);
-	return false;
+        psError(PSASTRO_ERR_UNKNOWN, false, "failed to measure chip astrometry in mosaic mode (pass %d)", pass);
+        return false;
     }
 
-    int traceLevel = psTraceGetLevel("psastro.dump.psastroMosaicAstrom");
-    if (traceLevel > 1) {
-	snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 3);
-	psastroDumpMatches (fpa, filename); 
-    } else {
-	snprintf (filename, 256, "%s.dat", rootname);
-	psastroDumpMatches (fpa, filename); 
+    if (psTraceGetLevel("psastro.dump.psastroMosaicAstrom") > 1) {
+        snprintf (filename, 256, "%s.%d.dat", rootname, 2*pass + 3);
+        psastroDumpMatches (fpa, filename);
     }
 
