Index: trunk/psastro/src/psastroAstromGuess.c
===================================================================
--- trunk/psastro/src/psastroAstromGuess.c	(revision 7829)
+++ trunk/psastro/src/psastroAstromGuess.c	(revision 8046)
@@ -4,5 +4,5 @@
 // XXX WCS keywords in the headers corresponding to the chips.
 // XXX this function is both converting the header WCS astrometry terms to the fpa terms
-//     and applying the astrometry to the detected objects.  
+//     and applying the astrometry to the detected objects.
 bool psastroAstromGuess (pmConfig *config) {
 
@@ -10,6 +10,6 @@
     bool status = false;
     bool isMosaic = false;
-    double RAmin, RAmax, RAminSky, RAmaxSky;
-    double DECmin, DECmax;
+    double RAmin = NAN, RAmax = NAN, RAminSky = NAN, RAmaxSky = NAN;
+    double DECmin = NAN, DECmax = NAN;
 
     pmChip *chip = NULL;
@@ -23,6 +23,6 @@
     psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
     if (!recipe) {
-	psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
-	exit(EXIT_FAILURE);
+        psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
+        exit(EXIT_FAILURE);
     }
 
@@ -30,6 +30,6 @@
     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     if (!input) {
-	psErrorStackPrint(stderr, "Can't find input data!\n");
-	exit(EXIT_FAILURE);
+        psErrorStackPrint(stderr, "Can't find input data!\n");
+        exit(EXIT_FAILURE);
     }
 
@@ -44,71 +44,71 @@
         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
         if (!chip->process || !chip->file_exists) { continue; }
-	
+
         // read WCS data from the corresponding header
         pmHDU *hdu = pmFPAviewThisHDU (view, fpa);
 
-	pmAstromReadWCS (fpa, chip, hdu->header, plateScale, isMosaic);
-	if (newFPA) {
-	    newFPA = false;
-	    RAminSky = fpa->projection->R - M_PI;
-	    RAmaxSky = fpa->projection->R + M_PI;
-	    RAmin = RAmax = fpa->projection->R;
-	    DECmin = DECmax = fpa->projection->D;
-	}
+        pmAstromReadWCS (fpa, chip, hdu->header, plateScale, isMosaic);
+        if (newFPA) {
+            newFPA = false;
+            RAminSky = fpa->projection->R - M_PI;
+            RAmaxSky = fpa->projection->R + M_PI;
+            RAmin = RAmax = fpa->projection->R;
+            DECmin = DECmax = fpa->projection->D;
+        }
 
-	// apply the new WCS guess data to all of the data in the readouts
-	// XXX should this go into a different function? this would separate WCS interpretation from application
-	while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
+        // apply the new WCS guess data to all of the data in the readouts
+        // XXX should this go into a different function? this would separate WCS interpretation from application
+        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
             if (!cell->process || !cell->file_exists) { continue; }
 
-	    // process each of the readouts
-	    while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
-		if (! readout->data_exists) { continue; }
+            // process each of the readouts
+            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
+                if (! readout->data_exists) { continue; }
 
-		psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
-		if (rawstars == NULL) { continue; }
+                psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
+                if (rawstars == NULL) { continue; }
 
-		for (int i = 0; i < rawstars->n; i++) {
-		    pmAstromObj *raw = rawstars->data[i];
-	
-		    psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);
-		    psPlaneDistortApply (raw->TP, fpa->toTangentPlane, raw->FP, 0.0, 0.0);
-		    p_psDeproject (raw->sky, raw->TP, fpa->projection);
+                for (int i = 0; i < rawstars->n; i++) {
+                    pmAstromObj *raw = rawstars->data[i];
 
-		    if (i < 0) {
-			fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n", 
-				 raw->chip->x, raw->chip->y, 
-				 raw->FP->x, raw->FP->y, 
-				 raw->TP->x, raw->TP->y, 
-				 raw->sky->r, raw->sky->d);
+                    psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);
+                    psPlaneDistortApply (raw->TP, fpa->toTangentPlane, raw->FP, 0.0, 0.0);
+                    p_psDeproject (raw->sky, raw->TP, fpa->projection);
 
-			psPlane *fp = psPlaneAlloc();
-			psPlane *tp = psPlaneAlloc();
-			psPlane *ch = psPlaneAlloc();
+                    if (i < 0) {
+                        fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n",
+                                 raw->chip->x, raw->chip->y,
+                                 raw->FP->x, raw->FP->y,
+                                 raw->TP->x, raw->TP->y,
+                                 raw->sky->r, raw->sky->d);
 
-			p_psProject (tp, raw->sky, fpa->projection);
-			psPlaneDistortApply (fp, fpa->fromTangentPlane, tp, 0.0, 0.0);
-			psPlaneTransformApply (ch, chip->fromFPA, fp);
+                        psPlane *fp = psPlaneAlloc();
+                        psPlane *tp = psPlaneAlloc();
+                        psPlane *ch = psPlaneAlloc();
 
-			fprintf (stderr, "dn: %f,%f <- %f,%f <- %f,%f <- %f,%f\n", 
-				 ch->x, ch->y, 
-				 fp->x, fp->y, 
-				 tp->x, tp->y, 
-				 raw->sky->r, raw->sky->d);
-		    }
+                        p_psProject (tp, raw->sky, fpa->projection);
+                        psPlaneDistortApply (fp, fpa->fromTangentPlane, tp, 0.0, 0.0);
+                        psPlaneTransformApply (ch, chip->fromFPA, fp);
 
-		    // rationalize ra to sky range centered on boresite
-		    while (raw->sky->r < RAminSky) raw->sky->r += M_PI;
-		    while (raw->sky->r > RAmaxSky) raw->sky->r -= M_PI;
+                        fprintf (stderr, "dn: %f,%f <- %f,%f <- %f,%f <- %f,%f\n",
+                                 ch->x, ch->y,
+                                 fp->x, fp->y,
+                                 tp->x, tp->y,
+                                 raw->sky->r, raw->sky->d);
+                    }
 
-		    RAmin = PS_MIN (raw->sky->r, RAmin);
-		    RAmax = PS_MAX (raw->sky->r, RAmax);
+                    // rationalize ra to sky range centered on boresite
+                    while (raw->sky->r < RAminSky) raw->sky->r += M_PI;
+                    while (raw->sky->r > RAmaxSky) raw->sky->r -= M_PI;
 
-		    DECmin = PS_MIN (raw->sky->d, DECmin);
-		    DECmax = PS_MAX (raw->sky->d, DECmax);
-		}
-	    }
-	}
+                    RAmin = PS_MIN (raw->sky->r, RAmin);
+                    RAmax = PS_MAX (raw->sky->r, RAmax);
+
+                    DECmin = PS_MIN (raw->sky->d, DECmin);
+                    DECmax = PS_MAX (raw->sky->d, DECmax);
+                }
+            }
+        }
     }
 
@@ -119,5 +119,5 @@
     psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", DECmin);
     psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", DECmax);
-    
+
     psFree (view);
     return true;
