Index: trunk/psModules/src/objects/pmModel.c
===================================================================
--- trunk/psModules/src/objects/pmModel.c	(revision 15698)
+++ trunk/psModules/src/objects/pmModel.c	(revision 15699)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-11-11 21:49:18 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-27 21:16:45 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -57,4 +57,5 @@
     tmp->type = type;
     tmp->chisq = 0.0;
+    tmp->chisqNorm = 0.0;
     tmp->nDOF  = 0;
     tmp->nIter = 0;
@@ -76,8 +77,8 @@
     }
 
-    tmp->modelFunc   	    = class->modelFunc;
-    tmp->modelFlux   	    = class->modelFlux;
-    tmp->modelRadius 	    = class->modelRadius;
-    tmp->modelLimits 	    = class->modelLimits;
+    tmp->modelFunc          = class->modelFunc;
+    tmp->modelFlux          = class->modelFlux;
+    tmp->modelRadius        = class->modelRadius;
+    tmp->modelLimits        = class->modelLimits;
     tmp->modelGuess         = class->modelGuess;
     tmp->modelFromPSF       = class->modelFromPSF;
@@ -172,6 +173,6 @@
                           bool add,
                           psMaskType maskVal,
-			  int dx,
-			  int dy
+                          int dx,
+                          int dy
     )
 {
@@ -225,44 +226,44 @@
     psImageInterpolateOptions *Ry = NULL;
     if (model->residuals && (mode & (PM_MODEL_OP_RES0 | PM_MODEL_OP_RES1))) {
-	// if the residual image and object image don't match, 
-	// supply an appropriately overlapped residual image
-	psImage *inRo = model->residuals->Ro;
-	psImage *inRx = model->residuals->Rx;
-	psImage *inRy = model->residuals->Ry;
-	if ((image->numCols != inRo->numCols) || 
-	    (image->numRows != inRo->numRows)) {
-	    myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
-	    myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
-	    myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
-	    dx = (int)(inRx->numCols / 2) - (xPos - image->col0); 
-	    dy = (int)(inRx->numCols / 2) - (xPos - image->col0); 
-	    for (int iy = 0; iy < myRo->numRows; iy++) {
-		int jy = iy + dy;
-		if ((jy < 0) || (jy >= inRo->numRows)) {
-		    for (int ix = 0; ix < myRo->numCols; ix++) {
-			myRo->data.F32[iy][ix] = 0.0;
-			myRx->data.F32[iy][ix] = 0.0;
-			myRy->data.F32[iy][ix] = 0.0;
-		    }
-		    continue;
-		}
-		for (int ix = 0; ix < myRo->numCols; ix++) {
-		    int jx = ix + dx;
-		    if ((jx < 0) || (jx >= inRo->numCols)) {
-			myRo->data.F32[iy][ix] = 0.0;
-			myRx->data.F32[iy][ix] = 0.0;
-			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];
-		    }
-		}
-	    }		
-	} else {
-	    myRo = psMemIncrRefCounter (inRo);
-	    myRx = psMemIncrRefCounter (inRx);
-	    myRy = psMemIncrRefCounter (inRy);
-	}
+        // if the residual image and object image don't match,
+        // supply an appropriately overlapped residual image
+        psImage *inRo = model->residuals->Ro;
+        psImage *inRx = model->residuals->Rx;
+        psImage *inRy = model->residuals->Ry;
+        if ((image->numCols != inRo->numCols) ||
+            (image->numRows != inRo->numRows)) {
+            myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
+            myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
+            myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
+            dx = (int)(inRx->numCols / 2) - (xPos - image->col0);
+            dy = (int)(inRx->numCols / 2) - (xPos - image->col0);
+            for (int iy = 0; iy < myRo->numRows; iy++) {
+                int jy = iy + dy;
+                if ((jy < 0) || (jy >= inRo->numRows)) {
+                    for (int ix = 0; ix < myRo->numCols; ix++) {
+                        myRo->data.F32[iy][ix] = 0.0;
+                        myRx->data.F32[iy][ix] = 0.0;
+                        myRy->data.F32[iy][ix] = 0.0;
+                    }
+                    continue;
+                }
+                for (int ix = 0; ix < myRo->numCols; ix++) {
+                    int jx = ix + dx;
+                    if ((jx < 0) || (jx >= inRo->numCols)) {
+                        myRo->data.F32[iy][ix] = 0.0;
+                        myRx->data.F32[iy][ix] = 0.0;
+                        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];
+                    }
+                }
+            }
+        } else {
+            myRo = psMemIncrRefCounter (inRo);
+            myRx = psMemIncrRefCounter (inRx);
+            myRy = psMemIncrRefCounter (inRy);
+        }
 
         Ro = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, myRo, NULL, mask, 0, 0.0, 0.0, 1, 0, 0.0);
@@ -302,5 +303,5 @@
                 float oy = yBin*(imageRow + 0.5 - yCenter) + yResidCenter;
 
-		psU8 mflux = 0;
+                psU8 mflux = 0;
                 if (mode & PM_MODEL_OP_RES0) {
                     double Fo = 0.0;
@@ -310,5 +311,5 @@
                     }
                 }
-		// skip Rx,Ry if Ro is masked
+                // skip Rx,Ry if Ro is masked
                 if (!mflux && (mode & PM_MODEL_OP_RES1)) {
                     double Fx = 0.0;
@@ -379,10 +380,10 @@
  *****************************************************************************/
 bool pmModelAddWithOffset(psImage *image,
-			  psImage *mask,
-			  pmModel *model,
-			  pmModelOpMode mode,
-			  psMaskType maskVal,
-			  int dx,
-			  int dy)
+                          psImage *mask,
+                          pmModel *model,
+                          pmModelOpMode mode,
+                          psMaskType maskVal,
+                          int dx,
+                          int dy)
 {
     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
@@ -395,10 +396,10 @@
  *****************************************************************************/
 bool pmModelSubWithOffset(psImage *image,
-			  psImage *mask,
-			  pmModel *model,
-			  pmModelOpMode mode,
-			  psMaskType maskVal,
-			  int dx,
-			  int dy)
+                          psImage *mask,
+                          pmModel *model,
+                          pmModelOpMode mode,
+                          psMaskType maskVal,
+                          int dx,
+                          int dy)
 {
     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
