Index: /branches/meh_branches/ppsub_test/psModules/src/imcombine/pmSubtractionEquation.c
===================================================================
--- /branches/meh_branches/ppsub_test/psModules/src/imcombine/pmSubtractionEquation.c	(revision 32130)
+++ /branches/meh_branches/ppsub_test/psModules/src/imcombine/pmSubtractionEquation.c	(revision 32131)
@@ -797,5 +797,6 @@
     stamp->normSquare2 = normSquare2;
 
-    // psLogMsg ("psModules.imcombine", PS_LOG_DETAIL, "normValue: %f %f %f  (%f %f)\n", normI1, normI2, stamp->norm, normSquare1, normSquare2);
+    //MEH
+    psLogMsg ("psModules.imcombine", PS_LOG_DETAIL, "normValue: %f %f %f  (%f %f)\n", normI1, normI2, stamp->norm, normSquare1, normSquare2);
 
     return true;
@@ -1382,9 +1383,11 @@
 	float Myy = fluxY2 / fluxC1;
 
+	//MEH uncomment and update
 	// fprintf (stderr, "conv1, flux2: %f, Mx: %f, My: %f, Mxx: %f, Myy: %f, chisq: %f, npix: %d\n", flux2, Mx, My, Mxx, Myy, chisq, npix);
+	fprintf (stderr, "conv1, flux2: %f, fluxC1: %f, Mxx: %f, Myy: %f, chisqR: %f, npix: %d\n", flux2, fluxC1, Mxx, Myy, chisqR, npix);
 	moment += Mxx + Myy;
     }
 
-    // get the moments from convolved1
+    // get the moments from convolved2
     if (convolved2) {
 	for (int y = residual->yMin; y <= residual->yMax; y++) {
@@ -1546,5 +1549,5 @@
             }
 
-	    // Generate the difference, residual, and convolved source images.  Note the we
+	    // Generate the difference, residual, and convolved source images.  Note that we
 	    // accumulate the convolution of (A-B), so we need to replace it to generate the
 	    // images of the convolved source image.
@@ -1554,4 +1557,7 @@
                     residual->kernel[y][x] = difference->kernel[y][x] - convolved1->kernel[y][x];
 		    convolved1->kernel[y][x] += source->kernel[y][x] * norm;
+
+		    //MEH 
+		    //psLogMsg("psModules.imcombine", PS_LOG_INFO, "xy: %d %d, norm: %6.3f, bg: %6.3f, difference: %6.3f, target: %6.3f, source: %6.3f, residual: %6.3f, convolved1: %6.3f \n",x,y,norm,background,difference->kernel[y][x],target->kernel[y][x],source->kernel[y][x],residual->kernel[y][x],convolved1->kernel[y][x]);
                 }
             }
@@ -1651,6 +1657,10 @@
 	psFree (modelKernel);
     } else {
-	sumKernel2 = 1.0;
-    }
+        //MEH leave at 0 or make it small e to avoid x/0? 
+//	sumKernel2 = 1.0;
+        sumKernel2 = 0.001;
+    }
+
+    //MEH if sumKernel2 not use essentially, then not need to be 2.0*? 
 
     // if we modify the chisq value by the (sumKernel1 + sumKernel2), we account for the
@@ -1658,6 +1668,8 @@
     // penalized by increasing the score somewhat.  the 0.01 value is not well-chosen.
     float orderFactor = 0.01 * kernels->spatialOrder;
-    float score = 2.0 * chisqRValue / (sumKernel1 + sumKernel2) + orderFactor;
-    psLogMsg("psModules.imcombine", PS_LOG_INFO, "chisq: %6.3f, chisqD: %6.3f, moment: %6.3f, sumKernel_1: %6.3f, sumKernel_2, score: %6.3f: %6.3f\n", chisqRValue, chisqDValue, momentValue, sumKernel1, sumKernel2, score);
+    //MEH
+    //float score = 2.0 * chisqRValue / (sumKernel1 + sumKernel2) + orderFactor;
+    float score = 2.0 * chisqRValue / (sqrt(sumKernel1) + sqrt(sumKernel2)) + orderFactor;
+    psLogMsg("psModules.imcombine", PS_LOG_INFO, "chisq: %6.3f, chisqD: %6.3f, moment: %6.3f, sumKernel_1: %6.3f, sumKernel_2: %6.3f, score: %6.3f\n", chisqRValue, chisqDValue, momentValue, sumKernel1, sumKernel2, score);
 
     // save this result if it is the first or the best (skip if bestMatch is NULL)
