Index: /trunk/psModules/src/pmReadoutCombine.c
===================================================================
--- /trunk/psModules/src/pmReadoutCombine.c	(revision 2776)
+++ /trunk/psModules/src/pmReadoutCombine.c	(revision 2777)
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-01 21:20:24 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-21 20:41:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -285,4 +285,5 @@
             stats = psVectorStats(stats,
                                   tmpPixels,
+                                  NULL,
                                   tmpPixelMaskNKeep,
                                   1);
Index: /trunk/psModules/src/pmSubtractBias.c
===================================================================
--- /trunk/psModules/src/pmSubtractBias.c	(revision 2776)
+++ /trunk/psModules/src/pmSubtractBias.c	(revision 2777)
@@ -6,6 +6,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-25 02:54:45 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-21 20:41:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,5 +33,6 @@
 
     if (bias == NULL) {
-        printf("WARNING: bias frame is NULL\n");
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "WARNING: pmSubtractBias.c: psSubtractFrame(): bias frame is NULL.  Returning original image.\n");
         return(in);
     }
@@ -133,5 +134,6 @@
     }
     if (numOptions != 1) {
-        printf("WARNING: Too many statistics options have been specified\n");
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "WARNING: pmSubtractBias.c: GenNewStatOptions(): Too many statistics options have been specified\n");
     }
     return(opt);
@@ -153,5 +155,7 @@
                               pmFit fit)
 {
-    printf("ScaleOverscanVector(%d)\n", n);
+    psTrace(".psModule.pmSubtracBias.ScaleOverscanVector", 4,
+            "---- ScaleOverscanVector() begin ----\n");
+
     if (NULL == overscanVector) {
         return(overscanVector);
@@ -189,7 +193,9 @@
         }
     } else {
-        psError(PS_ERR_UNKNOWN,true, "unknown fit type\n");
-    }
-
+        psError(PS_ERR_UNKNOWN, true, "unknown fit type\n");
+    }
+
+    psTrace(".psModule.pmSubtracBias.ScaleOverscanVector", 4,
+            "---- ScaleOverscanVector() exit ----\n");
     return(newVec);
 }
@@ -204,4 +210,13 @@
                           const psReadout *bias)
 {
+    psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4,
+            "---- ScaleOverscanVector() begin ----\n");
+    PS_READOUT_CHECK_NULL(in, NULL);
+    PS_READOUT_CHECK_EMPTY(in, NULL);
+    PS_READOUT_CHECK_TYPE(in, PS_TYPE_F32, NULL);
+    if ((overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)) {
+        psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)\n");
+        return(in);
+    }
     int i;
     int j;
@@ -218,7 +233,4 @@
     psSpline1D *mySpline;
     int nBin;
-
-    PS_PTR_CHECK_NULL(in,NULL);
-
     //
     //  Determine if multiple options are specified in stat.
@@ -228,7 +240,10 @@
     }
 
-    if ((overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)) {
-        psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)\n");
-        return(in);
+    if (overScanAxis == PM_OVERSCAN_NONE) {
+        if (overscans != NULL) {
+            psLogMsg(__func__, PS_LOG_WARN,
+                     "WARNING: pmSubtractBias.(): overScanAxis equals NONE and overscans does not equal NULL\n");
+        }
+        return(psSubtractFrame(in, bias));
     }
 
@@ -236,18 +251,16 @@
             (overScanAxis == PM_OVERSCAN_ALL)) &&
             (fit == PM_FIT_NONE)) {
-        printf("WARNING: overScanAxis equals NONE or ALL, and fit equals NONE\n");
-        //XXX: Then what?
-    }
-
-    if (overScanAxis == PM_OVERSCAN_NONE) {
-        if (overscans != NULL) {
-            printf("WARNING: overScanAxis equals NONE and overscans does not equal NULL\n");
-        }
-        return(psSubtractFrame(in, bias));
-    }
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "WARNING: pmSubtractBias.(): overScanAxis equals NONE or ALL, and fit equals NONE\n");
+    }
+
 
     //
     // We subtract each overscan region from the image data.
     //
+    // XXX: Do we generate a single stat from all the overscan regions, and
+    // subtract that from the input image?  Or do we generate a single stat
+    // from each overscan region, and subtract them from the input image?
+    // The SDR is ambiguous.
     if (overScanAxis == PM_OVERSCAN_ALL) {
         tmpOverscan = (psListElem *) overscans->head;
@@ -286,5 +299,5 @@
                         tmpRow->data.F32[j] = myOverscanImage->data.F32[j][i];
                     }
-                    stat = psVectorStats(stat, tmpRow, NULL, 0);
+                    stat = psVectorStats(stat, tmpRow, NULL, NULL, 0);
                     p_psGetStatValue(stat, &statValue);
                     overscanVector->data.F32[i] = statValue;
@@ -292,5 +305,6 @@
                 psFree(tmpRow);
                 if ((fit == PM_FIT_POLYNOMIAL) || (fit == PM_FIT_SPLINE)) {
-                    psVector *newVec = ScaleOverscanVector(overscanVector, (in->image)->numCols, fitSpec, fit);
+                    psVector *newVec = ScaleOverscanVector(overscanVector,
+                                                           (in->image)->numCols, fitSpec, fit);
                     psFree(overscanVector);
                     overscanVector = newVec;
@@ -310,5 +324,5 @@
                         tmpCol->data.F32[j] = myOverscanImage->data.F32[i][j];
                     }
-                    stat = psVectorStats(stat, tmpCol, NULL, 0);
+                    stat = psVectorStats(stat, tmpCol, NULL, NULL, 0);
                     p_psGetStatValue(stat, &statValue);
                     overscanVector->data.F32[i] = statValue;
@@ -317,5 +331,6 @@
                 psFree(tmpCol);
                 if ((fit == PM_FIT_POLYNOMIAL) || (fit == PM_FIT_SPLINE)) {
-                    psVector *newVec = ScaleOverscanVector(overscanVector, (in->image)->numRows, fitSpec, fit);
+                    psVector *newVec = ScaleOverscanVector(overscanVector,
+                                                           (in->image)->numRows, fitSpec, fit);
                     psFree(overscanVector);
                     overscanVector = newVec;
@@ -342,5 +357,5 @@
                         }
                     }
-                    stat = psVectorStats(stat, binVec, NULL, 0);
+                    stat = psVectorStats(stat, binVec, NULL, NULL, 0);
                     p_psGetStatValue(stat, &statValue);
                     myBin->data.F32[i] = statValue;
@@ -372,5 +387,5 @@
                 } else if (fit == PM_FIT_SPLINE) {
                     mySpline = (psSpline1D *) fitSpec;
-                    // XXX: The spline functions do not currently work if the number of
+                    // XXX: The spline functions do not work if the number of
                     // data points and the number of splines are not equal.
                 }
@@ -404,4 +419,7 @@
 
 
+    psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4,
+            "---- ScaleOverscanVector() exit ----\n");
+
     if (bias != NULL) {
         return(psSubtractFrame(in, bias));
Index: /trunk/psModules/src/pmSubtractSky.c
===================================================================
--- /trunk/psModules/src/pmSubtractSky.c	(revision 2776)
+++ /trunk/psModules/src/pmSubtractSky.c	(revision 2777)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-20 21:38:46 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-21 20:41:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -107,5 +107,5 @@
                 }
             }
-            myStats = psVectorStats(myStats, binVector, binMask, 1);
+            myStats = psVectorStats(myStats, binVector, NULL, binMask, 1);
             psF64 statValue;
             psBool rc = p_psGetStatValue(myStats, &statValue);
Index: /trunk/psModules/test/tst_pmSubtractSky.c
===================================================================
--- /trunk/psModules/test/tst_pmSubtractSky.c	(revision 2776)
+++ /trunk/psModules/test/tst_pmSubtractSky.c	(revision 2777)
@@ -7,6 +7,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-20 21:39:14 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-21 20:41:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +19,5 @@
 #define POLY_X_ORDER 3
 #define POLY_Y_ORDER 3
-#define TOL 1.0
+#define ERROR_TOLERANCE 1.0
 #define OBJECT_INTENSITY 2000.0
 static int test00(void);
@@ -26,4 +26,5 @@
                               {NULL}
                           };
+//XXX: Test a few input parameter error conditions.
 
 float func(int i, int j)
@@ -37,4 +38,6 @@
 }
 
+/******************************************************************************
+ *****************************************************************************/
 int doSubtractSkySimple(int numCols, int numRows, int binFactor)
 {
@@ -57,5 +60,5 @@
     for (i=0;i<numRows;i++) {
         for (j=0;j<numCols;j++) {
-            if (TOL < fabs(myReadout->image->data.F32[i][j])) {
+            if (ERROR_TOLERANCE < fabs(myReadout->image->data.F32[i][j])) {
                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]);
                 testStatus = 1;
@@ -69,4 +72,6 @@
 }
 
+/******************************************************************************
+ *****************************************************************************/
 int doSubtractSkyWithObjects(int numCols, int numRows, int binFactor)
 {
@@ -79,5 +84,5 @@
     psPolynomial2D *myPoly = psPolynomial2DAlloc(POLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);
     psImage *trueImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psF32 errorTolerance = TOL * ((psF32) binFactor);
+    psF32 errorTolerance = ERROR_TOLERANCE * ((psF32) binFactor);
 
     for (i=0;i<numRows;i++) {
@@ -123,6 +128,4 @@
 
     // Bin Factor == 1
-    /*
-    */
     printf("doSubtractSkySimple(1, 1, 1)\n");
     testStatus |= doSubtractSkySimple(1, 1, 1);
