Index: trunk/psphot/src/psphotVisual.c
===================================================================
--- trunk/psphot/src/psphotVisual.c	(revision 20251)
+++ trunk/psphot/src/psphotVisual.c	(revision 20450)
@@ -694,4 +694,10 @@
     psImageInit (psfMosaic, 0.0);
     
+    psImage *funMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
+    psImageInit (funMosaic, 0.0);
+
+    psImage *resMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
+    psImageInit (resMosaic, 0.0);
+
     pmModel *modelRef = pmModelAlloc(psf->type);
 
@@ -700,6 +706,6 @@
 	for (int y = -1; y <= +1; y ++) {
 	    // use the center of the center pixel of the image
-	    float xc = (0.5 + 0.45*x)*readout->image->numCols + readout->image->col0;
-	    float yc = (0.5 + 0.45*y)*readout->image->numRows + readout->image->row0;
+	    float xc = (int)((0.5 + 0.45*x)*readout->image->numCols) + readout->image->col0 + 0.5;
+	    float yc = (int)((0.5 + 0.45*y)*readout->image->numRows) + readout->image->row0 + 0.5;
 
 	    // assign the x and y coords to the image center
@@ -718,4 +724,7 @@
 	    // 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);
 	}
@@ -723,7 +732,11 @@
 
     psImage *psfLogFlux = (psImage *) psUnaryOp (NULL, psfMosaic, "log");
-    psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic", 1, -2.0, 3.0);
+    psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic",    0, -2.0, 3.0);
+    psphotVisualRangeImage (kapa2, funMosaic, "psf_analytical", 1, -10.0, 100.0);
+    psphotVisualRangeImage (kapa2, resMosaic, "psf_residual",   2, -10.0, 100.0);
 
     psFree (psfMosaic);
+    psFree (funMosaic);
+    psFree (resMosaic);
     psFree (psfLogFlux);
     psFree (modelRef);
