Index: trunk/psModules/src/objects/pmModel.c
===================================================================
--- trunk/psModules/src/objects/pmModel.c	(revision 15700)
+++ trunk/psModules/src/objects/pmModel.c	(revision 15701)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-11-27 22:23:16 $
+ *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-27 22:45:55 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -231,4 +231,8 @@
         psImage *inRx = model->residuals->Rx;
         psImage *inRy = model->residuals->Ry;
+        xBin = model->residuals->xBin;
+        yBin = model->residuals->yBin;
+        xResidCenter = model->residuals->xCenter;
+        yResidCenter = model->residuals->yCenter;
         if ((image->numCols != inRo->numCols) ||
             (image->numRows != inRo->numRows)) {
@@ -237,6 +241,8 @@
             myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
             // Difference between input and desired centres
-            int xDiff = (int)(inRx->numCols / 2) - (xPos - image->col0);
-            int yDiff = (int)(inRy->numRows / 2) - (yPos - image->row0);
+            int xDiff = (int)(inRo->numCols / 2) - (xPos - image->col0);
+            int yDiff = (int)(inRo->numRows / 2) - (yPos - image->row0);
+            xResidCenter -= xDiff;
+            yResidCenter -= yDiff;
             for (int iy = 0; iy < myRo->numRows; iy++) {
                 int jy = iy + yDiff;
@@ -256,7 +262,7 @@
                         myRy->data.F32[iy][ix] = 0.0;
                     } else {
-                        myRo->data.F32[iy][ix] = inRo->data.F32[jy][jx];
-                        myRx->data.F32[iy][ix] = inRx->data.F32[jy][jx];
-                        myRy->data.F32[iy][ix] = inRy->data.F32[jy][jx];
+                        myRo->data.F32[iy][ix] = 1e10 * inRo->data.F32[jy][jx];
+                        myRx->data.F32[iy][ix] = 1e10 * inRx->data.F32[jy][jx];
+                        myRy->data.F32[iy][ix] = 1e10 * inRy->data.F32[jy][jx];
                     }
                 }
@@ -272,8 +278,4 @@
         Ry = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, myRy, NULL, NULL, 0, 0.0, 0.0, 1, 0, 0.0);
 
-        xBin = model->residuals->xBin;
-        yBin = model->residuals->yBin;
-        xResidCenter = model->residuals->xCenter;
-        yResidCenter = model->residuals->yCenter;
     }
 
