Index: trunk/psphot/src/psphotVisual.c
===================================================================
--- trunk/psphot/src/psphotVisual.c	(revision 21183)
+++ trunk/psphot/src/psphotVisual.c	(revision 21366)
@@ -2,11 +2,11 @@
 
 // this function displays representative images as the psphot analysis progresses:
-// 0 : image, 1 : weight
-// 0 : backsub, 1 : weight, 2 : backgnd
-// 0 : backsub, 1 : weight, 2 : signif
+// 0 : image, 1 : variance
+// 0 : backsub, 1 : variance, 2 : backgnd
+// 0 : backsub, 1 : variance, 2 : signif
 // (overlay peaks on images)
 // (overlay footprints on images)
 // (overlay moments on images)
-// (overlay rough class on images) 
+// (overlay rough class on images)
 // 0 : backsub, 1 : psfpos, 2: psfsub
 // 0 : backsub, 1 : lin_resid, 2: psfsub
@@ -40,6 +40,6 @@
     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
     if (!psImageBackground(stats, NULL, inImage, NULL, 0, rng)) {
-	fprintf (stderr, "failed to get background values\n");
-	return false;
+        fprintf (stderr, "failed to get background values\n");
+        return false;
     }
 
@@ -49,8 +49,8 @@
     ALLOCATE (image.data2d, float *, image.Ny);
     for (int iy = 0; iy < image.Ny; iy++) {
-	ALLOCATE (image.data2d[iy], float, image.Nx);
-	for (int ix = 0; ix < image.Nx; ix++) {
-	    image.data2d[iy][ix] = inImage->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix];
-	}
+        ALLOCATE (image.data2d[iy], float, image.Nx);
+        for (int ix = 0; ix < image.Nx; ix++) {
+            image.data2d[iy][ix] = inImage->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix];
+        }
     }
 
@@ -60,10 +60,10 @@
     data.range = 32;
     data.logflux = 0;
-  
+
     KiiSetChannel (kapaFD, channel);
     KiiNewPicture2D (kapaFD, &image, &data, &coords);
 
     for (int iy = 0; iy < image.Ny; iy++) {
-	free (image.data2d[iy]);
+        free (image.data2d[iy]);
     }
     free (image.data2d);
@@ -86,6 +86,6 @@
     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
     if (!psImageBackground(stats, NULL, inImage, NULL, 0, rng)) {
-	fprintf (stderr, "failed to get background values\n");
-	return false;
+        fprintf (stderr, "failed to get background values\n");
+        return false;
     }
 
@@ -99,5 +99,5 @@
     data.range = 5*stats->robustStdev;
     data.logflux = 0;
-  
+
     KiiSetChannel (kapaFD, channel);
     KiiNewPicture2D (kapaFD, &image, &data, &coords);
@@ -126,5 +126,5 @@
     data.range = max - min;
     data.logflux = 0;
-  
+
     KiiSetChannel (kapaFD, channel);
     KiiNewPicture2D (kapaFD, &image, &data, &coords);
@@ -139,13 +139,13 @@
     if (kapa == -1) {
         kapa = KapaOpenNamedSocket ("kapa", "psphot:images");
-	if (kapa == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     // psphotVisualShowMask (kapa, readout->mask, "mask", 2);
-    psphotVisualScaleImage (kapa, readout->weight, "weight", 1);
+    psphotVisualScaleImage (kapa, readout->variance, "variance", 1);
     psphotVisualScaleImage (kapa, readout->image, "image", 0);
 
@@ -155,5 +155,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -168,10 +168,10 @@
     if (kapa == -1) {
         kapa = KapaOpenNamedSocket ("kapa", "psphot:images");
-	if (kapa == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     bool status = false;
@@ -179,7 +179,7 @@
 
     if (file->mode == PM_FPA_MODE_INTERNAL) {
-	backgnd = file->readout;
+        backgnd = file->readout;
     } else {
-	backgnd = pmFPAviewThisReadout (view, file->fpa);
+        backgnd = pmFPAviewThisReadout (view, file->fpa);
     }
 
@@ -192,5 +192,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -203,10 +203,10 @@
     if (kapa == -1) {
         kapa = KapaOpenNamedSocket ("kapa", "psphot:images");
-	if (kapa == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     // XXX test: image->data.F32[10][10] = 10000;
@@ -218,5 +218,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -227,10 +227,10 @@
     int Noverlay;
     KiiOverlay *overlay;
-  
+
     if (!isVisual) return true;
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -244,34 +244,34 @@
     for (int i = 0; i < peaks->n; i++) {
 
-	pmPeak *peak = peaks->data[i];
-	if (peak == NULL) continue;
-
-	overlay[Noverlay].type = KII_OVERLAY_BOX;
-	overlay[Noverlay].x = peak->xf;
-	overlay[Noverlay].y = peak->yf;
-	overlay[Noverlay].dx = 2.0;
-	overlay[Noverlay].dy = 2.0;
-	overlay[Noverlay].angle = 0.0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
+        pmPeak *peak = peaks->data[i];
+        if (peak == NULL) continue;
+
+        overlay[Noverlay].type = KII_OVERLAY_BOX;
+        overlay[Noverlay].x = peak->xf;
+        overlay[Noverlay].y = peak->yf;
+        overlay[Noverlay].dx = 2.0;
+        overlay[Noverlay].dy = 2.0;
+        overlay[Noverlay].angle = 0.0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
 
 # if (0)
-	overlay[Noverlay].type = KII_OVERLAY_BOX;
-	overlay[Noverlay].x = peak->x;
-	overlay[Noverlay].y = peak->y;
-	overlay[Noverlay].dx = 1.0;
-	overlay[Noverlay].dy = 1.0;
-	overlay[Noverlay].angle = 0.0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
-
-	overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
-	overlay[Noverlay].x = peak->xf;
-	overlay[Noverlay].y = peak->yf;
-	overlay[Noverlay].dx = 2.0;
-	overlay[Noverlay].dy = 2.0;
-	overlay[Noverlay].angle = 0.0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
+        overlay[Noverlay].type = KII_OVERLAY_BOX;
+        overlay[Noverlay].x = peak->x;
+        overlay[Noverlay].y = peak->y;
+        overlay[Noverlay].dx = 1.0;
+        overlay[Noverlay].dy = 1.0;
+        overlay[Noverlay].angle = 0.0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
+
+        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
+        overlay[Noverlay].x = peak->xf;
+        overlay[Noverlay].y = peak->yf;
+        overlay[Noverlay].dx = 2.0;
+        overlay[Noverlay].dy = 2.0;
+        overlay[Noverlay].angle = 0.0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
 # endif
     }
@@ -296,5 +296,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -305,10 +305,10 @@
     int Noverlay;
     KiiOverlay *overlay;
-  
+
     if (!isVisual) return true;
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -323,81 +323,81 @@
     for (int i = 0; i < footprints->n; i++) {
 
-	pmSpan *span = NULL;
-
-	pmFootprint *footprint = footprints->data[i];
-	if (footprint == NULL) continue;
-	if (footprint->spans == NULL) continue;
-	if (footprint->spans->n < 1) continue;
-
-	// draw the top
-	span = footprint->spans->data[0];
-	overlay[Noverlay].type = KII_OVERLAY_LINE;
-	overlay[Noverlay].x = span->x0;
-	overlay[Noverlay].y = span->y;
-	overlay[Noverlay].dx = span->x1 - span->x0;
-	overlay[Noverlay].dy = 0;
-	overlay[Noverlay].angle = 0.0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
-	CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
-
-	int ys = span->y;
-	int x0s = span->x0;
-	int x1s = span->x1;
-
-	// draw the outer span edges
-	for (int j = 1; j < footprint->spans->n; j++) {
-	    pmSpan *span1 = footprint->spans->data[j];
-
-	    int ye = span1->y;
-	    int x0e = span1->x0;
-	    int x1e = span1->x1;
-
-	    // we cannot have two discontinuous spans on the top or bottom, right? (no, probably not right)
-	    // find all of the spans in this row and generate x0e, x01:
-	    for (int k = j + 1; k < footprint->spans->n; k++) {
-		pmSpan *span2 = footprint->spans->data[k];
-		if (span2->y > span1->y) break;
-		x0e = PS_MIN (x0e, span2->x0);
-		x1e = PS_MAX (x1e, span2->x1);
-		j++;
-	    }
-
-	    overlay[Noverlay].type = KII_OVERLAY_LINE;
-	    overlay[Noverlay].x = x0s;
-	    overlay[Noverlay].y = ys;
-	    overlay[Noverlay].dx = x0e - x0s;
-	    overlay[Noverlay].dy = ye - ys;
-	    overlay[Noverlay].angle = 0.0;
-	    overlay[Noverlay].text = NULL;
-	    Noverlay ++;
-	    CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
-
-	    overlay[Noverlay].type = KII_OVERLAY_LINE;
-	    overlay[Noverlay].x = x1s;
-	    overlay[Noverlay].y = ys;
-	    overlay[Noverlay].dx = x1e - x1s;
-	    overlay[Noverlay].dy = ye - ys;
-	    overlay[Noverlay].angle = 0.0;
-	    overlay[Noverlay].text = NULL;
-	    Noverlay ++;
-	    CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
-
-	    ys = ye;
-	    x0s = x0e;
-	    x1s = x1e;
-	}
-
-	// draw the bottom
-	span = footprint->spans->data[footprint->spans->n - 1];
-	overlay[Noverlay].type = KII_OVERLAY_LINE;
-	overlay[Noverlay].x = span->x0;
-	overlay[Noverlay].y = span->y;
-	overlay[Noverlay].dx = span->x1 - span->x0;
-	overlay[Noverlay].dy = 0;
-	overlay[Noverlay].angle = 0.0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
-	CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+        pmSpan *span = NULL;
+
+        pmFootprint *footprint = footprints->data[i];
+        if (footprint == NULL) continue;
+        if (footprint->spans == NULL) continue;
+        if (footprint->spans->n < 1) continue;
+
+        // draw the top
+        span = footprint->spans->data[0];
+        overlay[Noverlay].type = KII_OVERLAY_LINE;
+        overlay[Noverlay].x = span->x0;
+        overlay[Noverlay].y = span->y;
+        overlay[Noverlay].dx = span->x1 - span->x0;
+        overlay[Noverlay].dy = 0;
+        overlay[Noverlay].angle = 0.0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
+        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+
+        int ys = span->y;
+        int x0s = span->x0;
+        int x1s = span->x1;
+
+        // draw the outer span edges
+        for (int j = 1; j < footprint->spans->n; j++) {
+            pmSpan *span1 = footprint->spans->data[j];
+
+            int ye = span1->y;
+            int x0e = span1->x0;
+            int x1e = span1->x1;
+
+            // we cannot have two discontinuous spans on the top or bottom, right? (no, probably not right)
+            // find all of the spans in this row and generate x0e, x01:
+            for (int k = j + 1; k < footprint->spans->n; k++) {
+                pmSpan *span2 = footprint->spans->data[k];
+                if (span2->y > span1->y) break;
+                x0e = PS_MIN (x0e, span2->x0);
+                x1e = PS_MAX (x1e, span2->x1);
+                j++;
+            }
+
+            overlay[Noverlay].type = KII_OVERLAY_LINE;
+            overlay[Noverlay].x = x0s;
+            overlay[Noverlay].y = ys;
+            overlay[Noverlay].dx = x0e - x0s;
+            overlay[Noverlay].dy = ye - ys;
+            overlay[Noverlay].angle = 0.0;
+            overlay[Noverlay].text = NULL;
+            Noverlay ++;
+            CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+
+            overlay[Noverlay].type = KII_OVERLAY_LINE;
+            overlay[Noverlay].x = x1s;
+            overlay[Noverlay].y = ys;
+            overlay[Noverlay].dx = x1e - x1s;
+            overlay[Noverlay].dy = ye - ys;
+            overlay[Noverlay].angle = 0.0;
+            overlay[Noverlay].text = NULL;
+            Noverlay ++;
+            CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+
+            ys = ye;
+            x0s = x0e;
+            x1s = x1e;
+        }
+
+        // draw the bottom
+        span = footprint->spans->data[footprint->spans->n - 1];
+        overlay[Noverlay].type = KII_OVERLAY_LINE;
+        overlay[Noverlay].x = span->x0;
+        overlay[Noverlay].y = span->y;
+        overlay[Noverlay].dx = span->x1 - span->x0;
+        overlay[Noverlay].dy = 0;
+        overlay[Noverlay].angle = 0.0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
+        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
     }
 
@@ -410,5 +410,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -419,5 +419,5 @@
     int Noverlay;
     KiiOverlay *overlay;
-  
+
     psEllipseMoments emoments;
     psEllipseAxes axes;
@@ -426,6 +426,6 @@
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -436,25 +436,25 @@
     for (int i = 0; i < sources->n; i++) {
 
-	pmSource *source = sources->data[i];
-	if (source == NULL) continue;
-
-	pmMoments *moments = source->moments;
-	if (moments == NULL) continue;
-
-	overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
-	overlay[Noverlay].x = moments->Mx;
-	overlay[Noverlay].y = moments->My;
-
-	emoments.x2 = moments->Mxx;
-	emoments.xy = moments->Mxy;
-	emoments.y2 = moments->Myy;
-
-	axes = psEllipseMomentsToAxes (emoments, 20.0);
-
-	overlay[Noverlay].dx = 2.0*axes.major;
-	overlay[Noverlay].dy = 2.0*axes.minor;
-	overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;  // XXXXXXXX the axes angle is negative to display of object on kapa
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
+        pmSource *source = sources->data[i];
+        if (source == NULL) continue;
+
+        pmMoments *moments = source->moments;
+        if (moments == NULL) continue;
+
+        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
+        overlay[Noverlay].x = moments->Mx;
+        overlay[Noverlay].y = moments->My;
+
+        emoments.x2 = moments->Mxx;
+        emoments.xy = moments->Mxy;
+        emoments.y2 = moments->Myy;
+
+        axes = psEllipseMomentsToAxes (emoments, 20.0);
+
+        overlay[Noverlay].dx = 2.0*axes.major;
+        overlay[Noverlay].dy = 2.0*axes.minor;
+        overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;  // XXXXXXXX the axes angle is negative to display of object on kapa
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
     }
 
@@ -467,5 +467,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
 
@@ -482,10 +482,10 @@
     if (kapa3 == -1) {
         kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
-	if (kapa3 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa3 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     KapaClearPlots (kapa3);
@@ -494,5 +494,5 @@
     // there are N regions: use the first (guaranteed to exist) to get the overall limits
     psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, "PSF.CLUMP.REGION.000");
-    
+
     float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
     float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
@@ -558,42 +558,42 @@
 
     // XXX draw N circles to outline the clumps
-    { 
-	// draw a circle centered on psfX,Y with size of the psf limit
-	psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
-	psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
-
-	int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS");
-	float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
-
-	graphdata.color = KapaColorByName ("blue");
-	graphdata.style = 0;
-
-	for (int n = 0; n < nRegions; n++) {
-
-	    char regionName[64];
-	    snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", n);
-	    psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, regionName);
-    
-	    float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
-	    float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
-	    float psfdX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DX");
-	    float psfdY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DY");
-	    float Rx = psfdX * PSF_CLUMP_NSIGMA;
-	    float Ry = psfdY * PSF_CLUMP_NSIGMA;
-
-	    for (int i = 0; i < xLimit->n; i++) {
-		xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
-		yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
-	    }
-	    KapaPrepPlot (kapa3, xLimit->n, &graphdata);
-	    KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
-	    KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
-	}
-	psFree (xLimit);
-	psFree (yLimit);
+    {
+        // draw a circle centered on psfX,Y with size of the psf limit
+        psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
+        psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
+
+        int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS");
+        float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
+
+        graphdata.color = KapaColorByName ("blue");
+        graphdata.style = 0;
+
+        for (int n = 0; n < nRegions; n++) {
+
+            char regionName[64];
+            snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", n);
+            psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, regionName);
+
+            float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
+            float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
+            float psfdX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DX");
+            float psfdY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DY");
+            float Rx = psfdX * PSF_CLUMP_NSIGMA;
+            float Ry = psfdY * PSF_CLUMP_NSIGMA;
+
+            for (int i = 0; i < xLimit->n; i++) {
+                xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
+                yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
+            }
+            KapaPrepPlot (kapa3, xLimit->n, &graphdata);
+            KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
+            KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
+        }
+        psFree (xLimit);
+        psFree (yLimit);
     }
 
 # if (0)
-    // *** make a histogram of the source counts in the x and y directions 
+    // *** make a histogram of the source counts in the x and y directions
     psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0);
     psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0);
@@ -605,10 +605,10 @@
     psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);
     for (int i = 0; i < nX->nums->n; i++) {
-	dX->data.F32[i] = nX->nums->data.S32[i];
-	vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]);
+        dX->data.F32[i] = nX->nums->data.S32[i];
+        vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]);
     }
     for (int i = 0; i < nY->nums->n; i++) {
-	dY->data.F32[i] = nY->nums->data.S32[i];
-	vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]);
+        dY->data.F32[i] = nY->nums->data.S32[i];
+        vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]);
     }
 
@@ -640,5 +640,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -650,5 +650,5 @@
     int Noverlay;
     KiiOverlay *overlay;
-  
+
     psEllipseMoments emoments;
     psEllipseAxes axes;
@@ -660,28 +660,28 @@
     for (int i = 0; i < sources->n; i++) {
 
-	pmSource *source = sources->data[i];
-	if (source == NULL) continue;
-
-	if (source->type != type) continue;
-	if (mode && !(source->mode & mode)) continue;
-
-	pmMoments *moments = source->moments;
-	if (moments == NULL) continue;
-
-	overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
-	overlay[Noverlay].x = moments->Mx;
-	overlay[Noverlay].y = moments->My;
-
-	emoments.x2 = moments->Mxx;
-	emoments.y2 = moments->Myy;
-	emoments.xy = moments->Mxy;
-
-	axes = psEllipseMomentsToAxes (emoments, 20.0);
-
-	overlay[Noverlay].dx = 2.0*axes.major;
-	overlay[Noverlay].dy = 2.0*axes.minor;
-	overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
+        pmSource *source = sources->data[i];
+        if (source == NULL) continue;
+
+        if (source->type != type) continue;
+        if (mode && !(source->mode & mode)) continue;
+
+        pmMoments *moments = source->moments;
+        if (moments == NULL) continue;
+
+        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
+        overlay[Noverlay].x = moments->Mx;
+        overlay[Noverlay].y = moments->My;
+
+        emoments.x2 = moments->Mxx;
+        emoments.y2 = moments->Myy;
+        emoments.xy = moments->Mxy;
+
+        axes = psEllipseMomentsToAxes (emoments, 20.0);
+
+        overlay[Noverlay].dx = 2.0*axes.major;
+        overlay[Noverlay].dy = 2.0*axes.minor;
+        overlay[Noverlay].angle = -axes.theta * PS_DEG_RAD;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
     }
 
@@ -697,6 +697,6 @@
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -716,5 +716,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -727,10 +727,10 @@
     if (kapa2 == -1) {
         kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
-	if (kapa2 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa2 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     int DX = 64;
@@ -739,5 +739,5 @@
     psImage *psfMosaic = psImageAlloc (5*DX, 5*DY, PS_TYPE_F32);
     psImageInit (psfMosaic, 0.0);
-    
+
     psImage *funMosaic = psImageAlloc (5*DX, 5*DY, PS_TYPE_F32);
     psImageInit (funMosaic, 0.0);
@@ -750,28 +750,28 @@
     // generate a fake model at each of the 3x3 image grid positions
     for (int x = -2; x <= +2; x ++) {
-	for (int y = -2; y <= +2; y ++) {
-	    // use the center of the center pixel of the image
-	    float xc = (int)((0.5 + 0.225*x)*readout->image->numCols) + readout->image->col0 + 0.5;
-	    float yc = (int)((0.5 + 0.225*y)*readout->image->numRows) + readout->image->row0 + 0.5;
-
-	    // assign the x and y coords to the image center
-	    // create an object with center intensity of 1000
-	    modelRef->params->data.F32[PM_PAR_SKY] = 0;
-	    modelRef->params->data.F32[PM_PAR_I0] = 1000;
-	    modelRef->params->data.F32[PM_PAR_XPOS] = xc;
-	    modelRef->params->data.F32[PM_PAR_YPOS] = yc;
-    
-	    // create modelPSF from this model
-	    pmModel *model = pmModelFromPSF (modelRef, psf);
-	    if (!model) continue;
-
-	    // place the reference object in the image center
-	    // no need to mask the source here
-	    // XXX should we measure this for the analytical model only or the full model?
-	    pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
-	    pmModelAddWithOffset (funMosaic, NULL, model, PM_MODEL_OP_FUNC | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
-	    pmModelAddWithOffset (resMosaic, NULL, model, PM_MODEL_OP_RES0 | PM_MODEL_OP_RES1 | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
-	    psFree (model);
-	}
+        for (int y = -2; y <= +2; y ++) {
+            // use the center of the center pixel of the image
+            float xc = (int)((0.5 + 0.225*x)*readout->image->numCols) + readout->image->col0 + 0.5;
+            float yc = (int)((0.5 + 0.225*y)*readout->image->numRows) + readout->image->row0 + 0.5;
+
+            // assign the x and y coords to the image center
+            // create an object with center intensity of 1000
+            modelRef->params->data.F32[PM_PAR_SKY] = 0;
+            modelRef->params->data.F32[PM_PAR_I0] = 1000;
+            modelRef->params->data.F32[PM_PAR_XPOS] = xc;
+            modelRef->params->data.F32[PM_PAR_YPOS] = yc;
+
+            // create modelPSF from this model
+            pmModel *model = pmModelFromPSF (modelRef, psf);
+            if (!model) continue;
+
+            // place the reference object in the image center
+            // no need to mask the source here
+            // XXX should we measure this for the analytical model only or the full model?
+            pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
+            pmModelAddWithOffset (funMosaic, NULL, model, PM_MODEL_OP_FUNC | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
+            pmModelAddWithOffset (resMosaic, NULL, model, PM_MODEL_OP_RES0 | PM_MODEL_OP_RES1 | PM_MODEL_OP_CENTER, 0, x*DX, y*DY);
+            psFree (model);
+        }
     }
 
@@ -792,5 +792,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -805,10 +805,10 @@
     if (kapa2 == -1) {
         kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
-	if (kapa2 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa2 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -827,8 +827,8 @@
 
     // counters to track the size of the image and area used in a row
-    int dX = 0;				// starting corner of next box
-    int dY = 0;				// height of row so far
-    int NX = 20*DX;			// full width of output image
-    int NY = 0;				// total height of output image
+    int dX = 0;                         // starting corner of next box
+    int dY = 0;                         // height of row so far
+    int NX = 20*DX;                     // full width of output image
+    int NY = 0;                         // total height of output image
 
     // first, examine the PSF stars:
@@ -838,30 +838,30 @@
         pmSource *source = sources->data[i];
 
-	bool keep = false;
+        bool keep = false;
         keep |= (source->mode & PM_SOURCE_MODE_PSFSTAR);
-	if (!keep) continue;
-
-	// how does this subimage get placed into the output image?
-	// DX = source->pixels->numCols
-	// DY = source->pixels->numRows
-
-	if (dX + DX > NX) {
-	    // too wide for the rest of this row
-	    if (dX == 0) {
-		// alone on this row
-		NY += DY;
-		dX = 0;
-		dY = 0;
-	    } else {
-		// start the next row
-		NY += dY;
-		dX = DX;
-		dY = DY;
-	    }
-	} else {
-	    // extend this row
-	    dX += DX;
-	    dY = PS_MAX (dY, DY);
-	}
+        if (!keep) continue;
+
+        // how does this subimage get placed into the output image?
+        // DX = source->pixels->numCols
+        // DY = source->pixels->numRows
+
+        if (dX + DX > NX) {
+            // too wide for the rest of this row
+            if (dX == 0) {
+                // alone on this row
+                NY += DY;
+                dX = 0;
+                dY = 0;
+            } else {
+                // start the next row
+                NY += dY;
+                dX = DX;
+                dY = DY;
+            }
+        } else {
+            // extend this row
+            dX += DX;
+            dY = PS_MAX (dY, DY);
+        }
     }
     NY += DY;
@@ -873,7 +873,7 @@
     psImageInit (outsub, 0.0);
 
-    int Xo = 0;				// starting corner of next box
-    int Yo = 0;				// starting corner of next box
-    dY = 0;				// height of row so far
+    int Xo = 0;                         // starting corner of next box
+    int Yo = 0;                         // starting corner of next box
+    dY = 0;                             // height of row so far
 
     int nPSF = 0;
@@ -885,52 +885,52 @@
         pmSource *source = sources->data[i];
 
-	bool keep = false;
+        bool keep = false;
         if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
-	    nPSF ++;
-	    keep = true;
-	}
-	if (!keep) continue;
-
-	if (Xo + DX > NX) {
-	    // too wide for the rest of this row
-	    if (Xo == 0) {
-		// place source alone on this row
-		psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-		psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
-
-		psphotSubWithTest (source, false, maskVal); // remove source (force)
-		psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
-		psphotSetState (source, false, maskVal); // reset source Add/Sub state to recorded
-
-		Yo += DY;
-		Xo = 0;
-		dY = 0;
-	    } else {
-		// start the next row
-		Yo += dY;
-		Xo = 0;
-
-		psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-		psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
-
-		psphotSubWithTest (source, false, maskVal); // remove source (force)
-		psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
-		psphotSetState (source, false, maskVal); // replace source (has been subtracted)
-
-		Xo = DX;
-		dY = DY;
-	    }
-	} else {
-	    // extend this row
-	    psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-	    psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
-
-	    psphotSubWithTest (source, false, maskVal); // remove source (force)
-	    psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
-	    psphotSetState (source, false, maskVal); // replace source (has been subtracted)
-
-	    Xo += DX;
-	    dY = PS_MAX (dY, DY);
-	}
+            nPSF ++;
+            keep = true;
+        }
+        if (!keep) continue;
+
+        if (Xo + DX > NX) {
+            // too wide for the rest of this row
+            if (Xo == 0) {
+                // place source alone on this row
+                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
+
+                psphotSubWithTest (source, false, maskVal); // remove source (force)
+                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
+                psphotSetState (source, false, maskVal); // reset source Add/Sub state to recorded
+
+                Yo += DY;
+                Xo = 0;
+                dY = 0;
+            } else {
+                // start the next row
+                Yo += dY;
+                Xo = 0;
+
+                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
+
+                psphotSubWithTest (source, false, maskVal); // remove source (force)
+                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
+                psphotSetState (source, false, maskVal); // replace source (has been subtracted)
+
+                Xo = DX;
+                dY = DY;
+            }
+        } else {
+            // extend this row
+            psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+            psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true);
+
+            psphotSubWithTest (source, false, maskVal); // remove source (force)
+            psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true);
+            psphotSetState (source, false, maskVal); // replace source (has been subtracted)
+
+            Xo += DX;
+            dY = PS_MAX (dY, DY);
+        }
     }
 
@@ -943,5 +943,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
 
@@ -965,10 +965,10 @@
     if (kapa2 == -1) {
         kapa2 = KapaOpenNamedSocket ("kapa", "psphot:images");
-	if (kapa2 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa2 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -987,8 +987,8 @@
 
     // counters to track the size of the image and area used in a row
-    int dX = 0;				// starting corner of next box
-    int dY = 0;				// height of row so far
-    int NX = 10*DX;			// full width of output image
-    int NY = 0;				// total height of output image
+    int dX = 0;                         // starting corner of next box
+    int dY = 0;                         // height of row so far
+    int NX = 10*DX;                     // full width of output image
+    int NY = 0;                         // total height of output image
 
     // first, examine the PSF and SAT stars:
@@ -998,30 +998,30 @@
         pmSource *source = sources->data[i];
 
-	bool keep = false;
+        bool keep = false;
         keep |= (source->mode & PM_SOURCE_MODE_SATSTAR);
-	if (!keep) continue;
-
-	// how does this subimage get placed into the output image?
-	// DX = source->pixels->numCols
-	// DY = source->pixels->numRows
-
-	if (dX + DX > NX) {
-	    // too wide for the rest of this row
-	    if (dX == 0) {
-		// alone on this row
-		NY += DY;
-		dX = 0;
-		dY = 0;
-	    } else {
-		// start the next row
-		NY += dY;
-		dX = DX;
-		dY = DY;
-	    }
-	} else {
-	    // extend this row
-	    dX += DX;
-	    dY = PS_MAX (dY, DY);
-	}
+        if (!keep) continue;
+
+        // how does this subimage get placed into the output image?
+        // DX = source->pixels->numCols
+        // DY = source->pixels->numRows
+
+        if (dX + DX > NX) {
+            // too wide for the rest of this row
+            if (dX == 0) {
+                // alone on this row
+                NY += DY;
+                dX = 0;
+                dY = 0;
+            } else {
+                // start the next row
+                NY += dY;
+                dX = DX;
+                dY = DY;
+            }
+        } else {
+            // extend this row
+            dX += DX;
+            dY = PS_MAX (dY, DY);
+        }
     }
     NY += DY;
@@ -1031,7 +1031,7 @@
     psImageInit (outsat, 0.0);
 
-    int Xo = 0;				// starting corner of next box
-    int Yo = 0;				// starting corner of next box
-    dY = 0;				// height of row so far
+    int Xo = 0;                         // starting corner of next box
+    int Yo = 0;                         // starting corner of next box
+    dY = 0;                             // height of row so far
 
     int nSAT = 0;
@@ -1043,42 +1043,42 @@
         pmSource *source = sources->data[i];
 
-	bool keep = false;
+        bool keep = false;
         if (source->mode & PM_SOURCE_MODE_SATSTAR) {
-	    nSAT ++;
-	    keep = true;
-	}	    
-	if (!keep) continue;
-
-	if (Xo + DX > NX) {
-	    // too wide for the rest of this row
-	    if (Xo == 0) {
-		// place source alone on this row
-		psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-		psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
-		psphotSetState (source, true, maskVal); // reset source Add/Sub state to recorded
-
-		Yo += DY;
-		Xo = 0;
-		dY = 0;
-	    } else {
-		// start the next row
-		Yo += dY;
-		Xo = 0;
-		psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-		psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
-		psphotSetState (source, true, maskVal); // replace source (has been subtracted)
-
-		Xo = DX;
-		dY = DY;
-	    }
-	} else {
-	    // extend this row
-	    psphotAddWithTest (source, true, maskVal); // replace source if subtracted
-	    psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
-	    psphotSetState (source, true, maskVal); // replace source (has been subtracted)
-
-	    Xo += DX;
-	    dY = PS_MAX (dY, DY);
-	}
+            nSAT ++;
+            keep = true;
+        }
+        if (!keep) continue;
+
+        if (Xo + DX > NX) {
+            // too wide for the rest of this row
+            if (Xo == 0) {
+                // place source alone on this row
+                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+                psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
+                psphotSetState (source, true, maskVal); // reset source Add/Sub state to recorded
+
+                Yo += DY;
+                Xo = 0;
+                dY = 0;
+            } else {
+                // start the next row
+                Yo += dY;
+                Xo = 0;
+                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+                psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
+                psphotSetState (source, true, maskVal); // replace source (has been subtracted)
+
+                Xo = DX;
+                dY = DY;
+            }
+        } else {
+            // extend this row
+            psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+            psphotMosaicSubimage (outsat, source, Xo, Yo, DX, DY, false);
+            psphotSetState (source, true, maskVal); // replace source (has been subtracted)
+
+            Xo += DX;
+            dY = PS_MAX (dY, DY);
+        }
     }
 
@@ -1090,5 +1090,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
 
@@ -1117,23 +1117,23 @@
     float Yo = source->modelPSF->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
     for (int iy = 0; iy < source->pixels->numRows; iy++) {
-	for (int ix = 0; ix < source->pixels->numCols; ix++) {
-	    if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) {
-		// rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
-		rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
-		Rb->data.F32[nb] = log10(rb->data.F32[nb]);
-		fb->data.F32[nb] = log10(source->pixels->data.F32[iy][ix]);
-		nb++;
-	    } else {
-		// rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
-		rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
-		Rg->data.F32[ng] = log10(rg->data.F32[ng]);
-		fg->data.F32[ng] = log10(source->pixels->data.F32[iy][ix]);
-		ng++;
-	    }
-	}
-    }
-  
+        for (int ix = 0; ix < source->pixels->numCols; ix++) {
+            if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) {
+                // rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+                rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
+                Rb->data.F32[nb] = log10(rb->data.F32[nb]);
+                fb->data.F32[nb] = log10(source->pixels->data.F32[iy][ix]);
+                nb++;
+            } else {
+                // rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+                rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
+                Rg->data.F32[ng] = log10(rg->data.F32[ng]);
+                fg->data.F32[ng] = log10(source->pixels->data.F32[iy][ix]);
+                ng++;
+            }
+        }
+    }
+
     // reset source Add/Sub state to recorded
-    psphotSetState (source, state, maskVal); 
+    psphotSetState (source, state, maskVal);
 
     KapaInitGraph (&graphdata);
@@ -1148,10 +1148,10 @@
     graphdata.ymax = +5.05;
     KapaSetLimits (myKapa, &graphdata);
-  
+
     KapaSetFont (myKapa, "helvetica", 14);
     KapaBox (myKapa, &graphdata);
     KapaSendLabel (myKapa, "radius (pixels)", KAPA_LABEL_XM);
     KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
-	       
+
     graphdata.color = KapaColorByName ("black");
     graphdata.ptype = 2;
@@ -1169,5 +1169,5 @@
     KapaPlotVector (myKapa, nb, rb->data.F32, "x");
     KapaPlotVector (myKapa, nb, fb->data.F32, "y");
-  
+
     // ** loglog **
     KapaSelectSection (myKapa, "loglog");
@@ -1179,10 +1179,10 @@
     graphdata.ymax = +5.05;
     KapaSetLimits (myKapa, &graphdata);
-  
+
     KapaSetFont (myKapa, "helvetica", 14);
     KapaBox (myKapa, &graphdata);
     KapaSendLabel (myKapa, "log radius (pixels)", KAPA_LABEL_XM);
     KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
-	       
+
     graphdata.color = KapaColorByName ("black");
     graphdata.ptype = 2;
@@ -1212,5 +1212,5 @@
 bool psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources) {
 
-    KapaSection section;  // put the positive profile in one and the residuals in another? 
+    KapaSection section;  // put the positive profile in one and the residuals in another?
 
     if (!isVisual) return true;
@@ -1218,10 +1218,10 @@
     if (kapa3 == -1) {
         kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
-	if (kapa3 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa3 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -1257,20 +1257,20 @@
         if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
 
-	psphotVisualPlotRadialProfile (kapa3, source, maskVal);
-
-	// pause and wait for user input:
-	// continue, save (provide name), ??
-	char key[10];
-	fprintf (stdout, "[e]rase and continue? [o]verplot and continue? [s]kip rest of stars? : ");
-	if (!fgets(key, 8, stdin)) {
-	    psWarning("Unable to read option");
-	}
-	if (key[0] == 'e') {
-	    KapaClearPlots (kapa3);
-	}
-	if (key[0] == 's') {
-	    break;
-	}
-    }	    
+        psphotVisualPlotRadialProfile (kapa3, source, maskVal);
+
+        // pause and wait for user input:
+        // continue, save (provide name), ??
+        char key[10];
+        fprintf (stdout, "[e]rase and continue? [o]verplot and continue? [s]kip rest of stars? : ");
+        if (!fgets(key, 8, stdin)) {
+            psWarning("Unable to read option");
+        }
+        if (key[0] == 'e') {
+            KapaClearPlots (kapa3);
+        }
+        if (key[0] == 's') {
+            break;
+        }
+    }
 
     return true;
@@ -1282,5 +1282,5 @@
     int NoverlayO, NOVERLAYO;
     KiiOverlay *overlayE, *overlayO;
-  
+
     psEllipseMoments emoments;
     psEllipseAxes axes;
@@ -1289,6 +1289,6 @@
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -1304,62 +1304,62 @@
     for (int i = 0; i < sources->n; i++) {
 
-	float Xo, Yo, Rmaj, Rmin, cs, sn;
-
-	pmSource *source = sources->data[i];
-	if (source == NULL) continue;
-
-	pmMoments *moments = source->moments;
-	if (0) { 
-	    emoments.x2 = moments->Mxx;
-	    emoments.y2 = moments->Myy;
-	    emoments.xy = moments->Mxy;
-	    Xo = moments->Mx;
-	    Yo = moments->My;
-
-	    axes = psEllipseMomentsToAxes (emoments, 20.0);
-	    Rmaj = 2.0*axes.major;
-	    Rmin = 2.0*axes.minor;
-	    cs = cos(axes.theta);
-	    sn = sin(axes.theta);
-	} else {
-	    Rmaj = Rmin = 5.0;
-	    cs = 1.0;
-	    sn = 0.0;
-	    Xo = source->peak->xf;
-	    Yo = source->peak->yf;
-	}
-
-	unsigned short int flagMask = 0x01;
-	for (int j = 0; j < 8; j++) {
-	    if (source->mode & flagMask) {
-		overlayE[NoverlayE].type = KII_OVERLAY_LINE;
-		overlayE[NoverlayE].x = Xo;
-		overlayE[NoverlayE].y = Yo;
-
-		float phi = j*M_PI/4.0;
-		overlayE[NoverlayE].dx = +Rmaj*cos(phi)*cs - Rmin*sin(phi)*sn;
-		overlayE[NoverlayE].dy = +Rmaj*cos(phi)*sn + Rmin*sin(phi)*cs;
-		overlayE[NoverlayE].angle = 0;
-		overlayE[NoverlayE].text = NULL;
-		NoverlayE ++;
-		CHECK_REALLOCATE (overlayE, KiiOverlay, NOVERLAYE, NoverlayE, 100);
-	    }
-	    flagMask <<= 1;
-
-	    if (source->mode & flagMask) {
-		overlayO[NoverlayO].type = KII_OVERLAY_LINE;
-		overlayO[NoverlayO].x = Xo + 1;
-		overlayO[NoverlayO].y = Yo;
-
-		float phi = j*M_PI/4.0;
-		overlayO[NoverlayO].dx = +Rmaj*cos(phi)*cs - Rmin*sin(phi)*sn;
-		overlayO[NoverlayO].dy = +Rmaj*cos(phi)*sn + Rmin*sin(phi)*cs;
-		overlayO[NoverlayO].angle = 0;
-		overlayO[NoverlayO].text = NULL;
-		NoverlayO ++;
-		CHECK_REALLOCATE (overlayO, KiiOverlay, NOVERLAYO, NoverlayO, 100);
-	    }
-	    flagMask <<= 1;
-	}
+        float Xo, Yo, Rmaj, Rmin, cs, sn;
+
+        pmSource *source = sources->data[i];
+        if (source == NULL) continue;
+
+        pmMoments *moments = source->moments;
+        if (0) {
+            emoments.x2 = moments->Mxx;
+            emoments.y2 = moments->Myy;
+            emoments.xy = moments->Mxy;
+            Xo = moments->Mx;
+            Yo = moments->My;
+
+            axes = psEllipseMomentsToAxes (emoments, 20.0);
+            Rmaj = 2.0*axes.major;
+            Rmin = 2.0*axes.minor;
+            cs = cos(axes.theta);
+            sn = sin(axes.theta);
+        } else {
+            Rmaj = Rmin = 5.0;
+            cs = 1.0;
+            sn = 0.0;
+            Xo = source->peak->xf;
+            Yo = source->peak->yf;
+        }
+
+        unsigned short int flagMask = 0x01;
+        for (int j = 0; j < 8; j++) {
+            if (source->mode & flagMask) {
+                overlayE[NoverlayE].type = KII_OVERLAY_LINE;
+                overlayE[NoverlayE].x = Xo;
+                overlayE[NoverlayE].y = Yo;
+
+                float phi = j*M_PI/4.0;
+                overlayE[NoverlayE].dx = +Rmaj*cos(phi)*cs - Rmin*sin(phi)*sn;
+                overlayE[NoverlayE].dy = +Rmaj*cos(phi)*sn + Rmin*sin(phi)*cs;
+                overlayE[NoverlayE].angle = 0;
+                overlayE[NoverlayE].text = NULL;
+                NoverlayE ++;
+                CHECK_REALLOCATE (overlayE, KiiOverlay, NOVERLAYE, NoverlayE, 100);
+            }
+            flagMask <<= 1;
+
+            if (source->mode & flagMask) {
+                overlayO[NoverlayO].type = KII_OVERLAY_LINE;
+                overlayO[NoverlayO].x = Xo + 1;
+                overlayO[NoverlayO].y = Yo;
+
+                float phi = j*M_PI/4.0;
+                overlayO[NoverlayO].dx = +Rmaj*cos(phi)*cs - Rmin*sin(phi)*sn;
+                overlayO[NoverlayO].dy = +Rmaj*cos(phi)*sn + Rmin*sin(phi)*cs;
+                overlayO[NoverlayO].angle = 0;
+                overlayO[NoverlayO].text = NULL;
+                NoverlayO ++;
+                CHECK_REALLOCATE (overlayO, KiiOverlay, NOVERLAYO, NoverlayO, 100);
+            }
+            flagMask <<= 1;
+        }
     }
 
@@ -1376,5 +1376,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
 
@@ -1390,6 +1390,6 @@
 
     if (kapa == -1) {
-	fprintf (stderr, "kapa not opened, skipping\n");
-	return false;
+        fprintf (stderr, "kapa not opened, skipping\n");
+        return false;
     }
 
@@ -1402,19 +1402,19 @@
     for (int i = 0; i < sources->n; i++) {
 
-	pmSource *source = sources->data[i];
-	if (source == NULL) continue;
-
-	if (!(source->mode & PM_SOURCE_MODE_CR_LIMIT)) continue;
-
-	overlay[Noverlay].type = KII_OVERLAY_BOX;
-	overlay[Noverlay].x = source->peak->xf;
-	overlay[Noverlay].y = source->peak->yf;
-
-	overlay[Noverlay].dx = 4;
-	overlay[Noverlay].dy = 4;
-	overlay[Noverlay].angle = 0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
-	CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+        pmSource *source = sources->data[i];
+        if (source == NULL) continue;
+
+        if (!(source->mode & PM_SOURCE_MODE_CR_LIMIT)) continue;
+
+        overlay[Noverlay].type = KII_OVERLAY_BOX;
+        overlay[Noverlay].x = source->peak->xf;
+        overlay[Noverlay].y = source->peak->yf;
+
+        overlay[Noverlay].dx = 4;
+        overlay[Noverlay].dy = 4;
+        overlay[Noverlay].angle = 0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
+        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
     }
     KiiLoadOverlay (kapa, overlay, Noverlay, "red");
@@ -1424,20 +1424,20 @@
     for (int i = 0; i < sources->n; i++) {
 
-	pmSource *source = sources->data[i];
-	if (source == NULL) continue;
-
-	// mark EXTs with yellow circles
-	if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;
-
-	overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
-	overlay[Noverlay].x = source->peak->xf;
-	overlay[Noverlay].y = source->peak->yf;
-
-	overlay[Noverlay].dx = 10;
-	overlay[Noverlay].dy = 10;
-	overlay[Noverlay].angle = 0;
-	overlay[Noverlay].text = NULL;
-	Noverlay ++;
-	CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
+        pmSource *source = sources->data[i];
+        if (source == NULL) continue;
+
+        // mark EXTs with yellow circles
+        if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;
+
+        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
+        overlay[Noverlay].x = source->peak->xf;
+        overlay[Noverlay].y = source->peak->yf;
+
+        overlay[Noverlay].dx = 10;
+        overlay[Noverlay].dy = 10;
+        overlay[Noverlay].angle = 0;
+        overlay[Noverlay].text = NULL;
+        Noverlay ++;
+        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
     }
 
@@ -1453,5 +1453,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
 
@@ -1468,10 +1468,10 @@
     if (kapa3 == -1) {
         kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
-	if (kapa3 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa3 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     KapaClearPlots (kapa3);
@@ -1500,7 +1500,7 @@
     for (int i = 0; i < sources->n; i++) {
         pmSource *source = sources->data[i];
-	if (!source) continue;
+        if (!source) continue;
         if (source->type != PM_SOURCE_TYPE_STAR) continue;
-	if (!isfinite (source->crNsigma)) continue;
+        if (!isfinite (source->crNsigma)) continue;
 
         x->data.F32[n] = -2.5*log10(source->peak->flux);
@@ -1555,7 +1555,7 @@
     for (int i = 0; i < sources->n; i++) {
         pmSource *source = sources->data[i];
-	if (!source) continue;
+        if (!source) continue;
         if (source->type != PM_SOURCE_TYPE_STAR) continue;
-	if (!isfinite (source->extNsigma)) continue;
+        if (!isfinite (source->extNsigma)) continue;
 
         x->data.F32[n] = -2.5*log10(source->peak->flux);
@@ -1597,5 +1597,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -1608,10 +1608,10 @@
     if (kapa == -1) {
         kapa = KapaOpenNamedSocket ("kapa", "psphot:images");
-	if (kapa == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     psphotVisualScaleImage (kapa, readout->image, "resid", 1);
@@ -1622,5 +1622,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
@@ -1635,10 +1635,10 @@
     if (kapa3 == -1) {
         kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
-	if (kapa3 == -1) {
-	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
-	    isVisual = false;
-	    return false;
-	}
-    }  
+        if (kapa3 == -1) {
+            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+            isVisual = false;
+            return false;
+        }
+    }
 
     KapaClearPlots (kapa3);
@@ -1657,8 +1657,8 @@
     for (int i = 0; i < sources->n; i++) {
         pmSource *source = sources->data[i];
-	if (!source) continue;
+        if (!source) continue;
         if (source->type != PM_SOURCE_TYPE_STAR) continue;
-	if (!isfinite (source->apMag)) continue;
-	if (!isfinite (source->psfMag)) continue;
+        if (!isfinite (source->apMag)) continue;
+        if (!isfinite (source->psfMag)) continue;
 
         x->data.F32[n] = source->psfMag;
@@ -1705,5 +1705,5 @@
     fprintf (stdout, "[c]ontinue? ");
     if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
+        psWarning("Unable to read option");
     }
     return true;
