Index: trunk/psModules/src/objects/pmSourceMoments.c
===================================================================
--- trunk/psModules/src/objects/pmSourceMoments.c	(revision 25979)
+++ trunk/psModules/src/objects/pmSourceMoments.c	(revision 26893)
@@ -54,5 +54,5 @@
 # define VALID_RADIUS(X,Y,RAD2) (((RAD2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0)
 
-bool pmSourceMoments(pmSource *source, psF32 radius, psF32 sigma, psF32 minSN)
+bool pmSourceMoments(pmSource *source, psF32 radius, psF32 sigma, psF32 minSN, psImageMaskType maskVal)
 {
     PS_ASSERT_PTR_NON_NULL(source, false);
@@ -114,5 +114,5 @@
         for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) {
             if (vMsk) {
-                if (*vMsk) {
+                if (*vMsk & maskVal) {
                     vMsk++;
                     continue;
@@ -135,5 +135,5 @@
 	    // stars.
             if (PS_SQR(pDiff) < minSN2*wDiff) continue;
-            if (pDiff < 0) continue; // XXX : MWV says I should include < 0.0 valued points...
+            // if (pDiff < 0) continue; // XXX : MWV says I should include < 0.0 valued points...
 
 	    // Apply a Gaussian window function.  Be careful with the window function.  S/N
@@ -226,5 +226,5 @@
 	for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) {
 	    if (vMsk) {
-		if (*vMsk) {
+		if (*vMsk & maskVal) {
 		    vMsk++;
 		    continue;
@@ -249,5 +249,5 @@
 	    // stars.
 	    if (PS_SQR(pDiff) < minSN2*wDiff) continue;
-	    if (pDiff < 0) continue;
+	    // if (pDiff < 0) continue;
 
 	    // Apply a Gaussian window function.  Be careful with the window function.  S/N
@@ -315,10 +315,10 @@
     source->moments->Myyyy = YYYY/Sum;
 
-    if (source->moments->Mxx < 0) {
-	fprintf (stderr, "error: neg second moment??\n");
-    }
-    if (source->moments->Myy < 0) {
-	fprintf (stderr, "error: neg second moment??\n");
-    }
+    // if (source->moments->Mxx < 0) {
+    // 	fprintf (stderr, "error: neg second moment??\n");
+    // }
+    // if (source->moments->Myy < 0) {
+    // 	fprintf (stderr, "error: neg second moment??\n");
+    // }
 
     psTrace ("psModules.objects", 4, "Mxx: %f  Mxy: %f  Myy: %f  Mxxx: %f  Mxxy: %f  Mxyy: %f  Myyy: %f  Mxxxx: %f  Mxxxy: %f  Mxxyy: %f  Mxyyy: %f  Mxyyy: %f\n",
