Index: unk/psModules/test/imsubtract/tst_pmImageSubtract.c
===================================================================
--- /trunk/psModules/test/imsubtract/tst_pmImageSubtract.c	(revision 7212)
+++ 	(revision )
@@ -1,847 +1,0 @@
-/** @file tst_pmImageSubtract.c
- *
- *  @brief Contains the tests for pmImageSubtract.c:
- *
- *  test00: This code will test the various functions in pmObjects.c
- *
- *  @author GLG, MHPCC
- *
- *  XXX: Most test simply ensure that the functions can be called with allowable
- *  data.  More work need to be done to verify the results.
- *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-03-04 01:01:34 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-#include "psTest.h"
-#include "pslib.h"
-#include "pmImageSubtract.h"
-#define ERROR_TOLERANCE 1.0
-static int test00(void);
-static int test01(void);
-static int test02(void);
-static int test03(void);
-testDescription tests[] = {
-                              {test00, 000, "pmSubtractionKernelsAllocPOIS()", true, false},
-                              {test01, 000, "pmSubtractionKernelsAllocISIS()", true, false},
-                              {test02, 000, "pmSubtractionFindStamps()", true, false},
-                              {test03, 000, "pmSubtractionCalculateEquation()", true, false},
-                              {NULL}
-                          };
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-
-/*******************************************************************************
-NOTE: This function returns FALSE if there were no errors.
- 
-XXX: Call with various unallowable input parameters.
- 
-XXX: Untested: we don't loop through the (u, v, xOrder, yOrder) psVectors and
-ensure that each value is set correctly.
- ******************************************************************************/
-psBool testPOISAlloc(psS32 size,
-                     psS32 SpatialOrder)
-{
-    printf("Testing pmSubtractionKernelsAllocPOIS(%d, %d)\n", size, SpatialOrder);
-
-    bool testStatus = false;
-    psS32 nBasisFunctions = (2 * size + 1) * (2 * size + 1) * (SpatialOrder + 1) * (SpatialOrder + 2) / 2;
-
-    psSubtractionKernels *kernels = pmSubtractionKernelsAllocPOIS(size, SpatialOrder);
-    if (kernels == NULL) {
-        printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() returned a NULL psSubtractionKernels.\n");
-        testStatus = true;
-    } else {
-        if (kernels->type != PM_SUBTRACTION_KERNEL_POIS) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated the wrong kernels->type.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->u == NULL) ||
-                (kernels->u->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a NULL ->u member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a incorrect length ->u member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->v == NULL) ||
-                (kernels->v->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a NULL ->v member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a incorrect length ->v member.\n");
-            testStatus = true;
-        }
-
-        if (kernels->sigma != NULL) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a non-NULL ->sigma member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->xOrder == NULL) ||
-                (kernels->xOrder->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a NULL ->xOrder member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a incorrect length ->xOrder member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->yOrder == NULL) ||
-                (kernels->yOrder->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a NULL ->yOrder member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a incorrect length ->yOrder member.\n");
-            testStatus = true;
-        }
-
-        if (kernels->subIndex != 0) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a non-zero ->subIndex member (%d).\n", kernels->subIndex);
-            testStatus = true;
-        }
-
-        psS32 i = kernels->subIndex;
-        if ((kernels->u->data.F32[i] != 0) ||
-                (kernels->v->data.F32[i] != 0)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS(): the ->subIndex member points to a kernel with (%f, %f) (u, v) basis function.\n",
-                   kernels->u->data.F32[i], kernels->v->data.F32[i]);
-            testStatus = true;
-        }
-
-        if (kernels->preCalc != NULL) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated a non-NULL ->preCalc member.\n");
-            testStatus = true;
-        }
-
-        if (kernels->size != size) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated an incorrect ->size member (%d).\n", kernels->size);
-            testStatus = true;
-        }
-
-        if (kernels->spatialOrder != SpatialOrder) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocPOIS() generated an incorrect ->spatialOrder member (%d).\n", kernels->spatialOrder);
-            testStatus = true;
-        }
-    }
-    psFree(kernels);
-    return(testStatus);
-}
-
-/*******************************************************************************
-NOTE: This function returns TRUE if there were no errors.
- ******************************************************************************/
-int test00( void )
-{
-    bool testStatus = false;
-
-    testStatus|= testPOISAlloc(1, 1);
-    testStatus|= testPOISAlloc(2, 3);
-    testStatus|= testPOISAlloc(3, 4);
-
-    return(!testStatus);
-}
-
-/*******************************************************************************
-NOTE: This function returns FALSE if there were no errors.
- 
-XXX: Call with various unallowable input parameters.
- 
-XXX: Untested: we don't loop through the (u, v, xOrder, yOrder) psVectors and
-ensure that each value is set correctly.  We don't ensure that he preCalc
-psImages are set correctly.
- ******************************************************************************/
-psBool testISISAlloc(psS32 sigmaLength,
-                     psS32 orderLength,
-                     psS32 size,
-                     psS32 SpatialOrder)
-{
-    printf("Testing pmSubtractionKernelsAllocISIS(%d, %d, %d, %d)\n",
-           sigmaLength, orderLength, size, SpatialOrder);
-
-    psVector *sigmas = psVectorAlloc(sigmaLength, PS_TYPE_F32);
-    sigmas->n = sigmas->nalloc;
-    for (psS32 i = 0 ; i < sigmas->n ; i++) {
-        sigmas->data.F32[i] = 1.0 + (psF32) i;
-    }
-    psVector *orders = psVectorAlloc(orderLength, PS_TYPE_S32);
-    orders->n = orders->nalloc;
-    for (psS32 i = 0 ; i < orders->n ; i++) {
-        orders->data.S32[i] = i + 2;
-    }
-
-    bool testStatus = false;
-    psS32 numSigmas = sigmas->n;
-    psS32 nBasisFunctions = 0;
-    for (psS32 s = 0 ; s < numSigmas ; s++) {
-        for (psS32 o = 0 ; o < orders->n ; o++) {
-            nBasisFunctions+= ((orders->data.S32[o] + 1) * (orders->data.S32[o] + 2) / 2);
-        }
-    }
-    nBasisFunctions*= ((SpatialOrder + 1) * (SpatialOrder + 2) / 2);
-
-    psSubtractionKernels *kernels = pmSubtractionKernelsAllocISIS(sigmas, orders, size, SpatialOrder);
-    if (kernels == NULL) {
-        printf("TEST ERROR: pmSubtractionKernelsAllocISIS() returned a NULL psSubtractionKernels.\n");
-        testStatus = true;
-    } else {
-        if (kernels->type != PM_SUBTRACTION_KERNEL_ISIS) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated the wrong kernels->type.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->u == NULL) ||
-                (kernels->u->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->u member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->u member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->v == NULL) ||
-                (kernels->v->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->v member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->v member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->sigma == NULL) ||
-                (kernels->sigma->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->sigma member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->sigma member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->xOrder == NULL) ||
-                (kernels->xOrder->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->xOrder member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->xOrder member.\n");
-            testStatus = true;
-        }
-
-        if ((kernels->yOrder == NULL) ||
-                (kernels->yOrder->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->yOrder member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->yOrder member.\n");
-            testStatus = true;
-        }
-
-        if (kernels->subIndex != 0) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a non-zero ->subIndex member (%d).\n", kernels->subIndex);
-            testStatus = true;
-        }
-
-        //
-        // Ensure that kernels->subIndex points to the correct kernel.
-        //
-        psS32 i = kernels->subIndex;
-        if ((kernels->u->data.F32[i] != 0.0) ||
-                (kernels->v->data.F32[i] != 0.0) ||
-                (kernels->xOrder->data.F32[i] != 0.0) ||
-                (kernels->yOrder->data.F32[i] != 0.0) ||
-                (kernels->sigma->data.F32[i] != sigmas->data.F32[0])) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS(): the ->subIndex member points to the wrong kernel.\n");
-            printf("TEST ERROR: (u, v, xOrder, yOrder, sigma) is (%f, %f, %f, %f, %f).\n",
-                   kernels->u->data.F32[i], kernels->v->data.F32[i],
-                   kernels->xOrder->data.F32[i], kernels->yOrder->data.F32[i],
-                   kernels->sigma->data.F32[i]);
-            testStatus = true;
-        }
-
-        //
-        // Ensure that the preCalc images are allocated correctly.
-        //
-        if ((kernels->preCalc == NULL) ||
-                (kernels->preCalc->n != nBasisFunctions)) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a NULL ->preCalc member or\n");
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated a incorrect length ->preCalc member.\n");
-            testStatus = true;
-        } else {
-            for (psS32 k = 0 ; k < kernels->u->n ; k++) {
-                psImage *kerImg = (psImage *) kernels->preCalc->data[k];
-                if (kerImg == NULL) {
-                    printf("TEST ERROR: the %d-th kernel preCalc image is NULL.\n", k);
-                    testStatus = true;
-                } else {
-                    if (kerImg->type.type != PS_TYPE_F32) {
-                        printf("TEST ERROR: preCalc image %d had ioncorrect type.\n", k);
-                        testStatus = true;
-                    }
-                    if ((kerImg->numRows != (1 + (2 * size))) ||
-                            (kerImg->numCols != (1 + (2 * size)))) {
-                        printf("TEST ERROR: preCalc image %d had incorrect size (%d, %d).\n", k,
-                               kerImg->numRows, kerImg->numCols);
-                        testStatus = true;
-                    }
-                }
-            }
-        }
-
-        if (kernels->size != size) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated an incorrect ->size member (%d).\n", kernels->size);
-            testStatus = true;
-        }
-
-        if (kernels->spatialOrder != SpatialOrder) {
-            printf("TEST ERROR: pmSubtractionKernelsAllocISIS() generated an incorrect ->spatialOrder member (%d).\n", kernels->spatialOrder);
-            testStatus = true;
-        }
-    }
-    psFree(sigmas);
-
-    psFree(kernels->u);
-    psFree(kernels->v);
-    psFree(kernels->sigma);
-    psFree(kernels->xOrder);
-    psFree(kernels->yOrder);
-    psFree(kernels->preCalc);
-    psFree(kernels);
-    psFree(orders);
-    return(testStatus);
-}
-
-/*******************************************************************************
-NOTE: This function returns TRUE if there were no errors.
- ******************************************************************************/
-int test01( void )
-{
-    bool testStatus = false;
-
-    /*
-        testStatus|= testISISAlloc(1, 1, 1, 1);
-        testStatus|= testISISAlloc(2, 2, 2, 2);
-        testStatus|= testISISAlloc(2, 3, 4, 5);
-        testStatus|= testISISAlloc(3, 4, 5, 6);
-    */
-
-    return(!testStatus);
-}
-
-
-/*******************************************************************************
-NOTE: This function returns FALSE if there were no errors.
- 
-XXX: Can we test to ensure that no stamps overlap?
- 
-XXX: Test stamp alloc/dealloc functions.
- ******************************************************************************/
-#define TST02_THRESHOLD 3.0
-#define TST02_MASK_VAL 1
-psBool testFindStamps(psS32 numCols,
-                      psS32 numRows,
-                      psS32 xNum,
-                      psS32 yNum,
-                      psS32 border)
-{
-    printf("Testing pmSubtractionFindStamps(%d, %d, %d, %d, %d)\n",
-           numCols, numRows, xNum, yNum, border);
-    bool testStatus = false;
-
-    // Create a test image and set a single pixel in the center of each stamp.
-    psImage *tstImg = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    int numStamps = 0;
-    PS_IMAGE_SET_F32(tstImg, 0.0);
-    for (psS32 j = 0; j < yNum; j++) {
-        for (psS32 i = 0; i < xNum; i++) {
-            psS32 yMin = border + j * (numRows - 2.0 * border) / yNum;
-            psS32 yMax = PS_MIN(numRows-1, (border + (j + 1) * (numRows - 2.0 * border) / yNum) - 1);
-            psS32 xMin = border + i * (numCols - 2.0 * border) / xNum;
-            psS32 xMax = PS_MIN(numCols-1, (border + (i + 1) * (numCols - 2.0 * border) / xNum) - 1);
-
-            tstImg->data.F32[(yMax+yMin)/2][(xMax+xMin)/2] = TST02_THRESHOLD + (psF32) (i + j);
-            numStamps++;
-        }
-    }
-    psImage *tmpMask= psImageAlloc(numCols, numRows, PS_TYPE_U8);
-    PS_IMAGE_SET_U8(tstImg, 0);
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a NULL psImage.  Should generate error, return NULL.\n");
-    psArray *stamps = pmSubtractionFindStamps(NULL, NULL, tmpMask, TST02_MASK_VAL,
-                      TST02_THRESHOLD, xNum, yNum,
-                      border);
-    if (stamps != NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        psFree(stamps);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a non-positive xNum.  Should generate error, return NULL.\n");
-    stamps = pmSubtractionFindStamps(NULL, tstImg, tmpMask, TST02_MASK_VAL,
-                                     TST02_THRESHOLD, 0, yNum,
-                                     border);
-    if (stamps != NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        psFree(stamps);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a non-positive yNum.  Should generate error, return NULL.\n");
-    stamps = pmSubtractionFindStamps(NULL, tstImg, tmpMask, TST02_MASK_VAL,
-                                     TST02_THRESHOLD, xNum, 0,
-                                     border);
-    if (stamps != NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        psFree(stamps);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a non-positive border.  Should generate error, return NULL.\n");
-    stamps = pmSubtractionFindStamps(NULL, tstImg, tmpMask, TST02_MASK_VAL,
-                                     TST02_THRESHOLD, xNum, yNum,
-                                     0);
-    if (stamps != NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        psFree(stamps);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with acceptable input parameters, non-NULL mask.\n");
-    stamps = pmSubtractionFindStamps(NULL, tstImg, tmpMask, TST02_MASK_VAL,
-                                     TST02_THRESHOLD, xNum, yNum,
-                                     border);
-    if (stamps == NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        testStatus = true;
-    } else {
-        if (stamps->n != numStamps) {
-            printf("TEST ERROR: %ld stamps were found, %d were expected.\n",
-                   stamps->n, numStamps);
-            testStatus = true;
-        }
-        for (psS32 s = 0 ; s < stamps->n ; s++) {
-            pmStamp *stamp = (pmStamp *) stamps->data[s];
-            psS32 row = stamp->y;
-            psS32 col = stamp->x;
-            // printf("Stamp %d at (%d, %d) has a value of %f\n", s, row, col, tstImg->data.F32[row][col]);
-            if (tstImg->data.F32[row][col] < TST02_THRESHOLD) {
-                if (stamp->status != PM_STAMP_NONE) {
-                    printf("TEST ERROR: stamp %d had peak value %f (below theshold) and the status was not set to PM_STAMP_NONE.\n",
-                           s, tstImg->data.F32[row][col]);
-                    testStatus = true;
-                }
-            } else {
-                if (stamp->status != PM_STAMP_RECALC) {
-                    printf("TEST ERROR: stamp %d had peak value %f (above theshold) and the status was not set to PM_STAMP_RECALC.\n",
-                           s, tstImg->data.F32[row][col]);
-                    testStatus = true;
-                }
-            }
-        }
-    }
-    psFree(stamps);
-
-    //-------------------------------------------------------------------------
-    printf("Calling with acceptable input parameters, NULL mask.\n");
-    stamps = pmSubtractionFindStamps(NULL, tstImg, NULL, TST02_MASK_VAL,
-                                     TST02_THRESHOLD, xNum, yNum,
-                                     border);
-    if (stamps == NULL) {
-        printf("TEST ERROR: pmSubtractionFindStamps returned a non-NULL psArray.\n");
-        testStatus = true;
-    } else {
-        if (stamps->n != numStamps) {
-            printf("TEST ERROR: %ld stamps were found, %d were expected.\n",
-                   stamps->n, numStamps);
-            testStatus = true;
-        }
-        for (psS32 s = 0 ; s < stamps->n ; s++) {
-            pmStamp *stamp = (pmStamp *) stamps->data[s];
-            psS32 row = stamp->y;
-            psS32 col = stamp->x;
-            //printf("Stamp %d at (%d, %d) has a value of %f\n", s, row, col, tstImg->data.F32[row][col]);
-            if (tstImg->data.F32[row][col] < TST02_THRESHOLD) {
-                if (stamp->status != PM_STAMP_NONE) {
-                    printf("TEST ERROR: stamp %d had peak value %f (below theshold) and the status was not set to PM_STAMP_NONE.\n",
-                           s, tstImg->data.F32[row][col]);
-                    testStatus = true;
-                }
-            } else {
-                if (stamp->status != PM_STAMP_RECALC) {
-                    printf("TEST ERROR: stamp %d had peak value %f (above theshold) and the status was not set to PM_STAMP_RECALC.\n",
-                           s, tstImg->data.F32[row][col]);
-                    testStatus = true;
-                }
-            }
-        }
-    }
-
-    psFree(tstImg);
-    psFree(tmpMask);
-    psFree(stamps);
-
-    return(testStatus);
-}
-
-
-
-/*******************************************************************************
-NOTE: This function returns TRUE if there were no errors.
- ******************************************************************************/
-int test02( void )
-{
-    bool testStatus = false;
-
-    testStatus|= testFindStamps(100, 100, 2, 2, 2);
-    testStatus|= testFindStamps(100, 100, 10, 10, 2);
-
-    return(!testStatus);
-}
-
-
-psF32 genRanFloat(psF32 low,
-                  psF32 high)
-{
-    psF32 ran1 = (((psF32) (random() % 10000)) / 10000.0);
-    return(low + (ran1 * (high - low)));
-}
-
-//
-// XXX: POIS kernels are producing NANs if the image size is 20 or less.
-//
-// XXX: ISIS kernels are producing NANS if the TST03_ORDER_LENGTH is 2 or larger.
-//
-#define TST03_THRESHOLD  3.0
-#define TST03_MASK_VAL  1
-#define TST03_KERNEL_SIZE 2
-#define TST03_SPATIAL_ORDER 2
-#define TST03_ORDER_LENGTH 1
-#define TST03_SIGMA_LENGTH 1
-#define TST03_PSF_MAX  10.0
-#define TST03_BG 0.0
-#define TST03_IMAGE_SIZE 25
-#define TST03_NUM_COLS  TST03_IMAGE_SIZE
-#define TST03_NUM_ROWS  TST03_IMAGE_SIZE
-#define TST03_NUM_STAMPS 2
-#define TST03_NUM_STAMPS_COLS TST03_NUM_STAMPS
-#define TST03_NUM_STAMPS_ROWS TST03_NUM_STAMPS
-#define TST03_BORDER  TST03_KERNEL_SIZE
-//#define TST03_FOOTPRINT (((TST03_IMAGE_SIZE - (2 * TST03_BORDER)) / TST03_NUM_STAMPS) - TST03_KERNEL_SIZE)
-#define TST03_FOOTPRINT  4
-#define TST03_PSF_WIDTH  (TST03_FOOTPRINT/2 - 1)
-
-/*******************************************************************************
-This routine generates an object in the center of the stamp defined by the
-(xMin, xMax) and (yMin, yMax) boundary.
- ******************************************************************************/
-psBool genObject(psImage *tstImg,
-                 psImage *refImg,
-                 psS32 xMin,
-                 psS32 xMax,
-                 psS32 yMin,
-                 psS32 yMax)
-{
-    if (((1 + 2 * TST03_PSF_WIDTH) > (xMax - xMin)) ||
-            ((1 + 2 * TST03_PSF_WIDTH) > (yMax - yMin))) {
-        printf("INCORRECT TEST CONFIGURATION: TST03_PSF_WIDTH is too big.\n");
-        printf("TST03_PSF_WIDTH is %d: (xMin - xMax) is %d\n", TST03_PSF_WIDTH, (xMax - xMin));
-        return(FALSE);
-    }
-    //
-    // This code basically creates a peak at the center of the stamp with
-    // a height of TST03_PSF_MAX
-    //
-    psS32 xCenter = (xMax + xMin) / 2;
-    psS32 yCenter = (yMax + yMin) / 2;
-    psF32 subImageWidth = 1.0 + sqrtf(PS_SQR(((psF32) ((yMax-yMin)/2))) + PS_SQR(((psF32) ((xMax-xMin)/2))));
-    for (psS32 y = yMin ; y <= yMax ; y++) {
-        for (psS32 x = xMin ; x <= xMax ; x++) {
-            psF32 dist = sqrtf(PS_SQR((psF32) (y - yCenter)) + PS_SQR((psF32) (x - xCenter)));
-            psF32 pixel = TST03_PSF_MAX * PS_SQR(((psF32) (subImageWidth - dist)) / ((psF32) subImageWidth));
-            if (pixel < 0.0) {
-                pixel = 0.0;
-            }
-            refImg->data.F32[y][x] = pixel + TST03_BG;
-            tstImg->data.F32[y][x] = pixel + TST03_BG;
-            // Add some noise for the test image.
-            tstImg->data.F32[y][x]+= genRanFloat(0.0, 1.0);
-        }
-    }
-
-    return(TRUE);
-}
-
-/*******************************************************************************
-NOTE: This function returns FALSE if there were no errors.
- 
-XXX: We should use a larger variety of input parameter configurations.
- 
-I test the following functions here (since they linearly rely on a set of data
-structures that the previoues ones generate):
-    pmSubtractionCalculateEquation()
-    pmSubtractionSolveEquation()
-    pmSubtractionRejectStamps()
-    pmSubtractionKernelImage()
- ******************************************************************************/
-psBool testSubCalcEqu(psS32 numCols,
-                      psS32 numRows,
-                      psS32 xNum,
-                      psS32 yNum,
-                      psS32 border,
-                      pmSubtractionKernelsType KernelType)
-{
-    printf("Testing pmSubtractionCalculateEquation(): \n");
-    printf("    image size is (%d, %d)\n", numRows, numCols);
-    printf("    num stamps is (%d, %d).  Border is %d\n", yNum, xNum, border);
-    if (KernelType == PM_SUBTRACTION_KERNEL_POIS) {
-        printf("   kernel type is PM_SUBTRACTION_KERNEL_POIS.\n");
-    } else if (KernelType == PM_SUBTRACTION_KERNEL_ISIS) {
-        printf("   kernel type is PM_SUBTRACTION_KERNEL_ISIS.\n");
-    }
-    bool testStatus = false;
-
-    // Create a test image and set a single pixel in the center of each stamp.
-    psImage *tstImg = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *refImg = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *maskImg = psImageAlloc(numCols, numRows, PS_TYPE_U8);
-    PS_IMAGE_SET_F32(tstImg, 0.0);
-    PS_IMAGE_SET_F32(maskImg, 0);
-    for (psS32 j = 0; j < yNum; j++) {
-        for (psS32 i = 0; i < xNum; i++) {
-            psS32 yMin = border + j * (numRows - 2.0 * border) / yNum;
-            psS32 yMax = PS_MIN(numRows-1, (border + (j + 1) * (numRows - 2.0 * border) / yNum) - 1);
-            psS32 xMin = border + i * (numCols - 2.0 * border) / xNum;
-            psS32 xMax = PS_MIN(numCols-1, (border + (i + 1) * (numCols - 2.0 * border) / xNum) - 1);
-
-            genObject(tstImg, refImg, xMin, xMax, yMin, yMax);
-        }
-    }
-    printf("Generating stamps...\n");
-    psArray *stamps = pmSubtractionFindStamps(NULL, tstImg, NULL, TST03_MASK_VAL,
-                      TST03_THRESHOLD, xNum, yNum,
-                      border);
-
-    //
-    // PsVectors sigmas and orders are for ISIS kernels only.
-    //
-    psVector *sigmas = psVectorAlloc(TST03_SIGMA_LENGTH, PS_TYPE_F32);
-    sigmas->n = sigmas->nalloc;
-    for (psS32 i = 0 ; i < sigmas->n ; i++) {
-        sigmas->data.F32[i] = 1.0 + (psF32) i;
-    }
-    psVector *orders = psVectorAlloc(TST03_ORDER_LENGTH, PS_TYPE_S32);
-    orders->n = orders->nalloc;
-    for (psS32 i = 0 ; i < orders->n ; i++) {
-        orders->data.S32[i] = i + 2;
-    }
-
-    //
-    // Create the subtraction kernels
-    //
-    printf("Generating kernel basis functions...\n");
-    psSubtractionKernels *myKernels = NULL;
-    if (KernelType == PM_SUBTRACTION_KERNEL_POIS) {
-        myKernels = pmSubtractionKernelsAllocPOIS(TST03_KERNEL_SIZE, TST03_SPATIAL_ORDER);
-    } else if (KernelType == PM_SUBTRACTION_KERNEL_ISIS) {
-        myKernels = pmSubtractionKernelsAllocISIS(sigmas, orders, TST03_KERNEL_SIZE, TST03_SPATIAL_ORDER);
-    }
-
-    if ((stamps == NULL) ||
-            (myKernels == NULL)) {
-        printf("TEST ERROR: stamps or myKernels is NULL.\n");
-        testStatus = true;
-    } else {
-        //-------------------------------------------------------------------------
-        printf("Calling with a NULL psArray stamps.  Should generate error, return FALSE.\n");
-        psBool rc = pmSubtractionCalculateEquation(NULL, refImg, tstImg, myKernels, TST03_FOOTPRINT);
-        if (rc == TRUE) {
-            printf("TEST ERROR: pmSubtractionCalculateEquation() returned TRUE.\n");
-            testStatus = true;
-        }
-
-        //-------------------------------------------------------------------------
-        printf("Calling with a NULL reference images.  Should generate error, return FALSE.\n");
-        rc = pmSubtractionCalculateEquation(stamps, NULL, tstImg, myKernels, TST03_FOOTPRINT);
-        if (rc == TRUE) {
-            printf("TEST ERROR: pmSubtractionCalculateEquation() returned TRUE.\n");
-            testStatus = true;
-        }
-
-        //-------------------------------------------------------------------------
-        printf("Calling with a NULL input images.  Should generate error, return FALSE.\n");
-        rc = pmSubtractionCalculateEquation(stamps, refImg, NULL, myKernels, TST03_FOOTPRINT);
-        if (rc == TRUE) {
-            printf("TEST ERROR: pmSubtractionCalculateEquation() returned TRUE.\n");
-            testStatus = true;
-        }
-
-        //-------------------------------------------------------------------------
-        printf("Calling with a NULL kernel basis functions.  Should generate error, return FALSE.\n");
-        rc = pmSubtractionCalculateEquation(stamps, refImg, tstImg, NULL, TST03_FOOTPRINT);
-        if (rc == TRUE) {
-            printf("TEST ERROR: pmSubtractionCalculateEquation() returned TRUE.\n");
-            testStatus = true;
-        }
-
-        //-------------------------------------------------------------------------
-        printf("Calling with acceptable input parameters.  Should return TRUE.\n");
-
-        rc = pmSubtractionCalculateEquation(stamps, refImg, tstImg, myKernels, TST03_FOOTPRINT);
-        if (rc != TRUE) {
-            printf("TEST ERROR: pmSubtractionCalculateEquation() returned FALSE.\n");
-            testStatus = true;
-        } else {
-
-            if (0) {
-                for (psS32 s = 0 ; s < stamps->n ; s++) {
-                    printf("********************************* Stamp %d *********************************\n", s);
-                    pmStamp *stamp = (pmStamp *) stamps->data[s];
-                    if (stamp->vector != NULL) {
-                        PS_VECTOR_PRINT_F64(stamp->vector);
-                    }
-                    if (stamp->matrix != NULL) {
-                        printf("Stamp matrix size is (%d, %d)\n", stamp->matrix->numRows, stamp->matrix->numCols);
-                        PS_IMAGE_PRINT_F64(stamp->matrix);
-                    }
-                }
-            }
-
-
-            //-------------------------------------------------------------------------
-            printf("Calling pmSubtractionSolveEquation() with a NULL stamp argument.  Should generate error, return FALSE.\n");
-            psVector *solution = pmSubtractionSolveEquation(NULL, NULL);
-            if (solution != NULL) {
-                printf("TEST ERROR: pmSubtractionSolveEquation() returned non-NULL.\n");
-                testStatus = true;
-            }
-
-            //-------------------------------------------------------------------------
-            printf("Calling pmSubtractionSolveEquation() with acceptable input parameters.  Should return non-NULL.\n");
-            solution = pmSubtractionSolveEquation(NULL, stamps);
-            if (solution == NULL) {
-                printf("TEST ERROR: pmSubtractionSolveEquation() returned NULL.\n");
-                testStatus = true;
-            } else {
-                printf("The solution vector is:\n");
-                for (psS32 i = 0 ; i < solution->n ; i++) {
-                    printf("(%.2f) ", solution->data.F64[i]);
-                }
-                printf("\n");
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionRejectStamps() with acceptable input parameters.  Should return TRUE.\n");
-                rc = pmSubtractionRejectStamps(stamps, maskImg, 0xff, TST03_FOOTPRINT, 1.0, refImg,
-                                               tstImg, solution, myKernels);
-                if (rc != TRUE) {
-                    printf("TEST ERROR: pmSubtractionRejectStamps() returned FALSE.\n");
-                    testStatus = true;
-                } else {}
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() with NULL solution.  Should generate error, return NULL.\n");
-                psImage *kernelImg = pmSubtractionKernelImage(NULL, NULL, myKernels, 0.0, 0.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() with NULL kernels.  Should generate error, return NULL.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, NULL, 0.0, 0.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() unallowable x value.  Should generate error, return NULL.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, myKernels, -2.0, 0.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() unallowable x value.  Should generate error, return NULL.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, myKernels, 2.0, 0.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() unallowable y value.  Should generate error, return NULL.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, myKernels, 0.0, -2.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() unallowable y value.  Should generate error, return NULL.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, myKernels, 0.0, 2.0);
-                if (kernelImg != NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned non-NULL.\n");
-                    testStatus = true;
-                }
-                free(kernelImg);
-
-                //-------------------------------------------------------------------------
-                printf("Calling pmSubtractionKernelImage() with acceptable input parameters.  Should return a psImage.\n");
-                kernelImg = pmSubtractionKernelImage(NULL, solution, myKernels, 0.5, 0.5);
-                if (kernelImg == NULL) {
-                    printf("TEST ERROR: pmSubtractionKernelImage() returned NULL.\n");
-                    testStatus = true;
-                } else {
-                    for (psS32 row = 0 ; row < kernelImg->numRows; row++) {
-                        for (psS32 col = 0 ; col < kernelImg->numCols; col++) {
-                            printf("%f ", kernelImg->data.F32[row][col]);
-                        }
-                        printf("\n");
-                    }
-                }
-                free(kernelImg);
-
-                psFree(solution);
-            }
-        }
-    }
-    psFree(tstImg);
-    psFree(refImg);
-    psFree(stamps);
-    psFree(myKernels);
-    psFree(orders);
-    psFree(sigmas);
-
-    return(testStatus);
-}
-
-/*******************************************************************************
-NOTE: This function returns TRUE if there were no errors.
- ******************************************************************************/
-int test03( void )
-{
-    bool testStatus = false;
-
-
-    srand(1995);
-    if (1)
-        testStatus|= testSubCalcEqu(TST03_NUM_COLS,
-                                    TST03_NUM_ROWS,
-                                    TST03_NUM_STAMPS_COLS,
-                                    TST03_NUM_STAMPS_ROWS,
-                                    TST03_BORDER,
-                                    PM_SUBTRACTION_KERNEL_POIS);
-
-
-    srand(1995);
-    if (1)
-        testStatus|= testSubCalcEqu(TST03_NUM_COLS,
-                                    TST03_NUM_ROWS,
-                                    TST03_NUM_STAMPS_COLS,
-                                    TST03_NUM_STAMPS_ROWS,
-                                    TST03_BORDER,
-                                    PM_SUBTRACTION_KERNEL_ISIS);
-
-
-
-    return(!testStatus);
-}
Index: unk/psModules/test/imsubtract/tst_pmSubtractBias.c
===================================================================
--- /trunk/psModules/test/imsubtract/tst_pmSubtractBias.c	(revision 7212)
+++ 	(revision )
@@ -1,1129 +1,0 @@
-/** @file tst_pmSubtractBias.c
- *
- *  @brief Contains the tests for pmSubtractBias.c:
- *
- * test00a: This code will subtract full bias frames from the input image.
- * XXX: Must test:
- *  Various image offsets.
- *  Various image size combinations.
- *  Various data types for the bias and input images.
- *  Ensure code works when CELL.TRIMSEC is not set.
- * test00b: This code will subtract full dark frames from the input image.
- * XXX: Must test:
- *  Various image offsets.
- *  Various image size combinations.
- *  Various data types for the bias and input images.
- *  Code properly determines CELL.DARKTIME from cell metadata.
- *  Ensure code works when CELL.DARKTIME is not set.
- *  Ensure code works when CELL.TRIMSEC is not set.
- *  test03: Calculate a row overscan vector and subtract it from each
- *  row in the input image.
- * test05:
- *
- *  @author GLG, MHPCC
- *
- *  XXX: Memory leaks are not being detected.
- *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-01-26 21:10:51 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmSubtractBias.h"
-static int test00a(void);
-static int test00b(void);
-//static int test01(void);
-//static int test02(void);
-//static int test03(void);
-//static int test04(void);
-static int test05(void);
-testDescription tests[] = {
-                              {test00a, 000, "doSubtractBiasFullFrame", 0, true},
-                              {test00b, 000, "doSubtractDarkFullFrame", 0, true},
-                              //                              {test01, 000, "pmSubtractBias", 0, true},
-                              //                              {test02, 000, "pmSubtractBias", 0, true},
-                              //                              {test03, 000, "pmSubtractBias", 0, true},
-                              //                              {test04, 000, "pmSubtractBias", 0, true},
-                              {test05, 000, "pmSubtractBias", 0, false},
-                              {NULL}
-                          };
-
-psS32 currentId = 0;
-psS32 memLeaks = 0;             // XXX: remove
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("spline1DFree", 0);
-    psTraceSetLevel("calculateSecondDerivs", 0);
-    psTraceSetLevel("vectorBinDisectF32", 0);
-    psTraceSetLevel("vectorBinDisectF64", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psSpline1DAlloc", 0);
-    psTraceSetLevel("psVectorFitSpline1D", 0);
-    psTraceSetLevel("psSpline1DEval", 0);
-    psTraceSetLevel("psSpline1DEvalVector", 0);
-
-    psS32 currentId = psMemGetId(); // XXX: remove
-    psS32 memLeaks = 0;             // XXX: remove
-    if (0) {
-        PRINT_MEMLEAKS(0);
-    }
-
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-#define NUM_ROWS 8
-#define NUM_COLS 8
-#define MAX_HEADER_MSG_LENGTH 1000
-#define POLYNOMIAL_FIT_ORDER 2
-#define NUM_OVERSCANS 2
-/******************************************************************************
-doSubtractBiasFullFrame(): a sample pmReadout as well as a bias image are
-created and the bias image is subtracted from the pmReadout.
- *****************************************************************************/
-int doSubtractBiasFullFrame(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    pmReadout *myBias = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    myBias->image = tmpImage2;
-
-    char *HeaderMessageStr = (char *) psAlloc(MAX_HEADER_MSG_LENGTH);
-    sprintf(HeaderMessageStr, "doSubtractBiasFullFrame(%d, %d)", numRows, numCols);
-    printPositiveTestHeader(stdout, "pmSubtractBias", HeaderMessageStr);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-            myBias->image->data.F32[i][j] = 1.0;
-        }
-    }
-
-    myReadout = pmSubtractBias(myReadout, NULL, PM_FIT_NONE, false,
-                               NULL, 0, myBias, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 1.0;
-            actual = myReadout->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
-        }
-    }
-
-
-    psFree(myReadout);
-    psFree(myBias);
-    printFooter(stdout, "pmSubtractBias", HeaderMessageStr, true);
-    psFree(HeaderMessageStr);
-    return(testStatus);
-}
-
-
-int test00a( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doSubtractBiasFullFrame(1, 1);
-    testStatus |= doSubtractBiasFullFrame(NUM_COLS, 1);
-    testStatus |= doSubtractBiasFullFrame(1, NUM_ROWS);
-    testStatus |= doSubtractBiasFullFrame(NUM_COLS, NUM_ROWS);
-    return(testStatus);
-}
-
-
-/******************************************************************************
-doSubtractDarkFullFrame(): a sample pmReadout as well as a dark image are
-created and the dark image is subtracted from the pmReadout.
- *****************************************************************************/
-int doSubtractDarkFullFrame(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    pmReadout *myDark = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    myDark->image = tmpImage2;
-
-    char *HeaderMessageStr = (char *) psAlloc(MAX_HEADER_MSG_LENGTH);
-    sprintf(HeaderMessageStr, "doSubtractDarkFullFrame(%d, %d)", numRows, numCols);
-    printPositiveTestHeader(stdout, "pmSubtractBias", HeaderMessageStr);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-            myDark->image->data.F32[i][j] = 1.0;
-        }
-    }
-
-    myReadout = pmSubtractBias(myReadout, NULL, PM_FIT_NONE, false,
-                               NULL, 0, NULL, myDark);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 1.0;
-            actual = myReadout->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
-        }
-    }
-
-
-    psFree(myReadout);
-    psFree(myDark);
-    printFooter(stdout, "pmSubtractBias", HeaderMessageStr, true);
-    psFree(HeaderMessageStr);
-    return(testStatus);
-}
-
-
-int test00b( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doSubtractDarkFullFrame(1, 1);
-    testStatus |= doSubtractDarkFullFrame(NUM_COLS, 1);
-    testStatus |= doSubtractDarkFullFrame(1, NUM_ROWS);
-    testStatus |= doSubtractDarkFullFrame(NUM_COLS, NUM_ROWS);
-    return(testStatus);
-}
-
-
-/*
-int doSubtractOverscansTestInputCases(int numCols, int numRows)
-{
-    int i;
-    int j;
-    int testStatus = 0;
-    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage2Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32);
-    psImage *tmpImage3Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32);
-    psImage *tmpImage4Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    pmReadout *rc = NULL;
-    psList *list;
-    psList *listShort;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psImage *tmpImage5 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myBias = pmReadoutAlloc(NULL);
-    myBias->image = tmpImage5;
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Testing input parameter error conditions");
- 
-    psImage *tmpImage5ShortRows = psImageAlloc(numCols, numRows-1, PS_TYPE_F32);
-    pmReadout *myBiasShortRows = pmReadoutAlloc(NULL);
-    myBiasShortRows->image = tmpImage5ShortRows;
-    psImage *tmpImage5ShortCols = psImageAlloc(numCols-1, numRows, PS_TYPE_F32);
-    pmReadout *myBiasShortCols = pmReadoutAlloc(NULL);
-    myBiasShortCols->image = tmpImage5ShortCols;
- 
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-            tmpImage2->data.F32[i][j] = 3.0;
-            tmpImage3->data.F32[i][j] = 4.0;
-            tmpImage4->data.F32[i][j] = 5.0;
-            myBias->image->data.F32[i][j] = 1.0;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
- 
-    for (i=0;i<numRows-1;i++) {
-        for (j=0;j<numCols-1;j++) {
-            tmpImage2Short->data.F32[i][j] = 3.0;
-            tmpImage3Short->data.F32[i][j] = 4.0;
-            tmpImage4Short->data.F32[i][j] = 5.0;
-        }
-    }
-    listShort = psListAlloc(tmpImage2Short);
-    psListAdd(listShort, PS_LIST_HEAD, tmpImage3Short);
-    psListAdd(listShort, PS_LIST_HEAD, tmpImage4Short);
-    for (i=0;i<numRows-1;i++) {
-        for (j=0;j<numCols;j++) {
-            myBiasShortRows->image->data.F32[i][j] = 1.0;
-        }
-    }
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols-1;j++) {
-            myBiasShortCols->image->data.F32[i][j] = 1.0;
-        }
-    }
- 
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ALL.  Should generate error.\n");
-    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ROWS.  Should generate error.\n");
-    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_COLUMNS.  Should generate error.\n");
-    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with non-NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
-    rc = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_NONE, stat, 0, PM_FIT_NONE, myBias);
- 
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            psF32 expect = ((float) (i + j)) - 1.0;
-            psF32 actual = rc->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
- 
-            // Restore myReadout for next test.
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
- 
-    // XXX: This does not seem to be a requirement.
-    if (0) {
-        printf("------------------------------------------------------------------\n");
-        printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE.  Should generate warning.\n");
-        rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat,
-                            0, PM_FIT_NONE, myBias);
- 
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                psF32 expect = ((float) (i + j)) - 1.0;
-                psF32 actual = rc->image->data.F32[i][j];
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = 1;
-                }
- 
-                // Restore myReadout for next test.
-                myReadout->image->data.F32[i][j] = (float) (i + j);
-            }
-        }
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with PM_OVERSCAN_NONE and PM_FIT_POLYNOMIAL.  Should generate Warning.\n");
-    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_POLYNOMIAL, myBias);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            psF32 expect = ((float) (i + j)) - 1.0;
-            psF32 actual = rc->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
- 
-            // Restore myReadout for next test.
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
- 
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with PM_OVERSCAN_ALL and PM_FIT_SPLINE.  Should generate Warning.\n");
-    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            psF32 expect = ((float) (i + j)) - 1.0;
-            psF32 actual = rc->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
- 
-            // Restore myReadout for next test.
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
- 
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with multiple stats->options.  Should generate Warning.\n");
-    stat->options|= PS_STAT_SAMPLE_MEDIAN;
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_ALL, stat,
-                               0, PM_FIT_NONE, NULL);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            psF32 expect = ((float) (i + j)) - 12.0;
-            psF32 actual = rc->image->data.F32[i][j];
-            if (FLT_EPSILON < fabs(expect - actual)) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                testStatus = 1;
-            }
-        }
-    }
-    stat->options = PS_STAT_SAMPLE_MEAN;
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() undersize overscans (PM_OVERSCAN_ROWS).  Should generate Warning.\n");
-    rc = pmSubtractBias(myReadout, NULL, listShort, PM_OVERSCAN_ROWS, stat,
-                        0, PM_FIT_NONE, NULL);
-    if (0) {
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                psF32 expect = ((float) (i + j)) - 12.0;
-                psF32 actual = rc->image->data.F32[i][j];
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = 1;
-                }
-            }
-        }
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() undersize overscans (PM_OVERSCAN_COLUMNS).  Should generate Warning.\n");
-    rc = pmSubtractBias(myReadout, NULL, listShort, PM_OVERSCAN_COLUMNS, stat,
-                        0, PM_FIT_NONE, NULL);
-    if (0) {
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                psF32 expect = ((float) (i + j)) - 12.0;
-                psF32 actual = rc->image->data.F32[i][j];
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = 1;
-                }
-            }
-        }
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() undersize bias image (short rows).  Should generate Error.\n");
-    myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL,
-                               0, PM_FIT_NONE, myBiasShortRows);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() undersize bias image (short columns).  Should generate Error.\n");
-    myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL,
-                               0, PM_FIT_NONE, myBiasShortCols);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with bogus PM_FIT.  Should generate Error.\n");
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_ROWS, stat,
-                               0, 54321, NULL);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    printf("Calling pmSubtractBias() with bogus overScanAxis.  Should generate Error.\n");
-    myReadout = pmSubtractBias(myReadout, NULL, list, 54321, stat,
-                               0, PM_FIT_NONE, NULL);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
-        testStatus = false;
-        psFree(rc);
-    }
- 
-    if (0) {
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                psF32 expect = ((float) (i + j)) - 12.0;
-                psF32 actual = rc->image->data.F32[i][j];
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = 1;
-                }
-            }
-        }
-    }
- 
-    printf("------------------------------------------------------------------\n");
-    psFree(myReadout);
-    psFree(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(tmpImage2Short);
-    psFree(tmpImage3Short);
-    psFree(tmpImage4Short);
-    psFree(myBias);
-    psFree(myBiasShortRows);
-    psFree(myBiasShortCols);
-    psFree(stat);
-    psFree(list);
-    psFree(listShort);
- 
-    printFooter(stdout, "pmSubtractBias", "Testing input parameter error conditions", true);
-    return(testStatus);
-}
- 
-int test04( void )
-{
-    int testStatus = 0;
- 
-    testStatus |= doSubtractOverscansTestInputCases(NUM_COLS, NUM_ROWS);
-    return(testStatus);
-}
-*/
-
-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_SPLINE2(psSpline1D *mySpline)
-{
-    printf("-------------- PS_PRINT_SPLINE2() --------------\n");
-    if (mySpline != NULL) {
-        printf("mySpline->n is %d\n", mySpline->n);
-        for (psS32 i = 0 ; i < mySpline->n ; i++) {
-            if (mySpline->spline[i] != NULL) {
-                PS_POLY1D_PRINT(mySpline->spline[i]);
-            }
-        }
-        if (mySpline->knots != NULL) {
-            PS_VECTOR_PRINT_F32(mySpline->knots);
-        }
-    } else {
-        printf("NULL\n");
-    }
-    printf("-------------- PS_PRINT_SPLINE2() DONE --------------\n");
-}
-
-
-
-
-
-
-/******************************************************************************
-doSubtractOverscansGeneric(): This is a general version of the
-bias subtraction tests which allows the various parameters to be specified
-as arguments.
- *****************************************************************************/
-int doSubtractOverscansGeneric(
-    int imageNumCols,
-    int imageNumRows,
-    int overscanNumCols,
-    int overscanNumRows,
-    int numOverscans,
-    pmOverscanAxis overscanaxis,
-    pmFit fit,
-    psS32 nBin)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "PUT COMMENT HERE");
-    printf("---- doSubtractOverscansGeneric() ----\n");
-    printf("    Image size: %d by %d\n", imageNumRows, imageNumCols);
-    printf("    Overscan size: %d by %d\n", overscanNumRows, overscanNumCols);
-    printf("    Total Overscans: %d\n", numOverscans);
-    printf("    Binning factor: %d\n", nBin);
-    if (overscanaxis == PM_OVERSCAN_ROWS)
-        printf("    Overscan axis: PM_OVERSCAN_ROWS\n");
-    if (overscanaxis == PM_OVERSCAN_COLUMNS)
-        printf("    Overscan axis: PM_OVERSCAN_COLUMNS\n");
-    if (overscanaxis == PM_OVERSCAN_ALL)
-        printf("    Overscan axis: PM_OVERSCAN_ALL\n");
-    if (overscanaxis == PM_OVERSCAN_NONE)
-        printf("    Overscan axis: PM_OVERSCAN_NONE\n");
-    if (fit == PM_FIT_NONE)
-        printf("    Fit type: PM_FIT_NONE\n");
-    if (fit == PM_FIT_POLYNOMIAL)
-        printf("    Fit type: PM_FIT_POLYNOMIAL\n");
-    if (fit == PM_FIT_SPLINE)
-        printf("    Fit type: PM_FIT_SPLINE\n");
-
-    //
-    // Create and initialize input image, FPA hierarchy.
-    //
-    const psMetadata *camera = psMetadataAlloc();
-    pmFPA* fpa = pmFPAAlloc(camera);
-
-    if (fpa == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "TEST ERROR: pmFPAAlloc returned a NULL.\n");
-        return 1;
-    }
-
-    pmChip *chip = pmChipAlloc(fpa, "ChipName");
-    if (chip == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "TEST ERROR: pmChipAlloc returned a NULL.\n");
-        return 2;
-    }
-
-    pmCell *cell = pmCellAlloc(chip, (psMetadata *) camera, "CellName");
-    if (cell == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "TEST ERROR: pmCellAlloc returned a NULL.\n");
-        return 3;
-    }
-
-    pmReadout *myReadout = pmReadoutAlloc(cell);
-    myReadout->image = psImageAlloc(imageNumCols, imageNumRows, PS_TYPE_F32);
-    for (i=0;i<myReadout->image->numRows;i++) {
-        for (j=0;j<myReadout->image->numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-
-    //
-    // Set overscan axis in the metadata.
-    //
-    psBool rc = false;
-    if (overscanaxis == PM_OVERSCAN_ROWS) {
-        rc = psMetadataAddS32(myReadout->parent->concepts, PS_LIST_HEAD, "CELL.READDIR", 0, NULL, 1);
-    } else if (overscanaxis == PM_OVERSCAN_COLUMNS) {
-        rc = psMetadataAddS32(myReadout->parent->concepts, PS_LIST_HEAD, "CELL.READDIR", 0, NULL, 2);
-    } else if (overscanaxis == PM_OVERSCAN_ALL) {
-        rc = psMetadataAddS32(myReadout->parent->concepts, PS_LIST_HEAD, "CELL.READDIR", 0, NULL, 3);
-    } else if (overscanaxis == PM_OVERSCAN_NONE) {
-        rc = psMetadataAddS32(myReadout->parent->concepts, PS_LIST_HEAD, "CELL.READDIR", 0, NULL, 0);
-    }
-    if (rc == false) {
-        printf("TEST ERROR: Could not set CELL.READDIR metadata.\n");
-        testStatus = 1;
-    }
-
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, POLYNOMIAL_FIT_ORDER);
-    psSpline1D *mySpline = NULL;
-
-
-    if (0) {
-        if (overscanNumRows <= 0) {
-            overscanNumRows = 1;
-        }
-        if (overscanNumCols <= 0) {
-            overscanNumCols = 1;
-        }
-    }
-    psF32 oAverage = 0.0;
-    myReadout->bias = NULL;
-    for (psS32 i = 0 ; i < numOverscans ; i++) {
-        psImage *tmpImage = psImageAlloc(overscanNumCols, overscanNumRows, PS_TYPE_F32);
-        psF32 oValue = (float) (i + 3);
-        PS_IMAGE_SET_F32(tmpImage, oValue);
-        oAverage += oValue;
-        if (myReadout->bias == NULL) {
-            myReadout->bias = psListAlloc(tmpImage);
-        } else {
-            psListAdd(myReadout->bias, PS_LIST_HEAD, tmpImage);
-        }
-    }
-    oAverage/= (psF32) numOverscans;
-    if (0) {
-        if (fit == PM_FIT_NONE) {
-            myReadout = pmSubtractBias(myReadout, NULL, PM_FIT_NONE, overscanaxis,
-                                       stat, nBin, NULL, NULL);
-        } else if (fit == PM_FIT_POLYNOMIAL) {
-            myReadout = pmSubtractBias(myReadout, myPoly, PM_FIT_POLYNOMIAL, overscanaxis,
-                                       stat, nBin, NULL, NULL);
-        } else if (fit == PM_FIT_SPLINE) {
-            //        mySpline = psSpline1DAlloc();
-            myReadout = pmSubtractBias(myReadout, mySpline, PM_FIT_SPLINE, overscanaxis,
-                                       stat, nBin, NULL, NULL);
-        }
-        if (myReadout == NULL ) {
-            printf("TEST ERROR: pmSubtractBias() returned NULL.\n");
-            testStatus = 1;
-        } else {
-            for (i=0;i<imageNumRows;i++) {
-                for (j=0;j<imageNumCols;j++) {
-                    expect = ((float) (i + j)) - oAverage;
-                    actual = myReadout->image->data.F32[i][j];
-                    if (FLT_EPSILON < fabs(expect - actual)) {
-                        printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                        testStatus = 1;
-                    } else {
-                        //printf("GOOD: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    }
-                }
-            }
-        }
-    }
-
-    // HEY
-    psFree(fpa);
-    psFree(stat);
-    psFree(myPoly);
-    psFree(mySpline);
-
-    printFooter(stdout, "pmSubtractBias", "Column Overscans", true);
-    return(testStatus);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-test05a() The following combinations are tested here:
- Overscan images are same size, no fit, bin factor is 1.
- Overscan images are same size, no fit, bin factor is 2.
- *****************************************************************************/
-int test05a(
-    psS32 imageNumCols,
-    psS32 imageNumRows,
-    psS32 overscanNumCols,
-    psS32 overscanNumRows)
-{
-    int testStatus = 0;
-
-    // imageNumCols, imageNumRows, overscanNumCols, overscanNumRows,
-    // overscanaxis, fit, nBin
-
-    //
-    // Overscan images are same size, no fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_NONE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_NONE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_NONE, 1);
-
-    //
-    // Overscan images are same size, no fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_NONE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_NONE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_NONE, 2);
-
-    return(testStatus);
-}
-
-
-/******************************************************************************
-test05b() The following combinations are tested here:
- Overscan images are too small, spline fit, bin factor is 1.
- Overscan images are too small, spline fit, bin factor is 2.
- Overscan images are same size, spline fit, bin factor is 1.
- Overscan images are same size, spline fit, bin factor is 2.
- Overscan images are too big,   spline fit, bin factor is 1.
- Overscan images are too big,   spline fit, bin factor is 2.
- A single overscan image of the same size, spline fit, bin factor is 1.
- 
- Overscan images are too small, polynomial fit, bin factor is 1.
- Overscan images are too small, polynomial fit, bin factor is 2.
- Overscan images are same size, polynomial fit, bin factor is 1.
- Overscan images are same size, polynomial fit, bin factor is 2.
- Overscan images are too big,   polynomial fit, bin factor is 1.
- Overscan images are too big,   polynomial fit, bin factor is 2.
- A single overscan image of the same size, polynomial fit, bin factor is 1.
- 
-XXX: Must add M-by-N image size tests.
- *****************************************************************************/
-int test05b(
-    psS32 imageNumCols,
-    psS32 imageNumRows,
-    psS32 overscanNumCols,
-    psS32 overscanNumRows)
-{
-    int testStatus = 0;
-
-    //
-    // Overscan images are too small, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-
-    //
-    // Overscan images are too small, spline fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 2);
-
-
-    //
-    // Overscan images are same size, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-
-    //
-    // Overscan images are same size, spline fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 2);
-
-    //
-    // Overscan images are too big, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-
-    //
-    // Overscan images are too big, spline fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2 , NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 2);
-
-
-    //
-    // A single overscan image of the same size, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-
-
-    //
-    // Overscan images are too small, polynomial fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    //
-    // Overscan images are too small, polynomial fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols-2, overscanNumRows-2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-
-    //
-    // Overscan images are same size, polynomial fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    //
-    // Overscan images are same size, polynomial fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    //
-    // Overscan images are too big, polynomial fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    //
-    // Overscan images are too big, polynomial fit, bin factor is 2.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols+2, overscanNumRows+2, NUM_OVERSCANS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    //
-    // A single overscan image of the same size, polynomial fit, bin factor is 1.
-    //
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractOverscansGeneric(imageNumCols, imageNumRows,
-                  overscanNumCols, overscanNumRows, 1,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    return(testStatus);
-}
-
-
-
-#define LOW_COLS 3
-#define LOW_ROWS 3
-
-/******************************************************************************
-test05(): See test05a() and test05b().
- 
-We run the tests in test05b() starting with all possible combinations of
-sizes.
- 
-XXX: Must add M-by-N image size tests.
- *****************************************************************************/
-int test05()
-{
-    int testStatus = 0;
-    //    testStatus = test05a(NUM_COLS, NUM_ROWS, NUM_COLS, NUM_ROWS);
-
-    //    testStatus|= test05b(LOW_COLS, LOW_ROWS, LOW_COLS, LOW_ROWS);
-    //    testStatus|= test05b(LOW_COLS, LOW_ROWS, LOW_COLS, NUM_ROWS);
-    //    testStatus|= test05b(LOW_COLS, LOW_ROWS, NUM_COLS, LOW_ROWS);
-    //    testStatus|= test05b(LOW_COLS, LOW_ROWS, NUM_COLS, NUM_ROWS);
-
-    //    testStatus|= test05b(LOW_COLS, NUM_ROWS, LOW_COLS, LOW_ROWS);
-    //    testStatus|= test05b(LOW_COLS, NUM_ROWS, LOW_COLS, NUM_ROWS);
-    //    testStatus|= test05b(LOW_COLS, NUM_ROWS, NUM_COLS, LOW_ROWS);
-    //    testStatus|= test05b(LOW_COLS, NUM_ROWS, NUM_COLS, NUM_ROWS);
-
-    //    testStatus|= test05b(NUM_COLS, LOW_ROWS, LOW_COLS, LOW_ROWS);
-    //    testStatus|= test05b(NUM_COLS, LOW_ROWS, LOW_COLS, NUM_ROWS);
-    //    testStatus|= test05b(NUM_COLS, LOW_ROWS, NUM_COLS, LOW_ROWS);
-    //    testStatus|= test05b(NUM_COLS, LOW_ROWS, NUM_COLS, NUM_ROWS);
-
-    //    testStatus|= test05b(NUM_COLS, NUM_ROWS, LOW_COLS, LOW_ROWS);
-    //    testStatus|= test05b(NUM_COLS, NUM_ROWS, LOW_COLS, NUM_ROWS);
-    //    testStatus|= test05b(NUM_COLS, NUM_ROWS, NUM_COLS, LOW_ROWS);
-    testStatus|= test05b(NUM_COLS, NUM_ROWS, NUM_COLS, NUM_ROWS);
-
-
-    return(testStatus);
-}
-
Index: unk/psModules/test/imsubtract/tst_pmSubtractSky.c
===================================================================
--- /trunk/psModules/test/imsubtract/tst_pmSubtractSky.c	(revision 7212)
+++ 	(revision )
@@ -1,375 +1,0 @@
-/** @file tst_pmSubtractSky.c
- *
- *  @brief Contains the tests for pmSubtractSky.c:
- *
- * test00: This code will test the pmSubtractSky routine.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-06 21:23:46 $
- *
- *  XXX: I added the CELL.TRIMSEC region code but there are not tests for it.
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-#include "psTest.h"
-#include "pslib.h"
-#include "pmSubtractSky.h"
-#define NUM_ROWS 512
-#define NUM_COLS 512
-#define POLY_X_ORDER 3
-#define POLY_Y_ORDER 3
-#define ERROR_TOLERANCE 1.0
-#define OBJECT_INTENSITY 2000.0
-static int test00(void);
-static int test01(void);
-testDescription tests[] = {
-                              {test00, 000, "pmSubtractSky", 0, false},
-                              {test01, 000, "pmSubtractSky: warning, error messages", 0, false},
-                              {NULL}
-                          };
-
-float func(int i, int j)
-{
-    return((float) (i + j));
-}
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-    //    test00();
-}
-
-/******************************************************************************
- *****************************************************************************/
-int doSubtractSkySimple(int numCols, int numRows, int binFactor)
-{
-    int i;
-    int j;
-    int testStatus = 0;
-    psImage *tmpImageF32 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImageF32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImageF32;
-    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER);
-
-    printPositiveTestHeader(stdout, "pmSubtractSky", "doSubtractSkySimple");
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = func(i, j);
-        }
-    }
-
-    myReadout = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL,
-                              binFactor, myStats, 10.0);
-    if (myReadout == NULL) {
-        printf("TEST ERROR: pmSubtractSky() returned NULL.\n");
-        testStatus = 1;
-    } else {
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                if (ERROR_TOLERANCE < fabs(myReadout->image->data.F32[i][j])) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]);
-                    testStatus = 1;
-                }
-            }
-        }
-    }
-    psFree(myReadout);
-    psFree(myStats);
-    psFree(myPoly);
-    printFooter(stdout, "pmSubtractSky", "doSubtractSkySimple", true);
-    return(testStatus);
-}
-
-/******************************************************************************
- *****************************************************************************/
-int doSubtractSkyWithObjects(int numCols, int numRows, int binFactor)
-{
-    int i;
-    int j;
-    int testStatus = 0;
-    psImage *tmpImageF32 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImageF32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImageF32;
-    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER);
-    psImage *trueImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psF32 errorTolerance = ERROR_TOLERANCE * ((psF32) binFactor);
-
-    printPositiveTestHeader(stdout, "pmSubtractSky", "doSubtractSkyWithObjects");
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = func(i, j);
-        }
-    }
-    // We insert a few bright spots in the image.
-    myReadout->image->data.F32[NUM_ROWS/4][NUM_COLS/4]+= OBJECT_INTENSITY;
-    myReadout->image->data.F32[NUM_ROWS/4][3*NUM_COLS/4]+= OBJECT_INTENSITY;
-    myReadout->image->data.F32[3*NUM_ROWS/4][NUM_COLS/4]+= OBJECT_INTENSITY;
-    myReadout->image->data.F32[3*NUM_ROWS/4][3*NUM_COLS/4]+= OBJECT_INTENSITY;
-    PS_IMAGE_SET_F32(trueImage, 0.0);
-    trueImage->data.F32[NUM_ROWS/4][NUM_COLS/4]+= OBJECT_INTENSITY;
-    trueImage->data.F32[NUM_ROWS/4][3*NUM_COLS/4]+= OBJECT_INTENSITY;
-    trueImage->data.F32[3*NUM_ROWS/4][NUM_COLS/4]+= OBJECT_INTENSITY;
-    trueImage->data.F32[3*NUM_ROWS/4][3*NUM_COLS/4]+= OBJECT_INTENSITY;
-
-    myReadout = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL,
-                              binFactor, myStats, 2.0);
-    if (myReadout == NULL) {
-        printf("TEST ERROR: pmSubtractSky() returned NULL.\n");
-        testStatus = 1;
-    } else {
-        for (i=0;i<numRows;i++) {
-            for (j=0;j<numCols;j++) {
-                if (errorTolerance < fabs(myReadout->image->data.F32[i][j] - trueImage->data.F32[i][j])) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j,
-                           myReadout->image->data.F32[i][j], trueImage->data.F32[i][j]);
-                    testStatus = 1;
-                }
-            }
-        }
-    }
-    psFree(myReadout);
-    psFree(myStats);
-    psFree(myPoly);
-    psFree(trueImage);
-    printFooter(stdout, "pmSubtractSky", "doSubtractSkyWithObjects", true);
-    return(testStatus);
-}
-
-
-int test00( void )
-{
-    int testStatus = 0;
-
-    psTraceSetLevel(".", 0);
-
-    // Bin Factor == 1
-    printf("doSubtractSkySimple(1, 1, 1)\n");
-    testStatus |= doSubtractSkySimple(1, 1, 1);
-    printf("doSubtractSkySimple(NUM_COLS, 1, 1)\n");
-    testStatus |= doSubtractSkySimple(NUM_COLS, 1, 1);
-
-    printf("doSubtractSkySimple(1, NUM_ROWS, 1)\n");
-    testStatus |= doSubtractSkySimple(1, NUM_ROWS, 1);
-    printf("doSubtractSkySimple(NUM_COLS, NUM_ROWS, 1)\n");
-    testStatus |= doSubtractSkySimple(NUM_COLS, NUM_ROWS, 1);
-
-    // Bin Factor == 2
-    printf("doSubtractSkySimple(1, 1, 2)\n");
-    testStatus |= doSubtractSkySimple(1, 1, 2);
-    printf("doSubtractSkySimple(NUM_COLS, 1, 2)\n");
-    testStatus |= doSubtractSkySimple(NUM_COLS, 1, 2);
-    printf("doSubtractSkySimple(1, NUM_ROWS, 2)\n");
-    testStatus |= doSubtractSkySimple(1, NUM_ROWS, 2);
-    printf("doSubtractSkySimple(NUM_COLS, NUM_ROWS, 2)\n");
-    testStatus |= doSubtractSkySimple(NUM_COLS, NUM_ROWS, 2);
-
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 1)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 1);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 2)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 2);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 4)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 8);
-
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 8)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 8);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 16)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 16);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 32)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 32);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 64)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 64);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 128)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 128);
-    printf("doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 256)\n");
-    testStatus |= doSubtractSkyWithObjects(NUM_COLS, NUM_ROWS, 256);
-
-    return(testStatus);
-}
-
-#define NUM_ROWS_SMALL 16
-#define NUM_COLS_SMALL 16
-int test01( void )
-{
-    int testStatus = 0;
-    psS32 i;
-    psS32 j;
-    psImage *tmpImageF32 = psImageAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, PS_TYPE_F32);
-    psImage *tmpImageF64 = psImageAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, PS_TYPE_F64);
-    //    pmReadout *myReadout = pmReadoutAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, tmpImageF32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImageF32;
-    pmReadout *rc = NULL;
-    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER);
-
-    printPositiveTestHeader(stdout, "pmSubtractSky", "Testing bad input parameter conditions.");
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            myReadout->image->data.F32[i][j] = func(i, j);
-        }
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with NULL pmReadout.  Should error.\n\n");
-    rc = pmSubtractSky(NULL, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with NULL pmReadout->image.  Should error.\n\n");
-    myReadout->image = NULL;
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-    myReadout->image = tmpImageF32;
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with PS_TYPE_F64 pmReadout->image.  Should error.\n\n");
-    myReadout->image = tmpImageF64;
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-    myReadout->image = tmpImageF32;
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with NULL fitSpec.  Should return image, no ERROR, no WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with PM_FIT_NONE fit.  Should return image, no ERROR, no WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit.  Should return image, no ERROR, no WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with NULL myStats.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, NULL, 2.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-
-    printf("----------------------------------------------------------------\n");
-    psU64 oldOptions = myStats->options;
-    myStats->options = 0;
-    printf("Calling pmSubtractSky() with no myStats->options specified.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-    myStats->options = oldOptions;
-
-    printf("----------------------------------------------------------------\n");
-    oldOptions = myStats->options;
-    myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_MEDIAN;
-    printf("Calling pmSubtractSky() with multiple myStats->options specified.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-    myStats->options = oldOptions;
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with 0 binFactor.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 0, myStats, 2.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with -1 binFactor.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, -1, myStats, 2.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with -1.0 clipSD.  Should fit entire image, generate WARNING.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, -1.0);
-    for (i=0;i<NUM_ROWS_SMALL;i++) {
-        for (j=0;j<NUM_COLS_SMALL;j++) {
-            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
-                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
-                       rc->image->data.F32[i][j]);
-                testStatus = false;
-            }
-        }
-    }
-
-    printf("----------------------------------------------------------------\n");
-    printf("Calling pmSubtractSky() with bogus psFit.  Should generate Error.\n\n");
-    rc = pmSubtractSky(myReadout, (void *) myPoly, 54321, 1, myStats, -1.0);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
-        testStatus = false;
-    }
-
-
-    //    myReadout = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL,
-    //                              1, myStats, 2.0);
-
-
-    printf("----------------------------------------------------------------\n");
-    psFree(myReadout);
-    psFree(myStats);
-    psFree(myPoly);
-    psFree(tmpImageF64);
-    printFooter(stdout, "pmSubtractSky", "Testing bad input parameter conditions.", true);
-    return(testStatus);
-}
