Index: trunk/archive/scripts/src/phase2/pmSubtractBias.c
===================================================================
--- trunk/archive/scripts/src/phase2/pmSubtractBias.c	(revision 5107)
+++ trunk/archive/scripts/src/phase2/pmSubtractBias.c	(revision 5462)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-23 02:58:30 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-03 01:30:32 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,9 +22,38 @@
 #define PM_SUBTRACT_BIAS_SPLINE_ORDER 3
 
+// XXX: put these in psConstants.h
+void PS_POLY1D_PRINT(psPolynomial1D *poly)
+{
+    printf("-------------- PS_POLY1D_PRINT() --------------\n");
+    printf("poly->nX is %d\n", poly->nX);
+    for (psS32 i = 0 ; i < (1 + poly->nX) ; i++) {
+        printf("poly->coeff[%d] is %f\n", i, poly->coeff[i]);
+    }
+}
+
+void PS_PRINT_SPLINE(psSpline1D *mySpline)
+{
+    printf("-------------- PS_PRINT_SPLINE() --------------\n");
+    printf("mySpline->n is %d\n", mySpline->n);
+    for (psS32 i = 0 ; i < mySpline->n ; i++) {
+        PS_POLY1D_PRINT(mySpline->spline[i]);
+    }
+    PS_VECTOR_PRINT_F32(mySpline->knots);
+}
+
+#define PS_IMAGE_PRINT_F32_HIDEF(NAME) \
+printf("======== printing %s ========\n", #NAME); \
+for (int i = 0 ; i < (NAME)->numRows ; i++) { \
+    for (int j = 0 ; j < (NAME)->numCols ; j++) { \
+        printf("%.5f ", (NAME)->data.F32[i][j]); \
+    } \
+    printf("\n"); \
+}\
+
 /******************************************************************************
 psSubtractFrame(): this routine will take as input a readout for the input
 image and a readout for the bias image.  The bias image is subtracted in
 place from the input image.
- *****************************************************************************/
+*****************************************************************************/
 static pmReadout *SubtractFrame(pmReadout *in,
                                 const pmReadout *bias)
@@ -143,4 +172,6 @@
     return(opt);
 }
+
+
 
 /******************************************************************************
@@ -161,4 +192,5 @@
     psTrace(".psModule.pmSubtracBias.ScaleOverscanVector", 4,
             "---- ScaleOverscanVector() begin (%d -> %d) ----\n", overscanVector->n, n);
+    //    PS_VECTOR_PRINT_F32(overscanVector);
 
     if (NULL == overscanVector) {
@@ -182,5 +214,5 @@
     psF32 x;
     psS32 i;
-
+    printf("Got here\n");
     if (fit == PM_FIT_POLYNOMIAL) {
         // Fit a polynomial to the old overscan vector.
@@ -204,4 +236,5 @@
         // Fit a spline to the old overscan vector.
         mySpline = (psSpline1D *) fitSpec;
+        // XXX: Does it make any sense to have a psSpline argument?
         if (mySpline == NULL) {
             mustFreeSpline = 1;
@@ -210,12 +243,14 @@
         //
         // NOTE: Since the X arg in the psVectorFitSpline1D() function is NULL,
-        // splines enpoints will be from 0.0 to overscanVector->n-1.  Must scale
+        // splines endpoints will be from 0.0 to overscanVector->n-1.  Must scale
         // properly when doing the spline eval.
         //
-        mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
+        //        mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
+        mySpline = psVectorFitSpline1D(NULL, overscanVector);
         if (mySpline == NULL) {
             psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector()(2): Could not fit a spline to the psVector.\n");
             return(NULL);
         }
+        //        PS_PRINT_SPLINE(mySpline);
 
         // For each element of the new vector, convert the x-ordinate to that
@@ -230,4 +265,6 @@
             psFree(mySpline);
         }
+        //        PS_VECTOR_PRINT_F32(newVec);
+
 
     } else {
@@ -376,4 +413,5 @@
     tmpOverscan = (psListElem *) overscans->head;
     while (NULL != tmpOverscan) {
+        //        PS_IMAGE_PRINT_F32_HIDEF(in->image);
         myOverscanImage = (psImage *) tmpOverscan->data;
 
@@ -557,6 +595,8 @@
                 }
             } else if (fit == PM_FIT_SPLINE) {
+                // XXX: This makes no sense
+                // XXX: must free mySpline?
                 mySpline = (psSpline1D *) fitSpec;
-                mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
+                mySpline = psVectorFitSpline1D(NULL, overscanVector);
                 if (mySpline == NULL) {
                     psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector.  Returning in image.\n");
