Index: unk/psModules/src/pmSubtractSky.c
===================================================================
--- /trunk/psModules/src/pmSubtractSky.c	(revision 5170)
+++ 	(revision )
@@ -1,720 +1,0 @@
-/** @file  pmSubtractSky.c
- *
- *  This file will contain a module which will create a model of the
- *  background sky and subtract that from the input image.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-23 01:55:30 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- *      
- *
- */
-
-#include<stdio.h>
-#include<math.h>
-#include "pslib.h"
-#include "psConstants.h"
-#include "pmSubtractSky.h"
-
-/******************************************************************************
-DetermineNumBits(data): This routine takes an enum psStatsOptions as an
-argument and returns the number of non-zero bits.
- 
-XXX: This code is duplicated in the ReadoutCombine file.
- *****************************************************************************/
-static psS32 DetermineNumBits(psStatsOptions data)
-{
-    psTrace("SubtractSky.DetermineNumBits", 4, "Calling DetermineNumBits(0x%x)\n", data);
-
-    psS32 i;
-    psU64 tmpData = data;
-    psS32 numBits = 0;
-
-    for (i=0;i<(8 * sizeof(psStatsOptions));i++) {
-        if (0x0001 & tmpData) {
-            numBits++;
-        }
-        tmpData = tmpData >> 1;
-    }
-
-    psTrace("SubtractSky.DetermineNumBits", 4,
-            "Calling DetermineNumBits(0x%x) -> %d\n", data, numBits);
-    return(numBits);
-}
-
-/******************************************************************************
-getHighestPriorityStatOption(statOptions): this routine takes as input a
-psStats->options with multiple options set and returns one with a single
-option set according to the precedence set in the SDRS.
- *****************************************************************************/
-static psU64 getHighestPriorityStatOption(psU64 statOptions)
-{
-    psTrace("SubtractSky.getHighestPriorityStatOption", 4,
-            "Calling getHighestPriorityStatOption(0x%x)\n", statOptions);
-
-    if (statOptions & PS_STAT_SAMPLE_MEAN) {
-        return(PS_STAT_SAMPLE_MEAN);
-    } else if (statOptions & PS_STAT_SAMPLE_MEDIAN) {
-        return(PS_STAT_SAMPLE_MEDIAN);
-    } else if (statOptions & PS_STAT_CLIPPED_MEAN) {
-        return(PS_STAT_CLIPPED_MEAN);
-    } else if (statOptions & PS_STAT_ROBUST_MEAN) {
-        return(PS_STAT_ROBUST_MEAN);
-    } else if (statOptions & PS_STAT_ROBUST_MEDIAN) {
-        return(PS_STAT_ROBUST_MEDIAN);
-    } else if (statOptions & PS_STAT_ROBUST_MODE) {
-        return(PS_STAT_ROBUST_MODE);
-    }
-    psError(PS_ERR_UNKNOWN, true, "Unallowable option requested for statistically binning image pixels.\n");
-    return(-1);
-}
-
-/******************************************************************************
-psImage *binImage(origImage, binFactor, statOptions): This routine takes an
-input psImage and scales it smaller by a factor of binFactor.  The statistic
-used in combining input pixels is specified in statOptions.
- 
-XXX: use static vectors for myStats, binVector and binMask.
-XXX: I coded this before I was aware of a psLib reBin function.  I don't
-use this function in this module.  I'm keeping it here in the event that
-requirements change and we might need a custom reBin function.
- *****************************************************************************/
-/*
-static psImage *binImage(psImage *origImage,
-                         int binFactor,
-                         psStatsOptions statOptions)
-{
-    psTrace("SubtractSky.binImage", 4, "Calling binImage(%d)\n", binFactor);
- 
-    if (binFactor <= 0) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: binImage(): binFactor is %d\n", binFactor);
-        return(origImage);
-    }
-    if (binFactor == 1) {
-        return(origImage);
-    }
- 
-    psVector *binVector = psVectorAlloc(binFactor * binFactor, PS_TYPE_F32);
-    psVector *binMask = psVectorAlloc(binFactor * binFactor, PS_TYPE_U8);
-    psStats *myStats = psStatsAlloc(statOptions);
- 
-    for (psS32 row = 0; row < origImage->numRows ; row+=binFactor) {
-        for (psS32 col = 0; col < origImage->numCols ; col+=binFactor) {
-            psS32 count = 0;
-            for (psS32 binRow = 0; binRow <= binFactor ; binRow++) {
-                for (psS32 binCol = 0; binCol <= binFactor ; binCol++) {
-                    if (((row + binRow) < origImage->numRows) &&
-                            ((col + binCol) < origImage->numCols)) {
-                        binVector->data.F32[count] =
-                            origImage->data.F32[row + binRow][col + binCol];
-                        binMask->data.U8[count] = 0;
-                    } else {
-                        binVector->data.F32[count] = 0.0;
-                        binMask->data.U8[count] = 1;
-                    }
-                    count++;
-                }
-            }
-            psStats *rc1 = psVectorStats(myStats, binVector, NULL, binMask, 1);
-            if (rc1 == NULL) {
-                psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning in image.\n");
-                return(origImage);
-            }
-            psF64 statValue;
-            psBool rc = p_psGetStatValue(rc1, &statValue);
- 
-            if (rc == true) {
-                origImage->data.F32[row][col] = (psF32) statValue;
-            } else {
-                origImage->data.F32[row][col] = 0.0;
-                psLogMsg(__func__, PS_LOG_WARN,
-                         "WARNING: pmSubtractSky(), binImage(): p_psGetStatValue() was FALSE\n");
-            }
-        }
-    }
-    psFree(binVector);
-    psFree(binMask);
-    psFree(myStats);
- 
-    psTrace("SubtractSky.binImage", 4, "Exiting binImage(%d)\n", binFactor);
-    return(origImage);
-}
-*/
-
-/******************************************************************************
-CalculatePolyTerms(xOrder, yOrder): this routine will calculate the number of
-coefficients (or terms) in a 2-D polynomial of order (xOrder, yOrder).
- 
-XXX: Use your brain and figure out the analytical expression.
- *****************************************************************************/
-static psS32 CalculatePolyTerms(psS32 xOrder, psS32 yOrder)
-{
-    psTrace("SubtractSky.CalculatePolyTerms", 4,
-            "Calling CalculatePolyTerms(%d, %d)\n", xOrder, yOrder);
-
-    psS32 maxOrder = PS_MAX(xOrder, yOrder);
-    psS32 localPolyTerms = 0;
-    psS32 order = 0;
-    psS32 num=0;
-
-    for (order=0;order<=maxOrder;order++) {
-        for (num=0;num<=order;num++) {
-            if (((order-num) <= xOrder) && (num <= yOrder)) {
-                localPolyTerms++;
-            }
-        }
-    }
-
-    psTrace("SubtractSky.CalculatePolyTerms", 4,
-            "Exiting CalculatePolyTerms(%d, %d) -> %d\n", xOrder, yOrder, localPolyTerms);
-    return(localPolyTerms);
-}
-
-/******************************************************************************
-buildPolyTerms(): this routine computes a 2-D array polyTerms[][] that holds
-terms for the polynomial that is used to model the sky background.  We use
-this array primarily for convenience in computations involving sky model
-polynomials.  It is defined as:
-    polyTerms[i][0] = the power to which X is raised in the i-th term of in an
-    poly-order sky background polynomial.
- 
-    polyTerms[i][1] = the power to which Y is raised in the i-th term of in an
-    poly-order sky background polynomial.
- *****************************************************************************/
-static psS32 **buildPolyTerms(psS32 xOrder, psS32 yOrder)
-{
-    psTrace("SubtractSky.buildPolyTerms", 4,
-            "Calling buildPolyTerms(%d, %d)\n", xOrder, yOrder);
-
-    psS32 i=0;
-    psS32 order = 0;
-    psS32 num=0;
-    psS32 localPolyTerms = CalculatePolyTerms(xOrder, yOrder);
-    psS32 maxOrder = PS_MAX(xOrder, yOrder);
-
-    // Create the data structure which we hold the xy order of each coeff.
-    psS32 **polyTerms = (psS32 **) psAlloc(localPolyTerms * sizeof(psS32 *));
-    for (i=0; i < localPolyTerms ; i++) {
-        polyTerms[i] = (psS32 *) psAlloc(2 * sizeof(psS32));
-    }
-
-    i=0;
-    // This code segment loops through each term i in the polynomial and
-    // calculates the power to which x/y are raised in that i-th term.
-    // We first do the 0-order terms, then the 1-order terms, etc.
-    for (order=0;order<=maxOrder;order++) {
-        for (num=0;num<=order;num++) {
-            if (((order-num) <= xOrder) && (num <= yOrder)) {
-                polyTerms[i][0] = order-num;
-                polyTerms[i][1] = num;
-                i++;
-            }
-        }
-    }
-
-    if (psTraceGetLevel(".psModule.pmSubtractSky.buildPolyTerms") >= 10) {
-        for (i=0; i < localPolyTerms ; i++) {
-            printf("x^%d * y^%d\n", polyTerms[i][0], polyTerms[i][1]);
-        }
-    }
-
-    psTrace("SubtractSky.buildPolyTerms", 4,
-            "Exiting buildPolyTerms(%d, %d)\n", xOrder, yOrder);
-    return(polyTerms);
-}
-
-/******************************************************************************
-This procedure calculates various combinations of powers of x and y and stores
-them in the data structure p_psPolySums[][].  After it completes:
- 
-    p_psPolySums[i][j] == x^i * y^j
- 
-XXX: Use a psImage for the p_psPolySums data structure?
-XXX: p_psPolySums: should this be a global?  Did you get the storage classifier
-     and name correct?
-XXX: Use variable size arrays for p_psPolySums[][].
-XXX: Must initialize p_psPolySums[][]?
- *****************************************************************************/
-#define PS_MAX_POLYNOMIAL_ORDER 20
-
-psF64 p_psPolySums[PS_MAX_POLYNOMIAL_ORDER+1][PS_MAX_POLYNOMIAL_ORDER+1];
-static void buildSums(psF64 x,
-                      psF64 y,
-                      psS32 xOrder,
-                      psS32 yOrder)
-{
-    psTrace("SubtractSky.buildPolyTerms", 4,
-            "Calling buildPolyTerms(%d, %d)\n", xOrder, yOrder);
-
-    psS32 i = 0;
-    psS32 j = 0;
-    psF64 xSum = 0.0;
-    psF64 ySum = 0.0;
-
-    xSum = 1.0;
-    ySum = 1.0;
-    for(i=0;i<=xOrder;i++) {
-        ySum = xSum;
-        for(j=0;j<=yOrder;j++) {
-            p_psPolySums[i][j] = ySum;
-            ySum*= y;
-        }
-        xSum*= x;
-    }
-    psTrace("SubtractSky.buildPolyTerms", 4,
-            "Exiting buildPolyTerms(%d, %d)\n", xOrder, yOrder);
-}
-
-/******************************************************************************
-ImageFitPolynomial(myPoly, dataImage, maskImage): this private routine takes
-an input image along with a mask and fits a polynomial to it.  The degree of
-the polynomial is specified by input parameter myPoly, and need not be
-symmetrical in orders of X and Y.  The polynomial must be type
-PS_POLYNOMIAL_ORD.  If there are not enough rows or columns in the input image
-for the order of the polynomial, then that order is reduced.  The algorithm
-used in this routine is based on that of the pilot project ADD, but is not
-documented anywhere.
- 
-XXX: Different trace message facilities in use here.
- *****************************************************************************/
-static psPolynomial2D *ImageFitPolynomial(psPolynomial2D *myPoly,
-        psImage *dataImage,
-        psImage *maskImage)
-{
-    psTrace("SubtractSky.ImageFitPolynomial", 4,
-            "Calling ImageFitPolynomial()\n");
-    PS_ASSERT_POLY_NON_NULL(myPoly, NULL);
-    PS_ASSERT_POLY_TYPE(myPoly, PS_POLYNOMIAL_ORD, NULL);
-    PS_ASSERT_IMAGE_NON_NULL(dataImage, NULL);
-    PS_ASSERT_IMAGE_NON_EMPTY(dataImage, NULL);
-    PS_ASSERT_IMAGE_TYPE(dataImage, PS_TYPE_F32, NULL);
-    PS_ASSERT_IMAGE_NON_NULL(maskImage, NULL);
-    PS_ASSERT_IMAGE_NON_EMPTY(maskImage, NULL);
-    PS_ASSERT_IMAGE_TYPE(maskImage, PS_TYPE_U8, NULL);
-    PS_ASSERT_IMAGES_SIZE_EQUAL(dataImage, maskImage, NULL);
-    psS32 oldPolyX = -1;
-    psS32 oldPolyY = -1;
-
-    // The matrix equations become singular if there are more powers of X
-    // in myPoly then there are rows of the image.  I think.  Similarly for
-    // powers of Y and columns.  So.  Here we reduce the complexity of the
-    // polynomial if there are not enough rows/columns in the input image.
-
-    if ((myPoly->COOL_2D_nX + 1) > dataImage->numRows) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.\n");
-        oldPolyX = myPoly->COOL_2D_nX;
-        myPoly->COOL_2D_nX = dataImage->numRows - 1;
-    }
-    if ((myPoly->COOL_2D_nY + 1) > dataImage->numCols) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.\n");
-        oldPolyY = myPoly->COOL_2D_nY;
-        myPoly->COOL_2D_nY = dataImage->numCols - 1;
-    }
-    psS32 i;
-    psS32 j;
-    psS32 x;
-    psS32 y;
-    psS32 aRow;
-    psS32 aCol;
-    psS32 **polyTerms = buildPolyTerms(myPoly->COOL_2D_nX, myPoly->COOL_2D_nY);
-    // We determine how many coefficients will be in the polynomial that we
-    // are fitting to this image.
-    psS32 localPolyTerms = CalculatePolyTerms(myPoly->COOL_2D_nX, myPoly->COOL_2D_nY);
-    psImage *A = psImageAlloc(localPolyTerms, localPolyTerms, PS_TYPE_F64);
-    psImage *Aout = psImageAlloc(localPolyTerms, localPolyTerms, PS_TYPE_F64);
-    psVector *B = psVectorAlloc(localPolyTerms, PS_TYPE_F64);
-    psVector *outPerm = NULL;
-
-    //
-    // Initialize A matrix and B vector.
-    //
-    PS_IMAGE_SET_F64(A, 0.0);
-    PS_VECTOR_SET_F64(B, 0.0);
-
-    //
-    // We build the A matrix and B vector.
-    //
-    for (x=0;x<dataImage->numRows;x++) {
-        for (y=0;y<dataImage->numCols;y++) {
-            if (maskImage->data.U8[x][y] == 0) {
-                buildSums((psF64) x, (psF64) y, myPoly->COOL_2D_nX, myPoly->COOL_2D_nY);
-
-                /************************************************************
-                This code dervies from equation (7) of the pilot ADD.  However,
-                it is not exactly the same in that the order of the polynomial
-                may be different in X And Y.
-
-                Equation (7) from the pilot ADD describes 16 linear equations.
-                The i-th equation is simply the partial derivative of the
-                sky background polynomial (1) w.r.t. to the i-th term in
-                that polynomial.  The i-th equation is stored in row i of
-                matrix A[][] (matrix A[][] has origin (1,1), not (0,0)).  To
-                compute A[i][j] we simply multiply the j-th term of the Sky
-                Background Polynomial (SBP) by the i-th term of SBP.
-                ************************************************************/
-                for (aRow=0;aRow<localPolyTerms;aRow++) {
-                    for (aCol=0;aCol<localPolyTerms;aCol++) {
-                        A->data.F64[aRow][aCol]+=
-                            (p_psPolySums[ polyTerms[aCol][0] ][ polyTerms[aCol][1] ] *
-                             p_psPolySums[ polyTerms[aRow][0] ][ polyTerms[aRow][1] ]);
-                    }
-                }
-                // Build the B[] vector, which is the right-hand side of (7).
-                for (i=0;i<localPolyTerms;i++) {
-                    B->data.F64[i]+= dataImage->data.F32[x][y] *
-                                     p_psPolySums[ polyTerms[i][0] ][ polyTerms[i][1] ];
-                }
-            }
-        }
-    }
-
-    if (psTraceGetLevel(".psModule.pmSubtractSky.ImageFitPolynomial") >= 8) {
-        for (aRow=0;aRow<localPolyTerms;aRow++) {
-            for (aCol=0;aCol<localPolyTerms;aCol++) {
-                printf("A[%d][%d] is %f\n", aRow, aCol,
-                       A->data.F64[aRow][aCol]);
-            }
-        }
-
-        for (i=0;i<=localPolyTerms;i++) {
-            printf("B[%d] is %f\n", i, B->data.F64[i]);
-        }
-    }
-
-    //
-    // Solve the matrix equations for the polynomial coefficients C.
-    // XXX: How do we know if these matrix operations were successful?
-    //
-    Aout = psMatrixLUD(Aout, &outPerm, A);
-    PS_ASSERT_IMAGE_NON_NULL(Aout, NULL);
-    PS_ASSERT_IMAGE_NON_EMPTY(Aout, NULL);
-    psVector *C = psVectorAlloc(localPolyTerms, PS_TYPE_F64);
-    psMatrixLUSolve(C, Aout, B, outPerm);
-
-    //
-    // Set the appropriate coefficients in the myPoly structure.
-    //
-    for (i=0;i<localPolyTerms;i++) {
-        myPoly->coeff[ polyTerms[i][0] ][ polyTerms[i][1] ] = C->data.F64[i];
-        psTrace(".psModule.pmSubtractSky.ImageFitPolynomial", 6,
-                "myPoly->coeff[%d][%d] is %f\n", polyTerms[i][0], polyTerms[i][1], myPoly->coeff[ polyTerms[i][0] ][ polyTerms[i][1] ]);
-    }
-
-    //
-    // Free data structures that were allocated in this module.
-    //
-    for (i=0;i<localPolyTerms;i++) {
-        psFree(polyTerms[i]);
-    }
-    psFree(polyTerms);
-    psFree(A);
-    psFree(Aout);
-    psFree(B);
-    psFree(C);
-    psFree(outPerm);
-
-    //
-    // We restore the original size of the polynomial and set remaining
-    // coefficients to 0.0, if necessary.
-    //
-    // XXX: Verify this works after poly nOrder/nTerm change.
-    //
-    if (oldPolyX != -1) {
-        myPoly->COOL_2D_nX = oldPolyX;
-        for (i=oldPolyX ; i < (1 + myPoly->COOL_2D_nX) ; i++) {
-            for (j=0;j<(1 + myPoly->COOL_2D_nY) ; j++) {
-                myPoly->coeff[i][j] = 0.0;
-            }
-        }
-    }
-    if (oldPolyY != -1) {
-        myPoly->COOL_2D_nY = oldPolyY;
-        for (i=0 ; i < (1 + myPoly->COOL_2D_nX) ; i++) {
-            for (j=oldPolyY;j < (1 + myPoly->COOL_2D_nY) ; j++) {
-                myPoly->coeff[i][j] = 0.0;
-            }
-        }
-    }
-
-    psTrace("SubtractSky.ImageFitPolynomial", 4,
-            "Exiting ImageFitPolynomial()\n");
-    //    psTrace(".psModule.pmSubtractSky.ImageFitPolynomial", 4,
-    //            "---- ImageFitPolynomial() end successfully ----\n");
-    return(myPoly);
-}
-
-
-/******************************************************************************
-pmReadout pmSubtractSky():
- 
-XXX: use static vectors for myStats, and the binned image
- 
-XXX: The SDR is silent about types.  PS_TYPE_F32 is implemented here.
- 
-XXX: Sync the psTrace message facilities.
- *****************************************************************************/
-pmReadout *pmSubtractSky(pmReadout *in,
-                         void *fitSpec,
-                         psFit fit,
-                         psS32 binFactor,
-                         psStats *stats,
-                         psF32 clipSD)
-{
-    PS_ASSERT_READOUT_NON_NULL(in, NULL);
-    PS_ASSERT_READOUT_NON_EMPTY(in, NULL);
-    PS_ASSERT_READOUT_TYPE(in, PS_TYPE_F32, NULL);
-    psTrace(".psModule.pmSubtractSky", 4,
-            "---- pmSubtractSky() begin ----\n");
-
-    if ((fit != PM_FIT_NONE) &&
-            (fit != PM_FIT_POLYNOMIAL) &&
-            (fit != PM_FIT_SPLINE)) {
-        psError(PS_ERR_UNKNOWN, true, "psFit is unallowable (%d).  Returning in image.\n", fit);
-        return(in);
-    }
-
-    psStatsOptions statOptions = 0;
-
-    //
-    // Return the original input readout if the fit specs are poorly defined.
-    // No warning or error messages should be generated.
-    //
-    if ((fitSpec == NULL) ||
-            ((fit == PM_FIT_NONE) || (fit == PM_FIT_SPLINE))) {
-        //        psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined.  Returning in image.\n");
-        return(in);
-    }
-    psImage *origImage = in->image;
-    psImage *binnedImage = NULL;
-    psPolynomial2D *myPoly = NULL;
-    psImage *binnedMaskImage = NULL;
-    psU32 oldStatOptions = 0;
-
-    //
-    // Determine which statistic to use when binning pixels, if any.
-    //
-    if (stats != NULL) {
-        statOptions = stats->options;
-        if (1 < DetermineNumBits(statOptions)) {
-            psLogMsg(__func__, PS_LOG_WARN, "WARNING: Multiple statistical options have been requested.\n");
-            statOptions = getHighestPriorityStatOption(statOptions);
-            if (statOptions == -1) {
-                psError(PS_ERR_UNKNOWN, true, "Not allowable stats->option was specified.  Returning in image.\n");
-                return(in);
-            }
-            // Save old input "stats" parameter.
-            oldStatOptions = stats->options;
-            stats->options = statOptions;
-        }
-        if (0 == DetermineNumBits(statOptions)) {
-            psLogMsg(__func__, PS_LOG_WARN,
-                     "WARNING: pmSubtractSky(): no stats->options was requested\n");
-        }
-    }
-
-    //
-    // Generate required warning messages.
-    //
-    if (binFactor <= 0) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: pmSubtractSky(): binFactor is %d\n", binFactor);
-    }
-    if (stats == NULL) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: pmSubtractSky(): input parameter stats is NULL\n");
-    }
-
-    //
-    // Bin the input image according to input parameters.
-    // Create a new binned image mask.
-    //
-    if ((binFactor <= 1) || (stats == NULL) || (0 == DetermineNumBits(statOptions))) {
-        // No binning is required here.  Simply create a copy of the image
-        // and a mask.
-        binnedImage = psImageCopy(binnedImage, origImage, PS_TYPE_F32);
-        if (binnedImage == NULL) {
-            psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL.  Returning in image.\n");
-            return(in);
-        }
-
-        if (in->mask != NULL) {
-            binnedMaskImage = psImageCopy(binnedMaskImage, in->mask, PS_TYPE_U8);
-            if (binnedMaskImage == NULL) {
-                psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL.  Returning in image.\n");
-                psFree(binnedImage);
-                return(in);
-            }
-        } else {
-            binnedMaskImage = psImageAlloc(binnedImage->numCols,
-                                           binnedImage->numRows,
-                                           PS_TYPE_U8);
-            PS_IMAGE_SET_U8(binnedMaskImage, 0);
-        }
-    } else {
-        binnedImage = psImageRebin(NULL, origImage, in->mask, 0, binFactor, stats);
-        if (binnedImage == NULL) {
-            psError(PS_ERR_UNKNOWN, false, "psImageRebin() returned NULL.  Returning in image.\n");
-            return(in);
-        }
-        binnedMaskImage = psImageAlloc(binnedImage->numCols,
-                                       binnedImage->numRows,
-                                       PS_TYPE_U8);
-        PS_IMAGE_SET_U8(binnedMaskImage, 0);
-    }
-    psTrace(".psModule.pmSubtractSky", 4,
-            "binnedImage size is (%d, %d)\n", binnedImage->numRows, binnedImage->numCols);
-
-    //
-    // Clip pixels that are outside the acceptable range.
-    //
-    if (clipSD <= 0.0) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "WARNING: pmSubtractSky(): clipSD is %f\n", clipSD);
-    } else {
-        // Determine the mean and standard deviation of the binned image.
-        psF64 binnedMean;
-        psF64 binnedStdev;
-        psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-        psStats *rc =  psImageStats(myStats, binnedImage, NULL, 0);
-        if (rc == NULL) {
-            psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
-            return(in);
-        }
-        if (false == p_psGetStatValue(rc, &binnedMean)) {
-            psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
-            return(in);
-        }
-        psTrace(".psModule.pmSubtractSky", 6,
-                "binned Mean is %f\n", binnedMean);
-
-        myStats->options = PS_STAT_SAMPLE_STDEV;
-        rc =  psImageStats(myStats, binnedImage, NULL, 0);
-        if (rc == NULL) {
-            psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
-            return(in);
-        }
-        if (false == p_psGetStatValue(myStats, &binnedStdev)) {
-            psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
-            return(in);
-        }
-        psFree(myStats);
-        psTrace(".psModule.pmSubtractSky", 6,
-                "binned StDev is %f\n", binnedStdev);
-
-        // Clip all pixels which are more than clipSD sigmas from the mean.
-        psTrace(".psModule.pmSubtractSky", 6,
-                "clipSD is %f\n", clipSD);
-
-        for (psS32 row = 0; row < binnedImage->numRows ; row++) {
-            for (psS32 col = 0; col < binnedImage->numCols ; col++) {
-                if (fabs(binnedImage->data.F32[row][col] - binnedMean) >
-                        (clipSD * binnedStdev)) {
-                    binnedMaskImage->data.U8[row][col] = 1;
-                }
-            }
-        }
-    }
-
-    //
-    // Fit the polynomial to the binned image
-    //
-    if (fit == PM_FIT_POLYNOMIAL) {
-        myPoly = (psPolynomial2D *) fitSpec;
-        PS_ASSERT_POLY_NON_NULL(myPoly, NULL);
-        PS_ASSERT_POLY_TYPE(myPoly, PS_POLYNOMIAL_ORD, NULL);
-
-        myPoly = ImageFitPolynomial(myPoly, binnedImage, binnedMaskImage);
-
-        if (myPoly != NULL) {
-            // Set the pixels in the binned image to that of the polynomial.
-            binnedImage = psImageEvalPolynomial(binnedImage, myPoly);
-            if (binnedImage == NULL) {
-                psError(PS_ERR_UNKNOWN, false, "psImageEvalPolynomial() returned NULL.  Returning in image.\n");
-                psFree(binnedMaskImage);
-                if (!((binFactor <= 1) || (stats == NULL))) {
-                    psFree(binnedImage);
-                }
-                if (oldStatOptions != 0) {
-                    stats->options = statOptions;
-                }
-                return(in);
-            }
-        } else {
-            psLogMsg(__func__, PS_LOG_WARN,
-                     "WARNING: pmSubtractSky(): could not model sky with a polynomial.\n");
-            psFree(binnedMaskImage);
-            if (!((binFactor <= 1) || (stats == NULL))) {
-                psFree(binnedImage);
-            }
-            if (oldStatOptions != 0) {
-                stats->options = statOptions;
-            }
-            return(in);
-        }
-    } else {
-        // We shouldn't get here since we check this above.
-        psError(PS_ERR_UNKNOWN, true, "Unallowable fit type.  Returning in image.\n");
-        psFree(binnedMaskImage);
-        if (!((binFactor <= 1) || (stats == NULL))) {
-            psFree(binnedImage);
-        }
-        if (oldStatOptions != 0) {
-            stats->options = statOptions;
-        }
-        return(in);
-    }
-
-    //
-    //Subtract the polynomially fitted image from the original image
-    //
-    if (binFactor <= 1) {
-        // The binned image is the same size as the original image.
-        for (psS32 row = 0; row < origImage->numRows ; row++) {
-            for (psS32 col = 0; col < origImage->numCols ; col++) {
-                origImage->data.F32[row][col]-= binnedImage->data.F32[row][col];
-            }
-        }
-    } else {
-        for (psS32 row = 0; row < origImage->numRows ; row++) {
-            for (psS32 col = 0; col < origImage->numCols ; col++) {
-                // We calculate the F32 value of the pixel coordinates in the
-                // binned image and then use a pixel interpolation routine to
-                // determine the value of the pixel at that location.
-                psF32 binRowF64 = ((psF32) row) / ((psF32) binFactor);
-                psF32 binColF64 = ((psF32) col) / ((psF32) binFactor);
-
-                // We add 0.5 to the pixel locations since the pixel
-                // interpolation routine defines the location of pixel
-                // (i, j) as (i+0.5, j+0.5).
-                binRowF64+= 0.5;
-                binColF64+= 0.5;
-
-                psF32 binPixel = (psF32) psImagePixelInterpolate(
-                                     binnedImage, binColF64, binRowF64,
-                                     NULL, 0, 0.0, PS_INTERPOLATE_BILINEAR);
-                origImage->data.F32[row][col]-= binPixel;
-
-                psTrace(".psModule.pmSubtractSky", 8,
-                        "image[%d][%d] <--> binnedImage[%.2f][%.2f]: %f\n",
-                        row, col, binRowF64-0.5, binColF64-0.5, binPixel);
-            }
-        }
-
-    }
-    psFree(binnedMaskImage);
-    psFree(binnedImage);
-    if (oldStatOptions != 0) {
-        stats->options = statOptions;
-    }
-
-    psTrace(".psModule.pmSubtractSky", 4,
-            "---- pmSubtractSky() exit successfully ----\n");
-    return(in);
-}
Index: unk/psModules/src/pmSubtractSky.h
===================================================================
--- /trunk/psModules/src/pmSubtractSky.h	(revision 5170)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/** @file  pmSubtractSky.h
- *
- *  This file will contain a module which will create a model of the
- *  background sky and subtract that from the input image.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-16 01:10:34 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#if !defined(PM_SUBTRACT_SKY_H)
-#define PM_SUBTRACT_SKY_H
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include<stdio.h>
-#include<math.h>
-#include "pslib.h"
-#include "pmAstrometry.h"
-
-// XXX: this is pmFit in pmSubtractBias.c, named psFit here.
-typedef enum {
-    PM_FIT_NONE,                              ///< No fit
-    PM_FIT_POLYNOMIAL,                        ///< Fit polynomial
-    PM_FIT_SPLINE                             ///< Fit cubic splines
-} psFit;
-
-pmReadout *pmSubtractSky(pmReadout *in,
-                         void *fitSpec,
-                         psFit fit,
-                         int binFactor,
-                         psStats *stats,
-                         float clipSD);
-#endif
Index: unk/psModules/test/tst_pmAstrometry.c
===================================================================
--- /trunk/psModules/test/tst_pmAstrometry.c	(revision 5170)
+++ 	(revision )
@@ -1,363 +1,0 @@
-/** @file  tst_pmAstrometry.c
- *
- *  @brief Contains the tests for pmAstrometry.[ch].  Only the pmxxxAlloc()
- *  and psFree() functionality are used here.
- *
- *  @author George Gusciora, MHPCC
- *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-14 20:14:36 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- */
-
-#include "config.h"
-#include <math.h>
-#include <string.h>
-#include "psTest.h"
-#include "pslib_strict.h"
-#include "pmAstrometry.h"
-
-static psS32 testFPAAlloc(void);
-static psS32 testChipAlloc(void);
-static psS32 testCellAlloc(void);
-static psS32 testReadoutAlloc(void);
-
-testDescription tests[] = {
-                              {testFPAAlloc,739,"pmFPAAlloc",0,false},
-                              {testChipAlloc,740,"pmChipAlloc",0,false},
-                              {testCellAlloc,741,"pmCellAlloc",0,false},
-                              {testReadoutAlloc,742,"pmReadoutAlloc",0,false},
-                              {NULL}
-                          };
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetLevel(PS_LOG_INFO);
-    psLogSetFormat("HLNM");
-
-    return ! runTestSuite(stderr,"pmAstrometry",tests,argc,argv);
-}
-
-static psS32 testFPAAlloc(void)
-{
-    // XXX: Do something more with these arguments.
-    const psMetadata *camera = psMetadataAlloc();
-    psDB *db = NULL;
-    pmFPA* fpa = pmFPAAlloc(camera, db);
-
-    if (fpa == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc returned a NULL.");
-        return 1;
-    }
-
-    if (fpa->fromTangentPlane != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->fromTangentPlane to NULL.");
-        return 2;
-    }
-
-    if (fpa->toTangentPlane != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->toTangentPlane to NULL.");
-        return 3;
-    }
-    if (fpa->projection != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->projection to NULL.");
-        return 4;
-    }
-
-    if (fpa->concepts == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->concepts.");
-        return 5;
-    }
-
-    if (fpa->analysis == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->analysis.");
-        return 6;
-    }
-
-    if (fpa->camera != camera) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->camera.");
-        return 7;
-    }
-
-    if (fpa->chips == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->chips.");
-        return 8;
-    }
-
-    if (fpa->header != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->header to NULL.");
-        return 9;
-    }
-
-    if (fpa->db != db) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc did not set ->db.");
-        return 10;
-    }
-
-    psFree(camera);
-    psFree(fpa);
-
-    return 0;
-}
-
-static psS32 testChipAlloc(void)
-{
-    const psMetadata *camera = psMetadataAlloc();
-    psDB *db = NULL;
-    pmFPA* fpa = pmFPAAlloc(camera, db);
-    if (fpa == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc returned a NULL.");
-        return 1;
-    }
-
-    pmChip *chip = pmChipAlloc(fpa);
-    if (chip == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmChipAlloc returned a NULL.");
-        return 1;
-    }
-
-    if (chip->col0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->col0 set improperly.\n");
-        return 5;
-    }
-
-    if (chip->row0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->row0 set improperly.\n");
-        return 6;
-    }
-
-    if (chip->toFPA != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->toChip set improperly.\n");
-        return 7;
-    }
-
-    if (chip->fromFPA != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->toFPA set improperly.\n");
-        return 8;
-    }
-
-    if (chip->concepts == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->concepts set improperly.\n");
-        return 21;
-    }
-
-    if (chip->analysis == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->analysis set improperly.\n");
-        return 10;
-    }
-
-    if (chip->cells == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->cells set improperly.\n");
-        return 22;
-    }
-
-    if (chip->parent != fpa) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->parent set improperly.\n");
-        return 23;
-    }
-
-    if (chip->valid != false) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->valid set improperly.\n");
-        return 24;
-    }
-
-    if (chip->extname != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->extname set improperly.\n");
-        return 25;
-    }
-
-    if (chip->pixels != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->pixels set improperly.\n");
-        return 26;
-    }
-
-    if (chip->header != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "chip->header set improperly.\n");
-        return 27;
-    }
-
-    psFree(fpa);
-    psFree(chip);
-    psFree(camera);
-
-    return 0;
-}
-
-static psS32 testCellAlloc(void)
-{
-    psDB *db = NULL;
-    const psMetadata *camera = psMetadataAlloc();
-    pmFPA* fpa = pmFPAAlloc(camera, db);
-    if (fpa == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc returned a NULL.n");
-        return 1;
-    }
-
-    pmChip *chip = pmChipAlloc(fpa);
-    if (chip == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmChipAlloc returned a NULL.n");
-        return 2;
-    }
-
-    pmCell *cell = pmCellAlloc(chip);
-    if (cell == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmCellAlloc returned a NULL.n");
-        return 3;
-    }
-
-    if (cell->col0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->col0 set improperly.\n");
-        return 5;
-    }
-
-    if (cell->row0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->row0 set improperly.\n");
-        return 6;
-    }
-
-    if (cell->toChip != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->toChip set improperly.\n");
-        return 7;
-    }
-
-    if (cell->toFPA != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->toFPA set improperly.\n");
-        return 8;
-    }
-
-    if (cell->toSky != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->toSky set improperly.\n");
-        return 9;
-    }
-
-    if (cell->analysis == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->analysis set improperly.\n");
-        return 10;
-    }
-
-    if (cell->concepts == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->concepts set improperly.\n");
-        return 21;
-    }
-
-    if (cell->readouts == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->readouts set improperly.\n");
-        return 22;
-    }
-
-    if (cell->parent != chip) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->parent set improperly.\n");
-        return 23;
-    }
-
-    if (cell->valid != false) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->valid set improperly.\n");
-        return 24;
-    }
-
-    if (cell->extname != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->extname set improperly.\n");
-        return 25;
-    }
-
-    if (cell->pixels != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->pixels set improperly.\n");
-        return 26;
-    }
-
-    if (cell->header != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "cell->header set improperly.\n");
-        return 27;
-    }
-
-    psFree(fpa);
-    psFree(chip);
-    psFree(cell);
-    psFree(camera);
-
-    return 0;
-}
-
-static psS32 testReadoutAlloc(void)
-{
-    psDB *db = NULL;
-    const psMetadata *camera = psMetadataAlloc();
-    pmFPA* fpa = pmFPAAlloc(camera, db);
-
-    if (fpa == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmFPAAlloc returned a NULL.\n");
-        return 1;
-    }
-
-    pmChip *chip = pmChipAlloc(fpa);
-    if (chip == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmChipAlloc returned a NULL.\n");
-        return 2;
-    }
-
-    pmCell *cell = pmCellAlloc(chip);
-    if (cell == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmCellAlloc returned a NULL.\n");
-        return 3;
-    }
-
-    pmReadout *readout = pmReadoutAlloc(cell);
-    if (readout == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR, "pmReadoutAlloc returned a NULL.\n");
-        return 4;
-    }
-
-    if (readout->col0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->col0 set improperly.\n");
-        return 5;
-    }
-
-    if (readout->row0 != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->row0 set improperly.\n");
-        return 6;
-    }
-
-    if (readout->colBins != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->colBins set improperly.\n");
-        return 7;
-    }
-
-    if (readout->rowBins != -1) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->colBins set improperly.\n");
-        return 8;
-    }
-
-    if (readout->image != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->image set improperly.\n");
-        return 9;
-    }
-
-    if (readout->mask != NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->mask set improperly.\n");
-        return 10;
-    }
-
-    if (readout->analysis == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->analysis set improperly.\n");
-        return 11;
-    }
-
-    if (readout->concepts == NULL) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->concepts set improperly.\n");
-        return 12;
-    }
-
-    if (readout->parent != cell) {
-        psLogMsg(__func__, PS_LOG_ERROR, "pmReadout->parent set improperly.\n");
-        return 15;
-    }
-
-    psFree(fpa);
-    psFree(chip);
-    psFree(cell);
-    psFree(readout);
-    psFree(camera);
-
-    return 0;
-}
Index: unk/psModules/test/tst_pmFlatField.c
===================================================================
--- /trunk/psModules/test/tst_pmFlatField.c	(revision 5170)
+++ 	(revision )
@@ -1,298 +1,0 @@
-/** @file tst_pmFlatField.c
- *
- *  @brief Contains the tests for pmFlatField.c:
- *
- *    Test A - Divide input image by flat image
- *    Test B - Mask flat image data
- *    Test C - Mask flat image data starting with non-null mask
- *    Test E - Attempt to use null input image
- *    Test F - Attempt tp use null flat image
- *    Test G - Attempt to use input image bigger than flat image
- *    Test H - Attempt to use input image mask bigger than flat image
- *    Test I - Attempt to use offset greater than input image
- *    Test J - Attempt to use complex input image
- *    Test K - Attempt to use complex flat image
- *    Test L - Attempt to use non-equal input and flat image types
- *    Test M - Attempt to use non-mask type mask image
- *
- * XXX: Added a mask argument to pmFlatField().  Must add tests.  For now, all
- * masks are NULL.
- *
- *  @author Ross Harman, MHPCC
- *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-12 20:38:11 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmFlatField.h"
-
-
-#define PRINT_MATRIX(IMAGE,TYPE,STRING)                                                                      \
-printf(STRING);                                                                                              \
-printf("\n");                                                                                                \
-for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
-    for(int j=0; j<IMAGE->numCols; j++) {                                                                    \
-        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                     \
-            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));                 \
-        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                                  \
-            printf("%d ", (int)IMAGE->data.TYPE[i][j]);                                                      \
-        } else {                                                                                             \
-            printf("%f ", (double)IMAGE->data.TYPE[i][j]);                                                   \
-        }                                                                                                    \
-    }                                                                                                        \
-    printf("\n");                                                                                            \
-}                                                                                                            \
-printf("\n");
-
-
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
-psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
-for(int i=0; i<NAME->numRows; i++) {                                                                         \
-    for(int j=0; j<NAME->numCols; j++) {                                                                     \
-        NAME->data.TYPE[i][j] = VALUE;                                                                       \
-    }                                                                                                        \
-}
-
-
-static int testFlatField(void);
-
-
-testDescription tests[] = {
-                              {testFlatField, 753, "pmFlatField", 0, false},
-                              {NULL}
-                          };
-
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-
-int testFlatField( void )
-{
-    // Test A - Divide input image by flat image
-    printPositiveTestHeader(stdout, "pmFlatField", "Test A - Divide input image by flat image");
-    CREATE_AND_SET_IMAGE(inImage,F64,6.0,3,3)
-    pmReadout *inReadout = pmReadoutAlloc(NULL);
-    inReadout->image = inImage;
-    inReadout->row0 = 0;
-    inReadout->col0 = 0;
-    PRINT_MATRIX(inImage,F64,"Input image:");
-
-    CREATE_AND_SET_IMAGE(inMask,U8,0,3,3)
-    pmReadout *inMaskReadout = pmReadoutAlloc(NULL);
-    inMaskReadout->image = inMask;
-    inMaskReadout->row0 = 0;
-    inMaskReadout->col0 = 0;
-    PRINT_MATRIX(inMask,U8,"Input mask:");
-
-    CREATE_AND_SET_IMAGE(flatImage1,F64,2.0,3,3)
-    pmReadout *flatReadout = pmReadoutAlloc(NULL);
-    flatReadout->row0 = 0;
-    flatReadout->col0 = 0;
-    flatReadout->image = flatImage1;
-    PRINT_MATRIX(flatImage1,F64,"Flat image:");
-
-    if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test A - Returned false should be true");
-        return 1;
-    }
-    PRINT_MATRIX(inImage,F64, "Resulting image:");
-    printFooter(stdout, "pmFlatField", "Test A - Divide input image by flat image", true);
-    printf("\n\n\n");
-
-
-    // Test B - Mask flat image data
-    printPositiveTestHeader(stdout, "pmFlatField", "Test B - Mask flat image data");
-    PRINT_MATRIX(inImage, F64, "Input image:");
-    CREATE_AND_SET_IMAGE(flatImage2,F64,0.0,3,3)
-    PRINT_MATRIX(flatImage2, F64, "Flat image:");
-    flatReadout->image = flatImage2;
-    if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test B - Returned false should be true");
-        return 2;
-    }
-    PRINT_MATRIX(inMaskReadout->image, PS_TYPE_MASK_DATA, "Resulting mask:");
-    PRINT_MATRIX(inImage,F64,"Resulting image:");
-    printFooter(stdout, "pmFlatField", "Test B - Mask flat image data", true);
-    printf("\n\n\n");
-
-
-    // Test C - Mask flat image data starting with non-null mask
-    printPositiveTestHeader(stdout, "pmFlatField", "Test C - Mask flat image data starting with non-null mask");
-    PRINT_MATRIX(inImage, F64, "Input image:");
-    flatImage2->data.F64[0][0] = 3.0;
-    flatImage2->data.F64[0][1] = -3.0;
-    PRINT_MATRIX(flatImage2, F64, "Flat image:");
-    CREATE_AND_SET_IMAGE(mask1,U8,0,3,3);
-    psFree(inReadout->mask);
-    inReadout->mask = mask1;
-    if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test C - Returned false should be true");
-        return 3;
-    }
-    PRINT_MATRIX(flatImage2, F64, "Flat image out:");
-    PRINT_MATRIX(inReadout->mask, PS_TYPE_MASK_DATA,"Resulting mask:");
-    PRINT_MATRIX(inImage,F64,"Resulting image:");
-    printFooter(stdout, "pmFlatField", "Test C - Mask flat image data starting with non-null mask", true);
-    printf("\n\n\n");
-
-
-    // Test D - Attempt to use null flat readout
-    printNegativeTestHeader(stdout,"pmFlatField", "Test D - Attempt to use null flat readout",
-                            "Null not allowed for flat readout", 0);
-    if( pmFlatField(inReadout, inMaskReadout, NULL) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test D - Returned true should be false");
-        return 4;
-    }
-    printFooter(stdout, "pmFlatField", "Test D - Attempt to use null flat readout", true);
-    printf("\n\n\n");
-
-
-    // Test E - Attempt to use null input image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test E - Attempt to use null input image",
-                            "Null not allowed for input image", 0);
-    psImage *temp = inReadout->image;
-    inReadout->image = NULL;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test E - Returned true should be false" );
-        return 5;
-    }
-    inReadout->image = temp;
-    printFooter(stdout, "pmFlatField", "Test E - Attempt to use null input image", true);
-    printf("\n\n\n");
-
-
-    // Test F - Attempt tp use null flat image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test F - Attempt tp use null flat image",
-                            "Null not allowed for flat image", 0);
-    temp = flatReadout->image;
-    flatReadout->image = NULL;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test F - Returned true should be false" );
-        return 6;
-    }
-    flatReadout->image = temp;
-    printFooter(stdout, "pmFlatField", "Test F - Attempt tp use null flat image", true);
-    printf("\n\n\n");
-
-
-    // Test G - Attempt to use input image bigger than flat image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test G - Attempt to use input image bigger than flat image",
-                            "Input image size exceeds that of flat image", 0);
-    CREATE_AND_SET_IMAGE(smallFlat,F64,0.0,2,2);
-    temp = flatReadout->image;
-    flatReadout->image = smallFlat;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test G - Returned true should be false");
-        return 7;
-    }
-    flatReadout->image = temp;
-    printFooter(stdout, "pmFlatField", "Test G - Attempt to use input image bigger than flat image", true);
-    printf("\n\n\n");
-
-
-    // Test H - Attempt to use input image mask bigger than flat image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test H - Attempt to use input image mask bigger than flat image",
-                            "Input image mask size exceeds that of flat image", 0);
-    CREATE_AND_SET_IMAGE(largeMask,F64,0.0,5,5);
-    temp = inReadout->mask;
-    inMaskReadout->image = largeMask;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test H - Returned true should be false");
-        return 8;
-    }
-    inReadout->mask = temp;
-    printFooter(stdout, "pmFlatField", "Test H - Attempt to use input image mask bigger than flat image", true);
-    printf("\n\n\n");
-
-
-    // Test I - Attempt to use offset greater than input image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test I - Attempt to use offset greater than input image",
-                            "Total offset >= input image size", 0);
-    *(int*)&inReadout->col0 = 50;
-    *(int*)&inReadout->row0 = 50;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test I - Returned true should be false");
-        return 9;
-    }
-    *(int*)&inReadout->col0 = 0;
-    *(int*)&inReadout->row0 = 0;
-    printFooter(stdout, "pmFlatField", "Test I - Attempt to use offset greater than input image", true);
-    printf("\n\n\n");
-
-
-    // Test J - Attempt to use complex input image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test J - Attempt to use complex input image",
-                            "Complex types not allowed for input image", 0);
-    *(psElemType* ) & inReadout->image->type.type = PS_TYPE_C64;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test J - Returned true should be false");
-        return 10;
-    }
-    *(psElemType* ) & inReadout->image->type.type = PS_TYPE_F64;
-    printFooter(stdout, "pmFlatField", "Test J - Attempt to use complex input image", true);
-    printf("\n\n\n");
-
-
-    // Test K - Attempt to use complex flat image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test K - Attempt to use complex flat image",
-                            "Complex types not allowed for flat image", 0);
-    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_C64;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test K - Returned ture should be false");
-        return 11;
-    }
-    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_F64;
-    printFooter(stdout, "pmFlatField", "Test K - Attempt to use complex flat image", true);
-    printf("\n\n\n");
-
-
-    // Test L - Attempt to use non-equal input and flat image types
-    printNegativeTestHeader(stdout,"pmFlatField", "Test L - Attempt to use non-equal input and flat image types",
-                            "Input and flat image types differ", 0);
-    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_F32;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test L - Returned true should be false");
-        return 12;
-    }
-    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_F64;
-    printFooter(stdout, "pmFlatField", "Test L - Attempt to use non-equal input and flat image types", true);
-    printf("\n\n\n");
-
-
-    // Test M - Attempt to use non-mask type mask image
-    printNegativeTestHeader(stdout,"pmFlatField", "Test M - Attempt to use non-mask type mask image",
-                            "Mask must be PS_TYPE_MASK type", 0);
-    *(psElemType* ) & inReadout->mask->type.type = PS_TYPE_F32;
-    if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
-        psError(PS_ERR_UNKNOWN,true,"Test M - Returned true should be false");
-        return 13;
-    }
-    *(psElemType* ) & inReadout->mask->type.type = PS_TYPE_MASK;
-    printFooter(stdout, "pmFlatField", "Test M - Attempt to use non-mask type mask image", true);
-    printf("\n\n\n");
-
-
-    // Free memory
-    psFree(inMask);
-    psFree(largeMask);
-    inMaskReadout->image = NULL;
-    psFree(inMaskReadout);
-    psFree(inReadout);
-    psFree(flatReadout);
-    //psFree(inImage);
-    psFree(flatImage1);
-    //psFree(flatImage1);
-    psFree(smallFlat);
-
-    return 0;
-}
-
Index: unk/psModules/test/tst_pmImageCombine.c
===================================================================
--- /trunk/psModules/test/tst_pmImageCombine.c	(revision 5170)
+++ 	(revision )
@@ -1,352 +1,0 @@
-/** @file tst_pmImageCombine.c
- *
- *  @brief Contains the tests for pmImageCombine.c:
- *
- *  test00: This code will test the various functions in the pmImageCombine.c file.
- *
- *  @author GLG, MHPCC
- *
- *  XXX: Must verify the results internally.  Don't use stdout file.
- *  XXX: Must test masks with pmRejectPixels()
- *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-11 22:25:39 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-#include "psTest.h"
-#include "pslib.h"
-#include "pmImageCombine.h"
-static int test00(void);
-testDescription tests[] = {
-                              {test00, 000, "pmCombineImages()", true, false},
-                              {NULL}
-                          };
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-psF32 genRanFloat(psF32 low,
-                  psF32 high)
-{
-    psF32 ran1 = (((psF32) (random() % 10000)) / 10000.0);
-    return(low + (ran1 * (high - low)));
-}
-
-psF32 genRanInt(psS32 low,
-                psS32 high)
-{
-    psF32 ran1 = (((psF32) (random() % 10000)) / 10000.0);
-    return((psS32) (low + (ran1 * (high - low))));
-}
-
-#define TST00_EXPANSION_FACTOR_X 1.0
-#define TST00_EXPANSION_FACTOR_Y 1.0
-#define TST00_OFFSET_X 0.0
-#define TST00_OFFSET_Y 0.0
-#define TST00_NUM_PIXELS 10
-#define TST00_MASK_VALUE 1
-#define TST00_NUM_ITERATIONS 4
-#define TST00_SIGMA_CLIP 1.0
-#define TST00_REJECTION_THRESHOLD 0.01
-#define TST00_GRADIENT_LIMIT 10.0
-/*******************************************************************************
-NOTE: This function returns FALSE if there were no errors.
- ******************************************************************************/
-psBool testCombineImages(psS32 numRows,
-                         psS32 numCols,
-                         psS32 numImages)
-{
-    printf("Testing pmCombineImages(%d, %d, %d)\n", numRows, numCols, numImages);
-    bool testStatus = false;
-
-    psArray *images = psArrayAlloc(numImages);
-    psArray *errors = psArrayAlloc(numImages);
-    psArray *masks = psArrayAlloc(numImages);
-    for (psS32 i = 0 ; i < numImages ; i++) {
-        images->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F32);
-        errors->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F32);
-        masks->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_U8);
-        psImage *image = (psImage *) images->data[i];
-        psImage *error = (psImage *) errors->data[i];
-        psImage *mask = (psImage *) masks->data[i];
-        PS_IMAGE_SET_F32(image, 0.0);
-        PS_IMAGE_SET_F32(error, 1.0);
-        PS_IMAGE_SET_U8(mask, 0);
-
-        for (psS32 row = 0 ; row < numRows ; row++) {
-            for (psS32 col = 0 ; col < numCols ; col++) {
-                // Scale row/col to [-1.0:1.0]
-                psF32 rowScaled = ((psF32) (row - (numRows/2))) / ((psF32) (numRows/2));
-                psF32 colScaled = ((psF32) (col - (numCols/2))) / ((psF32) (numCols/2));
-                image->data.F32[row][col] = PS_SQR((2.0 - rowScaled) + (2.0 - colScaled)) + genRanFloat(0.0, 0.5);
-            }
-        }
-    }
-
-    //
-    // Same as above except the numImages is wrong
-    //
-    psArray *imagesLong = psArrayAlloc(numImages+1);
-    psArray *errorsLong = psArrayAlloc(numImages+1);
-    psArray *masksLong = psArrayAlloc(numImages+1);
-    for (psS32 i = 0 ; i < numImages+1 ; i++) {
-        imagesLong->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F32);
-        errorsLong->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F32);
-        masksLong->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_U8);
-        psImage *image = (psImage *) imagesLong->data[i];
-        psImage *error = (psImage *) errorsLong->data[i];
-        psImage *mask = (psImage *) masksLong->data[i];
-        PS_IMAGE_SET_F32(image, 0.0);
-        PS_IMAGE_SET_F32(error, 1.0);
-        PS_IMAGE_SET_U8(mask, 0);
-
-        for (psS32 row = 0 ; row < numRows ; row++) {
-            for (psS32 col = 0 ; col < numCols ; col++) {
-                // Scale row/col to [-1.0:1.0]
-                psF32 rowScaled = ((psF32) (row - (numRows/2))) / ((psF32) (numRows/2));
-                psF32 colScaled = ((psF32) (col - (numCols/2))) / ((psF32) (numCols/2));
-                image->data.F32[row][col] = PS_SQR((2.0 - rowScaled) + (2.0 - colScaled)) + genRanFloat(0.0, 0.5);
-            }
-        }
-    }
-
-    //
-    // Same as above except the type is wrong
-    //
-    psArray *imagesBadType = psArrayAlloc(numImages);
-    psArray *errorsBadType = psArrayAlloc(numImages);
-    psArray *masksBadType = psArrayAlloc(numImages);
-    for (psS32 i = 0 ; i < numImages ; i++) {
-        imagesBadType->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F64);
-        errorsBadType->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_F64);
-        masksBadType->data[i] = (psPtr *) psImageAlloc(numCols, numRows, PS_TYPE_S8);
-        psImage *image = (psImage *) imagesBadType->data[i];
-        psImage *error = (psImage *) errorsBadType->data[i];
-        psImage *mask = (psImage *) masksBadType    ->data[i];
-        PS_IMAGE_SET_F32(image, 0.0);
-        PS_IMAGE_SET_F32(error, 1.0);
-        PS_IMAGE_SET_U8(mask, 0);
-
-        for (psS32 row = 0 ; row < numRows ; row++) {
-            for (psS32 col = 0 ; col < numCols ; col++) {
-                // Scale row/col to [-1.0:1.0]
-                psF32 rowScaled = ((psF32) (row - (numRows/2))) / ((psF32) (numRows/2));
-                psF32 colScaled = ((psF32) (col - (numCols/2))) / ((psF32) (numCols/2));
-                image->data.F32[row][col] = PS_SQR((2.0 - rowScaled) + (2.0 - colScaled)) + genRanFloat(0.0, 0.5);
-            }
-        }
-    }
-
-    psPixels *pixels = psPixelsAlloc(TST00_NUM_PIXELS);
-    for (psS32 p = 0 ; p < TST00_NUM_PIXELS ; p++) {
-        psS32 col =  genRanInt(0, numCols);
-        psS32 row =  genRanInt(0, numRows);
-        pixels->data[p].x = (psF32) col;
-        pixels->data[p].y = (psF32) row;
-        psS32 im = genRanInt(0, numImages-1);
-        psImage *image = (psImage *) images->data[im];
-        image->data.F32[row][col] += 100.0;
-        printf("Generating a bad pixel in image (%d) at (%d, %d)\n", im, row, col);
-    }
-
-    psArray *questionablePixels = NULL;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a NULL images.  Should generate error, return NULL.\n");
-    psImage *outImg = pmCombineImages(NULL, &questionablePixels, NULL, errors,
-                                      masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                                      TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a long images.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, imagesLong, errors,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a bad type images.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, imagesBadType, errors,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a long errors.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errorsLong,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a bad type errors.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errorsBadType,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a long masks.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errors,
-                             masksLong, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a bad type masks.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errors,
-                             masksBadType, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with a NULL stats.  Should generate error, return NULL.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errors,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, NULL);
-    if (outImg != NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a non-NULL psImage.\n");
-        psFree(outImg);
-        testStatus = true;
-    }
-
-    //-------------------------------------------------------------------------
-    printf("Calling with acceptable data.  Should generate a psImage.\n");
-    outImg = pmCombineImages(NULL, &questionablePixels, images, errors,
-                             masks, TST00_MASK_VALUE, pixels, TST00_NUM_ITERATIONS,
-                             TST00_SIGMA_CLIP, stats);
-    if (outImg == NULL) {
-        printf("TEST ERROR: pmCombineImages() returned a NULL psImage.\n");
-        testStatus = true;
-    }
-    if (0) {
-        for (psS32 p = 0 ; p < TST00_NUM_PIXELS ; p++) {
-            psS32 col = (psS32) (pixels->data[p]).x;
-            psS32 row = (psS32) (pixels->data[p]).y;
-            printf("------------------------------------------\n");
-            printf("Pixel (%d, %d) in combined image is %f\n", row, col, outImg->data.F32[row][col]);
-            for (psS32 i = 0 ; i < numImages ; i++) {
-                psImage *image = (psImage *) images->data[i];
-                printf("Pixel (after combine) (%d, %d) in image (%d) is %f\n", row, col, i, image->data.F32[row][col]);
-            }
-        }
-    }
-
-    if (questionablePixels->n != numImages) {
-        printf("TEST ERROR: pmCombineImages(): questionablePixels->n was %ld, should have been %d\n",
-               questionablePixels->n, numImages);
-        testStatus = true;
-    } else {
-        // XXX: We should internally verify this with the pixels list, not merely use the stdout.
-        for (psS32 i = 0 ; i < questionablePixels->n ; i++) {
-            psPixels *myPixels = (psPixels *) questionablePixels->data[i];
-            for (psS32 p = 0 ; p < myPixels->n ; p++) {
-                printf("Image %d, questionable pixel %d is (%d %d)\n", i, p, myPixels->data[p].y, myPixels->data[p].x);
-            }
-        }
-    }
-
-    psArray *expandTransforms = psArrayAlloc(numImages);
-    psArray *contractTransforms = psArrayAlloc(numImages);
-    for (psS32 im = 0 ; im < numImages ; im++) {
-        psPlaneTransform *ptExpand = psPlaneTransformAlloc(2, 2);
-        ptExpand->x->coeff[0][0] = TST00_OFFSET_X;
-        ptExpand->x->coeff[1][0] = TST00_EXPANSION_FACTOR_X;
-        ptExpand->y->coeff[0][0] = TST00_OFFSET_Y;
-        ptExpand->y->coeff[0][1] = TST00_EXPANSION_FACTOR_Y;
-        expandTransforms->data[im] = (psPtr *) ptExpand;
-
-        psPlaneTransform *ptContract = psPlaneTransformAlloc(2, 2);
-        ptContract->x->coeff[0][0] = -TST00_OFFSET_X;
-        ptContract->x->coeff[1][0] = 1.0 / TST00_EXPANSION_FACTOR_X;
-        ptContract->y->coeff[0][0] = -TST00_OFFSET_Y;
-        ptContract->y->coeff[0][1] = 1.0 / TST00_EXPANSION_FACTOR_Y;
-        contractTransforms->data[im] = (psPtr *) ptContract;
-    }
-
-    //-------------------------------------------------------------------------
-    //
-    // XXX: psRejectPixels() has known bugs.  Specifically, in the psImageTransform() call.
-    // We exclude this from our tests.
-    //
-    printf("\n\n\nCalling pmRejectPixels() with acceptable data.  Should generate a psArray.\n");
-    psArray *pixelRejects = pmRejectPixels(images, NULL, questionablePixels, expandTransforms,
-                                           contractTransforms, TST00_REJECTION_THRESHOLD,
-                                           TST00_GRADIENT_LIMIT);
-    if (pixelRejects == NULL) {
-        printf("TEST ERROR: pmRejectPixels() returned a NULL psArray.\n");
-        testStatus = true;
-    } else {
-        // XXX: We should internally verify this with the pixels list, not merely use the stdout.
-        for (psS32 i = 0 ; i < pixelRejects->n ; i++) {
-            psPixels *myPixels = (psPixels *) pixelRejects->data[i];
-            printf("tst_pmImageCombine.c: Image %d had %ld rejects.\n", i, myPixels->n);
-
-            for (psS32 p = 0 ; p < myPixels->n ; p++) {
-                printf("Image %d, rejected pixel %d is (%d %d)\n", i, p,
-                       myPixels->data[p].y, myPixels->data[p].x);
-            }
-        }
-        psFree(pixelRejects);
-    }
-
-    psFree(images);
-    psFree(errors);
-    psFree(masks);
-    psFree(imagesLong);
-    psFree(errorsLong);
-    psFree(masksLong);
-    psFree(imagesBadType);
-    psFree(errorsBadType);
-    psFree(masksBadType);
-    psFree(pixels);
-    psFree(stats);
-
-    return(testStatus);
-}
-
-/*******************************************************************************
-NOTE: This function returns TRUE if there were no errors.
- ******************************************************************************/
-int test00( void )
-{
-    bool testStatus = false;
-
-    testStatus|= testCombineImages(10, 10, 5);
-
-    return(!testStatus);
-}
Index: unk/psModules/test/tst_pmImageSubtract.c
===================================================================
--- /trunk/psModules/test/tst_pmImageSubtract.c	(revision 5170)
+++ 	(revision )
@@ -1,843 +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.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-12 20:51:10 $
- *
- *  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);
-    for (psS32 i = 0 ; i < sigmas->n ; i++) {
-        sigmas->data.F32[i] = 1.0 + (psF32) i;
-    }
-    psVector *orders = psVectorAlloc(orderLength, PS_TYPE_S32);
-    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);
-    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);
-    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/tst_pmMaskBadPixels.c
===================================================================
--- /trunk/psModules/test/tst_pmMaskBadPixels.c	(revision 5170)
+++ 	(revision )
@@ -1,303 +1,0 @@
-/** @file tst_pmMaskBadPixels.c
- *
- *  @brief Contains the tests for pmMaskBadPixels:
- *
- *    Test A - Create mask based on maskVal argument
- *    Test B - Create mask based on saturation argument
- *    Test C - Create mask based on growVal and grow arguments
- *    Test D - Auto Create mask based on maskVal argument
- *    Test E - Attempt to use null mask
- *    Test F - Attempt tp use null input image
- *    Test G - Attempt to use input image bigger than mask
- *    Test H - Attempt to use input image mask bigger than mask
- *    Test I - Attempt to use offset greater than input image
- *    Test J - Attempt to use complex input image
- *    Test K - Attempt to use non-mask type mask image
- *
- *  @author Ross Harman, MHPCC
- *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-12 20:47:12 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmMaskBadPixels.h"
-
-
-#define PRINT_MATRIX(IMAGE,TYPE,STRING)                                                                      \
-printf(STRING);                                                                                              \
-printf("\n");                                                                                                \
-for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
-    for(int j=0; j<IMAGE->numCols; j++) {                                                                    \
-        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                     \
-            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));                 \
-        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                                  \
-            printf("%d", (int)IMAGE->data.TYPE[i][j]);                                                       \
-        } else {                                                                                             \
-            printf("%f", (double)IMAGE->data.TYPE[i][j]);                                                    \
-        }                                                                                                    \
-    }                                                                                                        \
-    printf("\n");                                                                                            \
-}                                                                                                            \
-printf("\n");
-
-
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
-psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
-for(int i=0; i<NAME->numRows; i++) {                                                                         \
-    for(int j=0; j<NAME->numCols; j++) {                                                                     \
-        NAME->data.TYPE[i][j] = VALUE;                                                                       \
-    }                                                                                                        \
-}
-
-
-static int testMaskBadPixels1(void);
-static int testMaskBadPixels2(void);
-static int testMaskBadPixels3(void);
-static int testMaskBadPixels4(void);
-static int testMaskBadPixels5(void);
-static int testMaskBadPixels6(void);
-static int testMaskBadPixels7(void);
-static int testMaskBadPixels8(void);
-static int testMaskBadPixels9(void);
-static int testMaskBadPixels10(void);
-static int testMaskBadPixels11(void);
-
-
-testDescription tests[] = {
-                              {testMaskBadPixels1, 885, "pmMaskBadPixels - Create mask based on maskVal argument", 0, false},
-                              {testMaskBadPixels2, 885, "pmMaskBadPixels - Create mask based on saturation argument", 0, false},
-                              {testMaskBadPixels3, 885, "pmMaskBadPixels - Create mask based on growVal and grow arguments", 0, false},
-                              {testMaskBadPixels4, 885, "pmMaskBadPixels - Auto create mask based on maskVal argument", 0, false},
-                              {testMaskBadPixels5, 885, "pmMaskBadPixels - Attempt to use null mask", 0, false},
-                              {testMaskBadPixels6, 885, "pmMaskBadPixels - Attempt tp use null input image", 0, false},
-                              {testMaskBadPixels7, 885, "pmMaskBadPixels - Attempt to use input image bigger than mask", 0, false},
-                              {testMaskBadPixels8, 885, "pmMaskBadPixels - Attempt to use input image mask bigger than mask", 0, false},
-                              {testMaskBadPixels9, 885, "pmMaskBadPixels - Attempt to use offset greater than input image", 0, false},
-                              {testMaskBadPixels10, 885, "pmMaskBadPixels - Attempt to use complex input image", 0, false},
-                              {testMaskBadPixels11, 885, "pmMaskBadPixels - Attempt to use non-mask type mask image", 0, false},
-                              {NULL}
-                          };
-
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-
-int testMaskBadPixels1( void )
-{
-    // Test A - Create mask based on maskVal argument
-    CREATE_AND_SET_IMAGE(inImage1,F64,0,50,50);
-    CREATE_AND_SET_IMAGE(mask1,U8,0,50,50)
-    //    pmReadout *inReadout = pmReadoutAlloc(0, 0, inImage1);
-    pmReadout *inReadout = pmReadoutAlloc(NULL);
-    inReadout->row0 = 0;
-    inReadout->col0 = 0;
-    inReadout->image = inImage1;
-    mask1->data.PS_TYPE_MASK_DATA[24][24]=1;
-    PRINT_MATRIX(mask1, U8, "Data mask:");
-    pmMaskBadPixels(inReadout, mask1, 1, 100.0, 0, 0);
-    PRINT_MATRIX(inReadout->mask, U8, "Resulting mask:");
-    psFree(mask1);
-    psFree(inReadout);
-
-    return 0;
-}
-
-int testMaskBadPixels2( void )
-{
-    // Test B - Create mask based on saturation argument
-    CREATE_AND_SET_IMAGE(inImage2,F64,150.0,50,50);
-    CREATE_AND_SET_IMAGE(mask2,U8,0,50,50)
-    //    pmReadout *inReadout2 = pmReadoutAlloc(0, 0, inImage2);
-    pmReadout *inReadout2 = pmReadoutAlloc(NULL);
-    inReadout2->row0 = 0;
-    inReadout2->col0 = 0;
-    inReadout2->image = inImage2;
-    PRINT_MATRIX(mask2, U8, "Data mask:");
-    pmMaskBadPixels(inReadout2, mask2, 0, 100.0, 0, 0);
-    PRINT_MATRIX(inReadout2->mask, U8, "Resulting mask:");
-    psFree(mask2);
-    psFree(inReadout2);
-
-    return 0;
-}
-
-int testMaskBadPixels3( void )
-{
-    // Test C - Create mask based on growVal and grow arguments
-    CREATE_AND_SET_IMAGE(inImage3,F64,50.0,50,50);
-    CREATE_AND_SET_IMAGE(mask3,U8,0,50,50)
-    //    pmReadout *inReadout3 = pmReadoutAlloc(0, 0, inImage3);
-    pmReadout *inReadout3 = pmReadoutAlloc(NULL);
-    inReadout3->row0 = 0;
-    inReadout3->col0 = 0;
-    inReadout3->image = inImage3;
-    mask3->data.PS_TYPE_MASK_DATA[24][24]=1;
-    mask3->data.PS_TYPE_MASK_DATA[4][3]=1;
-    mask3->data.PS_TYPE_MASK_DATA[4][46]=1;
-    PRINT_MATRIX(mask3, U8, "Data mask:");
-    pmMaskBadPixels(inReadout3, mask3, 0, 100.0, 1, 10);
-    PRINT_MATRIX(inReadout3->mask, U8, "Resulting mask:");
-    psFree(mask3);
-    psFree(inReadout3);
-
-    return 0;
-}
-
-int testMaskBadPixels4( void )
-{
-    // Test D - Auto Create mask based on maskVal argument
-    CREATE_AND_SET_IMAGE(inImage4,F64,50.0,50,50);
-    CREATE_AND_SET_IMAGE(mask4,U8,0,50,50)
-    CREATE_AND_SET_IMAGE(mask4i,U8,0,50,50)
-    //    pmReadout *inReadout4 = pmReadoutAlloc(0, 0, inImage4);
-    pmReadout *inReadout4 = pmReadoutAlloc(NULL);
-    inReadout4->row0 = 0;
-    inReadout4->col0 = 0;
-    inReadout4->image = inImage4;
-    inReadout4->mask = mask4i;
-    mask4->data.PS_TYPE_MASK_DATA[24][24]=1;
-    PRINT_MATRIX(mask4, U8, "Data mask:");
-    pmMaskBadPixels(inReadout4, mask4, 0, 100.0, 1, 10);
-    PRINT_MATRIX(inReadout4->mask, U8, "Resulting mask:");
-    psFree(mask4);
-    psFree(inReadout4);
-
-    return 0;
-}
-
-int testMaskBadPixels5( void )
-{
-    // Test E - Attempt to use null mask
-    CREATE_AND_SET_IMAGE(inImage5,F64,50.0,50,50);
-    //    pmReadout *inReadout5 = pmReadoutAlloc(0, 0, inImage5);
-    pmReadout *inReadout5 = pmReadoutAlloc(NULL);
-    inReadout5->row0 = 0;
-    inReadout5->col0 = 0;
-    inReadout5->image = inImage5;
-    pmMaskBadPixels(inReadout5, NULL, 0, 100.0, 1, 10);
-    psFree(inReadout5);
-
-    return 0;
-}
-
-int testMaskBadPixels6( void )
-{
-    // Test F - Attempt tp use null input image
-    CREATE_AND_SET_IMAGE(mask6,U8,0,50,50)
-    //    pmReadout *inReadout6 = pmReadoutAlloc(0, 0, NULL);
-    pmReadout *inReadout6 = pmReadoutAlloc(NULL);
-    inReadout6->row0 = 0;
-    inReadout6->col0 = 0;
-    inReadout6->mask = mask6;
-    pmMaskBadPixels(inReadout6, mask6, 0, 100.0, 1, 10);
-    psFree(inReadout6);
-
-    return 0;
-}
-
-int testMaskBadPixels7( void )
-{
-    // Test G - Attempt to use input image bigger than mask
-    CREATE_AND_SET_IMAGE(inImage7,F64,0.0,60,60);
-    CREATE_AND_SET_IMAGE(mask7,U8,0,50,50)
-    CREATE_AND_SET_IMAGE(mask7i,U8,0,50,50)
-    //    pmReadout *inReadout7 = pmReadoutAlloc(0, 0, inImage7);
-    pmReadout *inReadout7 = pmReadoutAlloc(NULL);
-    inReadout7->row0 = 0;
-    inReadout7->col0 = 0;
-    inReadout7->image = inImage7;
-    inReadout7->mask = mask7i;
-    pmMaskBadPixels(inReadout7, mask7, 0, 100.0, 1, 10);
-    psFree(mask7);
-    psFree(inReadout7);
-
-    return 0;
-}
-
-int testMaskBadPixels8( void )
-{
-    // Test H - Attempt to use input image mask bigger than mask
-    CREATE_AND_SET_IMAGE(inImage8,F64,0.0,50,50);
-    CREATE_AND_SET_IMAGE(mask8,U8,0,50,50)
-    CREATE_AND_SET_IMAGE(mask8i,U8,0,60,60)
-    //    pmReadout *inReadout8 = pmReadoutAlloc(0, 0, inImage8);
-    pmReadout *inReadout8 = pmReadoutAlloc(NULL);
-    inReadout8->row0 = 0;
-    inReadout8->col0 = 0;
-    inReadout8->image = inImage8;
-    inReadout8->mask = mask8i;
-    pmMaskBadPixels(inReadout8, mask8, 0, 100.0, 1, 10);
-    psFree(mask8);
-    psFree(inReadout8);
-
-    return 0;
-}
-
-int testMaskBadPixels9( void )
-{
-    // Test I - Attempt to use offset greater than input image
-    CREATE_AND_SET_IMAGE(inImage9,F64,0.0,50,50);
-    CREATE_AND_SET_IMAGE(mask9,U8,0,50,50)
-    CREATE_AND_SET_IMAGE(mask9i,U8,0,50,50)
-    //    pmReadout *inReadout9 = pmReadoutAlloc(0, 0, inImage9);
-    pmReadout *inReadout9 = pmReadoutAlloc(NULL);
-    inReadout9->image = inImage9;
-    inReadout9->mask = mask9i;
-    inReadout9->row0 = 0;
-    inReadout9->col0 = 0;
-    *(int*)&inReadout9->col0 = 150;
-    *(int*)&inReadout9->row0 = 150;
-    pmMaskBadPixels(inReadout9, mask9, 0, 100.0, 1, 10);
-    psFree(mask9);
-    psFree(inReadout9);
-
-    return 0;
-}
-
-int testMaskBadPixels10( void )
-{
-    // Test J - Attempt to use complex input image
-    CREATE_AND_SET_IMAGE(inImage10,C64,50.0,50,50);
-    CREATE_AND_SET_IMAGE(mask10,U8,0,50,50)
-    CREATE_AND_SET_IMAGE(mask10i,U8,0,50,50)
-    //    pmReadout *inReadout10 = pmReadoutAlloc(0, 0, inImage10);
-    pmReadout *inReadout10 = pmReadoutAlloc(NULL);
-    inReadout10->row0 = 0;
-    inReadout10->col0 = 0;
-    inReadout10->image = inImage10;
-    inReadout10->mask = mask10i;
-    pmMaskBadPixels(inReadout10, mask10, 0, 100.0, 1, 10);
-    psFree(mask10);
-    psFree(inReadout10);
-
-    return 0;
-}
-
-int testMaskBadPixels11( void )
-{
-    // Test K - Attempt to use non-mask type mask image
-    CREATE_AND_SET_IMAGE(inImage11,F64,50.0,50,50);
-    CREATE_AND_SET_IMAGE(mask11,F64,0,50,50)
-    CREATE_AND_SET_IMAGE(mask11i,U8,0,50,50)
-    //    pmReadout *inReadout11 = pmReadoutAlloc(0, 0, inImage11);
-    pmReadout *inReadout11 = pmReadoutAlloc(NULL);
-    inReadout11->row0 = 0;
-    inReadout11->col0 = 0;
-    inReadout11->image = inImage11;
-    inReadout11->mask = mask11i;
-    pmMaskBadPixels(inReadout11, mask11, 0, 100.0, 1, 10);
-    psFree(mask11);
-    psFree(inReadout11);
-
-    return 0;
-}
-
Index: unk/psModules/test/tst_pmNonLinear.c
===================================================================
--- /trunk/psModules/test/tst_pmNonLinear.c	(revision 5170)
+++ 	(revision )
@@ -1,511 +1,0 @@
-/** @file tst_pmNonLinear.c
- *
- *  @brief Contains the tests for pmNonLinear.c:
- *
- * test00: This code will create a simple polynomial, and call
- * pmNonLinearityPolynomial() for a variety of image sizes [(1, 1), (1,
- * N), (N, 1), (N, N)].  
- *
- * test01: This code will create simple table lookup vectors, and call
- * pmNonLinearityPolynomial() for a variety of image sizes [(1, 1), (1,
- * N), (N, 1), (N, N)].  
- *
- * test02, test03: This code tests the functions with various unallowable
- * input parameters (NULLS) and incorrect vector sizes.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-16 01:10:36 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmNonLinear.h"
-static int test00(void);
-static int test01(void);
-static int test02(void);
-static int test03(void);
-testDescription tests[] = {
-                              {test00, 000, "pmNonLinearityPolynomial", true, false},
-                              {test01, 000, "pmNonLinearityLookup", true, false},
-                              {test02, 000, "pmNonLinearityPolynomial(): error/warning conditions", true, false},
-                              {test03, 000, "pmNonLinearityLookup(): error/warning conditions", true, false},
-                              {NULL}
-                          };
-
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-#define NUM_ROWS 8
-#define NUM_COLS 8
-int doNonLinearityPolynomialTest(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = true;
-    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = myImage;
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
-    myPoly->coeff[1] = 1.0;
-
-    printPositiveTestHeader(stdout, "pmNonLinear", "doNonLinearityPolynomialTest");
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-
-    myReadout = pmNonLinearityPolynomial(myReadout, myPoly);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = psPolynomial1DEval(myPoly, (float) (i + j));
-            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 = false;
-            }
-        }
-    }
-
-
-    psFree(myReadout);
-    psFree(myPoly);
-    printFooter(stdout, "pmNonLinear", "doNonLinearityPolynomialTest", true);
-    return(testStatus);
-}
-
-int test00( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doNonLinearityPolynomialTest(1, 1);
-    testStatus |= doNonLinearityPolynomialTest(NUM_COLS, 1);
-    testStatus |= doNonLinearityPolynomialTest(1, NUM_ROWS);
-    testStatus |= doNonLinearityPolynomialTest(NUM_COLS, NUM_ROWS);
-
-    return(testStatus);
-}
-
-int doNonLinearityLookupTest(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = true;
-    int tableSize = PS_MAX(numCols, numRows)*2;
-    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = myImage;
-    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
-    psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
-
-    printPositiveTestHeader(stdout, "pmNonLinear", "doNonLinearityLookupTest");
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-
-    for (i=0;i<tableSize;i++) {
-        in->data.F32[i] = (float) i;
-        out->data.F32[i] = (float) (2 * i);
-    }
-
-    myReadout = pmNonLinearityLookup(myReadout, in, out);
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-
-    psFree(myReadout);
-    psFree(in);
-    psFree(out);
-    printFooter(stdout, "pmNonLinear", "doNonLinearityLookupTest", true);
-    return(testStatus);
-}
-
-int test01( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doNonLinearityLookupTest(1, 1);
-    testStatus |= doNonLinearityLookupTest(NUM_COLS, 1);
-    testStatus |= doNonLinearityLookupTest(1, NUM_ROWS);
-    testStatus |= doNonLinearityLookupTest (NUM_COLS, NUM_ROWS);
-
-    return(testStatus);
-}
-
-int test02( void )
-{
-    int i;
-    int j;
-    int testStatus = true;
-    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    pmReadout *rc = NULL;
-    myReadout->image = myImage;
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
-    myPoly->coeff[1] = 1.0;
-
-    printPositiveTestHeader(stdout, "pmNonLinear", "Testing bad input parameter conditions.");
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityPolynomial() with NULL input readout.  Should generate error, return NULL.\n");
-    rc = pmNonLinearityPolynomial(NULL, myPoly);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityPolynomial() with NULL input readout->image.  Should generate error, return NULL.\n");
-    psImage *tmpImage = myReadout->image;
-    myReadout->image = NULL;
-    rc = pmNonLinearityPolynomial(myReadout, myPoly);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-    myReadout->image = tmpImage;
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityPolynomial() with NULL polynomial.  Should generate error, return NULL.\n");
-    rc = pmNonLinearityPolynomial(myReadout, NULL);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    psFree(myReadout);
-    psFree(myPoly);
-    return(testStatus);
-}
-
-
-int test03Init(pmReadout *myReadout)
-{
-    for (psS32 i=0;i<NUM_ROWS;i++) {
-        for (psS32 j=0;j<NUM_COLS;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-    return(0);
-}
-
-int test03()
-{
-    int i;
-    int j;
-    int testStatus = true;
-    int tableSize = PS_MAX(NUM_COLS, NUM_ROWS)*3;
-    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    pmReadout *rc = NULL;
-    myReadout->image = myImage;
-    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
-    psVector *inOne = psVectorAlloc(1, PS_TYPE_F32);
-    psVector *inSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
-    psVector *inBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
-    psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
-    psVector *outOne = psVectorAlloc(1, PS_TYPE_F32);
-    psVector *outSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
-    psVector *outBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
-
-    test03Init(myReadout);
-    for (i=0;i<tableSize;i++) {
-        in->data.F32[i] = (float) i;
-        out->data.F32[i] = (float) (2 * i);
-        inBig->data.F32[i] = (float) i;
-        outBig->data.F32[i] = (float) (2 * i);
-        if (i < tableSize-1) {
-            inSmall->data.F32[i] = (float) i;
-            outSmall->data.F32[i] = (float) (2 * i);
-        }
-    }
-    inBig->data.F32[tableSize] = (float) tableSize;
-    outBig->data.F32[tableSize] = (float) (2 * tableSize);
-    inOne->data.F32[0] = 0.0;
-    outOne->data.F32[0] = 0.0;
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with NULL input pmReadout.  Should generate error, return NULL.\n");
-    rc = pmNonLinearityLookup(NULL, in, out);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with NULL input pmReadout->image.  Should generate error, return NULL.\n");
-    psImage *tmpImage = myReadout->image;
-    myReadout->image = NULL;
-    rc = pmNonLinearityLookup(myReadout, in, out);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-    myReadout->image = tmpImage;
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with NULL inFlux psVector.  Should generate error, return NULL.\n");
-    rc = pmNonLinearityLookup(myReadout, NULL, out);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with NULL outFlux psVector.  Should generate error, return NULL.\n");
-    rc = pmNonLinearityLookup(myReadout, in, NULL);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
-        testStatus = false;
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, in, outBig);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, in, outSmall);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, inSmall, out);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, inBig, out);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, inSmall, outBig);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
-    rc = pmNonLinearityLookup(myReadout, inBig, outSmall);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            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 = false;
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original pmReadout.\n");
-    rc = pmNonLinearityLookup(myReadout, inOne, out);
-    if (rc != myReadout) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) ((i + j));
-            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 = false;
-            }
-        }
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
-    test03Init(myReadout);
-    myReadout->image->data.F32[0][0] = -1;
-    rc = pmNonLinearityLookup(myReadout, in, out);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            psF32 actual = rc->image->data.F32[i][j];
-            if(i==0 && j==0) {
-                if(actual != 0.0) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,0.0);
-                }
-            } else {
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = false;
-                }
-            }
-        }
-    }
-
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
-    test03Init(myReadout);
-    myReadout->image->data.F32[NUM_ROWS-1][NUM_COLS-1] = 100;
-    rc = pmNonLinearityLookup(myReadout, in, out);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            psF32 actual = rc->image->data.F32[i][j];
-            if(i==(NUM_ROWS-1) && j==(NUM_COLS-1)) {
-                if(actual != (tableSize-1)*2) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,(tableSize-1)*2.0);
-                }
-            } else {
-                if (FLT_EPSILON < fabs(expect - actual)) {
-                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
-                    testStatus = false;
-                }
-            }
-        }
-    }
-
-    test03Init(myReadout);
-    printf("------------------------------------------------------------\n");
-    printf("Calling pmNonLinearityLookup() with image values not in vector.\n");
-    myReadout->image->data.F32[0][0] = 0.5;
-    rc = pmNonLinearityLookup(myReadout, in, out);
-    if (rc == NULL) {
-        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
-        testStatus = false;
-    }
-    for (i=0;i<NUM_ROWS;i++) {
-        for (j=0;j<NUM_COLS;j++) {
-            psF32 expect = (float) (2 * (i + j));
-            if(i==0 && j==0) {
-                expect = 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 = false;
-            }
-        }
-    }
-
-    psFree(myReadout);
-    psFree(in);
-    psFree(inOne);
-    psFree(inSmall);
-    psFree(inBig);
-    psFree(out);
-    psFree(outOne);
-    psFree(outSmall);
-    psFree(outBig);
-
-    printFooter(stdout, "pmNonLinear", "Testing bad input parameter conditions.", true);
-    return(testStatus);
-}
Index: unk/psModules/test/tst_pmObjects01.c
===================================================================
--- /trunk/psModules/test/tst_pmObjects01.c	(revision 5170)
+++ 	(revision )
@@ -1,1932 +1,0 @@
-/** @file tst_pmFindObjects.c
- *
- *  @brief Contains the tests for pmSubtractSky.c:
- *
- * test00: This code will ...
- *
- *  @author GLG, MHPCC
- *
- * XXX: Must test
- *       pmSourceRoughClass
- *
- * XXX: Must test output results for many other functions.
- *
- * XXX: There are many cases where row/col can be switched in the code.
- * We must test that here by using non-square images.  All tests
- * in this file should be run with non-square images.
- *
- * XXX: Memory leaks are not being caught.  If I allocated a psVector in these functions
- * abd never deallocate, no error is generated.
- *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-16 01:10:36 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-#include "psTest.h"
-#include "pslib.h"
-#include "pmObjects.h"
-#define NUM_ROWS 10
-#define NUM_COLS 10
-#define ERROR_TOLERANCE 1.0
-#define ERROR_TOL 0.001
-static int test00(void);
-static int test01(void);
-static int test02(void);
-static int test03(void);
-static int test04(void);
-static int test05(void);
-static int test06(void);
-static int test07(void);
-static int test08(void);
-static int test09(void);
-static int test15(void);
-static int test16(void);
-static int test20(void);
-testDescription tests[] = {
-                              {test00, 000, "pmObjects: structure allocators and deallocators", true, false},
-                              {test01, 001, "pmObjects: psFindVectorPeaks()", true, false},
-                              {test02, 001, "pmObjects: psFindImagePeaks()", true, false},
-                              {test03, 001, "pmObjects: pmCullPeaks()", true, false},
-                              {test04, 001, "pmObjects: pmSourceLocalSky()", true, false},
-                              {test06, 001, "pmObjects: pmSourceSetPixelsCircle()", true, false},
-                              {test05, 001, "pmObjects: pmSourceMoments()", true, false},
-                              {test07, 001, "pmObjects: pmMin()", true, false},
-                              {test08, 001, "pmObjects: pmSourceModelGuess()", true, false},
-                              {test09, 001, "pmObjects: pmSourceContour()", true, false},
-                              {test15, 001, "pmObjects: pmSourceAddModel()", true, false},
-                              {test16, 001, "pmObjects: pmSourceSubModel()", true, false},
-                              {test20, 001, "pmObjects: pmSourceSubModel()", true, false},
-                              {NULL}
-                          };
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-/******************************************************************************
-test00(): Test the various allocators and deallocators.
- *****************************************************************************/
-int test00( void )
-{
-    bool testStatus = true;
-    psTraceSetLevel(".", 0);
-
-    printf("Testing pmPeakAlloc()...\n");
-    pmPeak *tmpPeak = pmPeakAlloc(1, 2, 3.0, PM_PEAK_LONE);
-    if (tmpPeak == NULL) {
-        printf("TEST ERROR: pmPeakAlloc() returned a NULL pmPeak\n");
-        testStatus = false;
-    } else {
-        if (tmpPeak->x != 1) {
-            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->x\n");
-            testStatus = false;
-        }
-        if (tmpPeak->y != 2) {
-            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->y\n");
-            testStatus = false;
-        }
-        if (tmpPeak->counts != 3.0) {
-            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->counts\n");
-            testStatus = false;
-        }
-        if (tmpPeak->class != PM_PEAK_LONE) {
-            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->class\n");
-            testStatus = false;
-        }
-    }
-    psFree(tmpPeak);
-
-    printf("Testing pmMomentsAlloc()...\n");
-    pmMoments *tmpMoments = pmMomentsAlloc();
-    if (tmpMoments == NULL) {
-        printf("TEST ERROR: pmMomentsAlloc() returned a NULL pmMoments\n");
-        testStatus = false;
-    } else {
-        if ((fabs(tmpMoments->x-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->y-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Sx-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Sy-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Sxy-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Sum-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Peak-0.0) > ERROR_TOL) ||
-                (fabs(tmpMoments->Sky-0.0) > ERROR_TOL) ||
-                (tmpMoments->nPixels != 0)) {
-            printf("TEST ERROR: pmMomentsAlloc() did not properly initialize the pmMoments structure.\n");
-            testStatus = false;
-        }
-    }
-    psFree(tmpMoments);
-
-    printf("Testing pmModelAlloc(PS_MODEL_GAUSS)...\n");
-    pmModel *tmpModel = pmModelAlloc(PS_MODEL_GAUSS);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 7) || (tmpModel->dparams->n != 7)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 7 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    printf("Testing pmModelAlloc(PS_MODEL_PGAUSS)...\n");
-    tmpModel = pmModelAlloc(PS_MODEL_PGAUSS);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 7) || (tmpModel->dparams->n != 7)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 7 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    printf("Testing pmModelAlloc(PS_MODEL_TWIST_GAUSS)...\n");
-    tmpModel = pmModelAlloc(PS_MODEL_TWIST_GAUSS);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 11) || (tmpModel->dparams->n != 11)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 11 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    printf("Testing pmModelAlloc(PS_MODEL_WAUSS)...\n");
-    tmpModel = pmModelAlloc(PS_MODEL_WAUSS);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 9) || (tmpModel->dparams->n != 9)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 9 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    printf("Testing pmModelAlloc(PS_MODEL_SERSIC)...\n");
-    tmpModel = pmModelAlloc(PS_MODEL_SERSIC);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 8) || (tmpModel->dparams->n != 8)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 8 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    printf("Testing pmModelAlloc(PS_MODEL_SERSIC_CORE)...\n");
-    tmpModel = pmModelAlloc(PS_MODEL_SERSIC_CORE);
-    if (tmpModel == NULL) {
-        printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) returned a NULL pmModel\n");
-        testStatus = false;
-    } else {
-        if ((tmpModel->params->n != 12) || (tmpModel->dparams->n != 12)) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) allocated an incorrect number of params (%ld, %ld)\n",
-                   tmpModel->params->n, tmpModel->dparams->n);
-            testStatus = false;
-        } else {
-            for (psS32 i = 0 ; i < 12 ; i++) {
-                if ((tmpModel->params->data.F32[i] != 0.0) ||
-                        (tmpModel->dparams->data.F32[i] != 0.0)) {
-                    printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) did not ininitialize the params/dparams array to 0.0.\n");
-                    testStatus = false;
-                }
-            }
-        }
-    }
-    psFree(tmpModel);
-
-    pmSource *tmpSource = pmSourceAlloc();
-    if (tmpSource == NULL) {
-        printf("TEST ERROR: pmSourceAlloc() returned a NULL pmSource\n");
-        testStatus = false;
-    }
-    psFree(tmpSource);
-
-    return(testStatus);
-}
-
-/******************************************************************************
-test01(): we first test pmFindVectorPeaks() with a variety of bad input
-parameters.  Then we test it with a simple vector both 1- and multi-elements.
- *****************************************************************************/
-#define TST01_VECTOR_LENGTH 10
-bool test_pmFindVectorPeaks(int n)
-{
-    bool testStatus = true;
-    psVector *inData = psVectorAlloc(n, PS_TYPE_F32);
-    psVector *outData = NULL;
-
-    printf("-------------- Calling test_pmFindVectorPeaks on an %d size vector. --------------\n", n);
-    //
-    // Test first pixel peak.
-    //
-    printf("Test pmFindVectorPeaks() with a first-element peak.\n");
-    for (psS32 i = 0 ; i < n ; i++) {
-        inData->data.F32[i] = (float) (n-i);
-    }
-    inData->data.F32[0] = (float) n;
-
-    outData= pmFindVectorPeaks(inData, 0.0);
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-        if (outData->n != 1) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-        if (outData->data.U32[0] != 0) {
-            printf("TEST ERROR: Did not find peak at element 0.\n");
-            testStatus = false;
-        }
-        psFree(outData);
-    }
-
-    //
-    // Test first pixel peak, large threshold
-    //
-    printf("Test pmFindVectorPeaks() with a first-element peak, large threshold.\n");
-    for (psS32 i = 0 ; i < n ; i++) {
-        inData->data.F32[i] = (float) (n-i);
-    }
-    inData->data.F32[0] = (float) n;
-
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-
-        if (outData->n != 0) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-        psFree(outData);
-
-        // Skip remaining tests if the input vector has length 1.
-        if (n == 1) {
-            psFree(inData);
-            return(testStatus);
-        }
-    }
-
-    //
-    // Test last pixel peak.
-    //
-    printf("Test pmFindVectorPeaks() with a last-element peak.\n");
-    for (psS32 i = 0 ; i < n ; i++) {
-        inData->data.F32[i] = (float) (i);
-    }
-    inData->data.F32[n-1] = (float) n;
-
-    outData= pmFindVectorPeaks(inData, 0.0);
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-
-        if (outData->n != 1) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-        if (outData->data.U32[0] != n-1) {
-            printf("TEST ERROR: Did not find peak at element %d.\n", n-1);
-            testStatus = false;
-        }
-        psFree(outData);
-    }
-
-    //
-    // Test last pixel peak, large threshold.
-    //
-    printf("Test pmFindVectorPeaks() with a last-element peak, large threshold.\n");
-    for (psS32 i = 0 ; i < n ; i++) {
-        inData->data.F32[i] = (float) (i);
-    }
-    inData->data.F32[n-1] = (float) n;
-
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-
-        if (outData->n != 0) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-        psFree(outData);
-    }
-
-    //
-    // Test interior peaks.
-    // Set all even number elements to be peaks.
-    //
-    printf("Test pmFindVectorPeaks() with all even-numbered elements peak.\n");
-    for (psS32 i = 0 ; i < n ; i++) {
-        if (0 == i%2) {
-            inData->data.F32[i] = (float) (2 * i);
-        } else {
-            inData->data.F32[i] = (float) (i);
-        }
-    }
-    inData->data.F32[0] = (float) n;
-
-
-    outData= pmFindVectorPeaks(inData, 0.0);
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-
-        if (outData->n != n/2) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-
-        for (psS32 i = 0 ; i < outData->n ; i++) {
-            if (outData->data.U32[i] != (2 * i)) {
-                printf("TEST ERROR: the %d-th peak is element number %d\n", i, outData->data.U32[i]);
-                testStatus = false;
-            }
-        }
-        psFree(outData);
-    }
-
-    //
-    // Test interior peaks, with threshold = n*n.
-    // Should generate an empty output psVector.
-    //
-    printf("Test pmFindVectorPeaks() with all even-numbered elements peak, large threshold.\n");
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
-        testStatus = false;
-    } else {
-
-        if (outData->n != 0) {
-            printf("TEST ERROR: outData->n is %ld\n", outData->n);
-            testStatus = false;
-        }
-        psFree(outData);
-    }
-
-    psFree(inData);
-    return(testStatus);
-}
-
-int test01( void )
-{
-    bool testStatus = true;
-    psVector *tmpVec = NULL;
-    psVector *tmpVecF64 = psVectorAlloc(TST01_VECTOR_LENGTH, PS_TYPE_F64);
-    psVector *tmpVecEmpty = psVectorAlloc(0, PS_TYPE_F32);
-
-    psTraceSetLevel(".", 0);
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindVectorPeaks with NULL psVector.  Should generate error and return NULL.\n");
-    tmpVec = pmFindVectorPeaks(NULL, 0.0);
-    if (tmpVec != NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
-        testStatus = false;
-        psFree(tmpVec);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindVectorPeaks with empty psVector.  Should generate error and return NULL.\n");
-    tmpVec = pmFindVectorPeaks(tmpVecEmpty, 0.0);
-    if (tmpVec != NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
-        testStatus = false;
-        psFree(tmpVec);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindVectorPeaks with PS_TYPE_F64 psVector.  Should generate error and return NULL.\n");
-    tmpVec = pmFindVectorPeaks(tmpVecF64, 0.0);
-    if (tmpVec != NULL) {
-        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
-        testStatus = false;
-        psFree(tmpVec);
-    }
-    testStatus&= test_pmFindVectorPeaks(1);
-    testStatus&= test_pmFindVectorPeaks(TST01_VECTOR_LENGTH);
-
-    psFree(tmpVecF64);
-    psFree(tmpVecEmpty);
-    return(testStatus);
-}
-
-/******************************************************************************
-test02():
-// XXX: Must test flat peaks.
-// XXX: test 1-by-n and n-by-1 images.
- *****************************************************************************/
-#define TST02_NUM_ROWS 5
-#define TST02_NUM_COLS 5
-bool test_pmFindImagePeaks(int numRows, int numCols)
-{
-    printf("-------------- Calling test_pmFindImagePeaks on an %d-by-%d image. --------------\n", numRows, numCols);
-    //    if ((numRows < 4) || (numCols < 4)) {
-    //        printf("WARNING: Don't call this test with a smaller than 4-by-4 image.\n");
-    //        return(true);
-    //    }
-    bool testStatus = true;
-    psImage *inData = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psArray *outData = NULL;
-
-    //
-    // Initialize test image.
-    //
-    for (psS32 i = 0 ; i < numRows ; i++) {
-        for (psS32 j = 0 ; j < numCols ; j++) {
-            inData->data.F32[i][j] = PS_SQR(i - numRows/2) + PS_SQR(j-numCols/2);
-        }
-    }
-    //
-    // Set corner and center pixels as peaks.
-    //
-    inData->data.F32[0][0] = PS_SQR(numRows) + PS_SQR(numCols);
-    inData->data.F32[0][numCols-1] = PS_SQR(numRows) + PS_SQR(numCols);
-    inData->data.F32[numRows-1][0] = PS_SQR(numRows) + PS_SQR(numCols);
-    inData->data.F32[numRows-1][numCols-1] = PS_SQR(numRows) + PS_SQR(numCols);
-    inData->data.F32[numRows/2][numCols/2] = PS_SQR(numRows) + PS_SQR(numCols);
-
-    //
-    // Print image.
-    //
-    for (psS32 i = 0 ; i < numRows ; i++) {
-        for (psS32 j = 0 ; j < numCols ; j++) {
-            printf("(%.1f) ", inData->data.F32[i][j]);
-        }
-        printf("\n");
-    }
-
-    //
-    // Call pmFindImagePeaks() with a threshold of 0.0.
-    //
-    outData = pmFindImagePeaks(inData, 0.0);
-
-    if (outData == NULL) {
-        printf("TEST ERROR: pmFindImagePeaks returned a NULL psList.\n");
-        testStatus = false;
-    } else {
-        psS32 expectedNumPeaks;
-        if ((numRows == 1) && (numCols == 1)) {
-            expectedNumPeaks = 1;
-        } else if ((numRows == 1) || (numCols == 1)) {
-            expectedNumPeaks = 3;
-        } else {
-            expectedNumPeaks = 5;
-        }
-        if (outData->n != expectedNumPeaks) {
-            printf("TEST ERROR: pmFindImagePeaks found %ld peaks (should be %d)\n", outData->n, expectedNumPeaks);
-            testStatus = false;
-        }
-
-        // HEY: verify
-        for (psS32 i = 0 ; i < outData->n ; i++) {
-            pmPeak *tmpPeak = (pmPeak *) outData->data[i];
-            if (((tmpPeak->x == 0) && (tmpPeak->y == 0)) ||
-                    ((tmpPeak->x == 0) && (tmpPeak->y == numRows-1)) ||
-                    ((tmpPeak->x == numCols-1) && (tmpPeak->y == 0)) ||
-                    ((tmpPeak->x == numCols-1) && (tmpPeak->y == numRows-1))) {
-                if (!((tmpPeak->class & PM_PEAK_LONE) || (tmpPeak->class & PM_PEAK_EDGE))) {
-                    printf("TEST ERROR: (0) peak at (%d, %d) (%f) ->class set improperly (0x%x).",
-                           tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
-                    printf(" should be (0x%x or 0x%x).\n", PM_PEAK_LONE, PM_PEAK_EDGE);
-                    testStatus = false;
-                }
-            } else if ((tmpPeak->x == numCols/2) && (tmpPeak->y == numRows/2)) {
-                if (tmpPeak->class != PM_PEAK_LONE) {
-                    printf("TEST ERROR: (1) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n",
-                           tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
-                    printf(" should be (0x%x).\n", PM_PEAK_LONE);
-                    testStatus = false;
-                }
-            } else {
-                printf("TEST ERROR: Peak at (%d, %d) (%f)\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts);
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(inData);
-    psFree(outData);
-    return(testStatus);
-}
-
-int test02( void )
-{
-    bool testStatus = true;
-    psArray *tmpArray = NULL;
-    psImage *tmpImageF64 = psImageAlloc(TST02_NUM_ROWS, TST02_NUM_COLS, PS_TYPE_F64);
-    psImage *tmpImageEmpty = psImageAlloc(0, 0, PS_TYPE_F32);
-
-    psTraceSetLevel(".", 0);
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindImagePeaks with NULL psImage.  Should generate error and return NULL.\n");
-    tmpArray = pmFindImagePeaks(NULL, 0.0);
-    if (tmpArray != NULL) {
-        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
-        testStatus = false;
-        psFree(tmpArray);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindImagePeaks with empty psImage.  Should generate error and return NULL.\n");
-    tmpArray = pmFindImagePeaks(tmpImageEmpty, 0.0);
-    if (tmpArray != NULL) {
-        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
-        testStatus = false;
-        psFree(tmpArray);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmFindImagePeaks with PS_TYPE_F64 psImage.  Should generate error and return NULL.\n");
-    tmpArray = pmFindImagePeaks(tmpImageF64, 0.0);
-    if (tmpArray != NULL) {
-        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
-        testStatus = false;
-        psFree(tmpArray);
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    //    testStatus&= test_pmFindImagePeaks(1, 1);
-    //    testStatus&= test_pmFindImagePeaks(2, 5);
-    //    testStatus&= test_pmFindImagePeaks(5, 2);
-    // HEY: add code for small images
-    //    testStatus&= test_pmFindImagePeaks(1, 1);
-    //    testStatus&= test_pmFindImagePeaks(1, 8);
-    //    testStatus&= test_pmFindImagePeaks(8, 1);
-    testStatus&= test_pmFindImagePeaks(TST02_NUM_ROWS,   TST02_NUM_COLS);
-    testStatus&= test_pmFindImagePeaks(2*TST02_NUM_ROWS, TST02_NUM_COLS);
-    testStatus&= test_pmFindImagePeaks(TST02_NUM_ROWS,   2*TST02_NUM_COLS);
-
-
-    psFree(tmpImageF64);
-    psFree(tmpImageEmpty);
-    return(testStatus);
-}
-
-/******************************************************************************
-test03(): We first test pmCullPeaks() with various NULL and unallowable input
-parameters.  Then we generate a list of peaks and test that pmCullPeaks()
-removes them correctly.
- *****************************************************************************/
-int test03( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
-    psArray *outData = NULL;
-
-    /* XXX: Modify for new pmCullPeaks()
-            printf("----------------------------------------------------------------------------------\n");
-            printf("Calling pmCullPeaks with NULL psList.  Should generate error and return NULL.\n");
-            outData = pmCullPeaks(NULL, 0.0, NULL);
-            if (outData != NULL) {
-                printf("TEST ERROR: pmCulPeaks() returned a non-NULL psList.\n");
-                testStatus = false;
-        }
-    */
-
-    //
-    // Set peaks in input image.  All even-column and even-row pixels are
-    // set non-zero, all other pixels are set to zero.
-    //
-    psS32 numPeaksOrig = 0;
-    for (psS32 i = 0 ; i < NUM_ROWS ; i++) {
-        for (psS32 j = 0 ; j < NUM_COLS ; j++) {
-            if ((0 == i%2) && (0 == j%2)) {
-                imgData->data.F32[i][j] = (float) (i + 10);
-                numPeaksOrig++;
-            } else {
-                imgData->data.F32[i][j] = 0.0;
-            }
-        }
-    }
-    for (psS32 i = 0 ; i < NUM_ROWS ; i++) {
-        for (psS32 j = 0 ; j < NUM_COLS ; j++) {
-            printf("(%.1f) ", imgData->data.F32[i][j]);
-        }
-        printf("\n");
-    }
-    printf("Set %d peaks\n", numPeaksOrig);
-
-    //
-    // Call pmCullPeaks() with HUGE maxValue and NULL psRegion.  Should not
-    // remove any peaks.
-    //
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmCullPeaks with large maxValue and NULL psRegion.\n");
-    outData = pmFindImagePeaks(imgData, 0.0);
-    /* XXX: Modify for new pmCullPeaks
-        outData = pmCullPeaks(outData, PS_MAX_F32, NULL);
-
-        if (outData == NULL) {
-            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-            testStatus = false;
-            return(testStatus);
-        }
-        if (outData->n != numPeaksOrig) {
-            printf("TEST ERROR (0): pmCullPeaks incorrectly removed peaks\n");
-            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, numPeaksOrig);
-            testStatus = false;
-        }
-    */
-    psFree(outData);
-
-    //
-    // Call pmCullPeaks() with TINY maxValue and NULL psRegion.  Should
-    // remove all peaks.
-    //
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmCullPeaks with tiny maxValue and NULL psRegion.\n");
-    outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %ld peaks\n", outData->n);
-    /* XXX: Modify for new pmCullPeaks
-        outData = pmCullPeaks(outData, 0.0, NULL);
-
-        if (outData == NULL) {
-            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-            testStatus = false;
-            return(testStatus);
-        }
-        if (outData->n != 0) {
-            printf("TEST ERROR (1): pmCullPeaks incorrectly removed peaks\n");
-            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, 0);
-            testStatus = false;
-        }
-        psFree(outData);
-    */
-
-    //
-    // Call pmCullPeaks() with HUGE maxValue and disjoint psRegion.  Should
-    // not remove any peaks.
-    //
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmCullPeaks with large maxValue and disjoint psRegion.\n");
-    outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %ld peaks\n", outData->n);
-    psRegion tmpRegion = psRegionSet(10000.0, 20000.0, 10000.0, 20000.0);
-
-    /* XXX: Modify for new pmCullPeaks
-        outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
-
-        if (outData == NULL) {
-            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-            testStatus = false;
-            return(testStatus);
-        }
-        if (outData->n != numPeaksOrig) {
-            printf("TEST ERROR (2): pmCullPeaks incorrectly removed peaks\n");
-            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, numPeaksOrig);
-            testStatus = false;
-        }
-    */
-    psFree(outData);
-
-    //
-    // Call pmCullPeaks() with HUGE maxValue and non-disjoint psRegion.  Should
-    // remove all peaks.
-    //
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmCullPeaks with large maxValue and non-disjoint psRegion.\n");
-    outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %ld peaks\n", outData->n);
-    tmpRegion = psRegionSet(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
-    /* XXX: Modify for new pmCullPeaks
-        outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
-
-        if (outData == NULL) {
-            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-            testStatus = false;
-            return(testStatus);
-        }
-        if (outData->n != 0) {
-            printf("TEST ERROR (3): pmCullPeaks incorrectly removed peaks\n");
-            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, 0);
-            testStatus = false;
-        }
-    */
-    psFree(outData);
-
-    printf("----------------------------------------------------------------------------------\n");
-    psFree(imgData);
-    return(testStatus);
-}
-
-#define TST04_NUM_ROWS 100
-#define TST04_NUM_COLS 100
-#define TST04_SKY 20.0
-#define TST04_INNER_RADIUS 3
-#define TST04_OUTER_RADIUS 5
-/******************************************************************************
-test04(): We first test pmSourceLocalSky() with various NULL and unallowable
-input parameters.
- 
-XXX: Should we produce tests with boundary numbers for the inner/outer radius?
- 
-XXX: Call this with varying sizes for the image.
- *****************************************************************************/
-int test04( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST04_NUM_COLS, TST04_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST04_SKY;
-        }
-    }
-    psImage *imgDataF64 = psImageAlloc(TST04_NUM_COLS, TST04_NUM_ROWS, PS_TYPE_F64);
-    for (psS32 i = 0 ; i < imgDataF64->numRows; i++) {
-        for (psS32 j = 0 ; j < imgDataF64->numCols; j++) {
-            imgDataF64->data.F64[i][j] = 0.0;
-        }
-    }
-    pmSource *rc = NULL;
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
-                                  (psF32) (TST04_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with NULL psImage.  Should generate error and return NULL.\n");
-    rc = pmSourceLocalSky(NULL, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-        psFree(rc);
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with wrong-type psImage.  Should generate error and return NULL.\n");
-    rc = pmSourceLocalSky(imgDataF64, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-        psFree(rc);
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with NULL pmPeak.  Should generate error and return NULL.\n");
-    rc = pmSourceLocalSky(imgData, NULL, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-        psFree(rc);
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with innerRadius<0.0.  Should generate error and return NULL.\n");
-    rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, -10.0, 20.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-        psFree(rc);
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with innerRadius>outerRadius.  Should generate error and return NULL.\n");
-    rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 5.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-        psFree(rc);
-        testStatus = false;
-    }
-    /* XXX: This is commented out since the EAM modification no longer generated NULLS for these tests.
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceLocalSky with subImage startRow < 0.  Should generate error and return NULL.\n");
-        tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-        tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-        tmpPeak->y = 1;
-        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-        if (rc != NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-            psFree(rc);
-            testStatus = false;
-        }
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceLocalSky with subImage endRow > numRows.  Should generate error and return NULL.\n");
-        tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-        tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-        tmpPeak->y = TST04_NUM_ROWS;
-        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-        if (rc != NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-            psFree(rc);
-            testStatus = false;
-        }
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceLocalSky with subImage startCol < 0.  Should generate error and return NULL.\n");
-        tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-        tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-        tmpPeak->x = 1;
-        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
-        if (rc != NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-            psFree(rc);
-            testStatus = false;
-        }
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceLocalSky with subImage endCol > numCols.  Should generate error and return NULL.\n");
-        tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-        tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-        tmpPeak->x = TST04_NUM_COLS;
-        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, (psF32) TST04_INNER_RADIUS, (psF32) TST04_OUTER_RADIUS);
-        if (rc != NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
-            psFree(rc);
-            testStatus = false;
-        }
-    */
-
-    //
-    // XXX: The following code should be a separate function, and we should call it
-    // with a variety of image sizes, peaks.
-    //
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-    rc = pmSourceLocalSky(imgData,
-                          tmpPeak,
-                          PS_STAT_SAMPLE_MEAN,
-                          (psF32) TST04_INNER_RADIUS,
-                          (psF32) TST04_OUTER_RADIUS);
-
-    if (rc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    } else {
-        if (rc->peak == NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource->peak.\n");
-            testStatus = false;
-        } else {
-            if (rc->peak->x != tmpPeak->x) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->x was %d, should have been %d.\n", rc->peak->x, tmpPeak->x);
-                testStatus = false;
-            }
-
-            if (rc->peak->y != tmpPeak->y) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->y was %d, should have been %d.\n", rc->peak->y, tmpPeak->y);
-                testStatus = false;
-            }
-
-            if (rc->peak->counts != tmpPeak->counts) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->counts was %f, should have been %f.\n", rc->peak->counts, tmpPeak->counts);
-                testStatus = false;
-            }
-
-            if (rc->peak->class != tmpPeak->class) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->class was %d, should have been %d.\n", rc->peak->class, tmpPeak->class);
-                testStatus = false;
-            }
-        }
-
-        if (rc->pixels == NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels was NULL.\n");
-            testStatus = false;
-        } else {
-            if (rc->pixels->numRows != (2 * TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->numRows was %d, should have been %d.\n",
-                       rc->pixels->numRows, (2 * TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->pixels->numCols != (2 * TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->numCols was %d, should have been %d.\n",
-                       rc->pixels->numCols, (2 * TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->pixels->col0 != (tmpPeak->x - TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->col0 was %d, should have been %d.\n",
-                       rc->pixels->col0, (tmpPeak->x - TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->pixels->row0 != (tmpPeak->y - TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->row0 was %d, should have been %d.\n",
-                       rc->pixels->row0, (tmpPeak->y - TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->pixels->type.type != PS_TYPE_F32) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->type was %d, should have been %d.\n",
-                       rc->pixels->type.type, PS_TYPE_F32);
-                testStatus = false;
-            }
-
-            // XXX: Test the rc->pixels-> row/col offsets.
-            // XXX: Test that the pixels corresponds to the source image pixels.
-        }
-
-        if (rc->mask == NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() pmSource->mask was NULL.\n");
-            testStatus = false;
-        } else {
-            if (rc->mask->numRows != (2 * TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->numRows was %d, should have been %d.\n",
-                       rc->mask->numRows, (2 * TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->mask->numCols != (2 * TST04_OUTER_RADIUS)) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->numCols was %d, should have been %d.\n",
-                       rc->mask->numCols, (2 * TST04_OUTER_RADIUS));
-                testStatus = false;
-            }
-
-            if (rc->mask->type.type != PS_TYPE_U8) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->type was %d, should have been %d.\n",
-                       rc->mask->type.type, PS_TYPE_U8);
-                testStatus = false;
-            }
-
-            // XXX: Test the rc->mask-> row/col offsets.
-            // XXX: Test that the correct pixels were masked, not merely the number of masked pixels.
-            psS32 unmaskedPixels = 0;
-            psS32 maskedPixels = 0;
-
-            for (psS32 row = 0 ; row < rc->mask->numRows; row++) {
-                for (psS32 col = 0 ; col < rc->mask->numCols; col++) {
-                    if (rc->mask->data.U8[row][col] == 0) {
-                        unmaskedPixels++;
-                    } else {
-                        maskedPixels++;
-                    }
-                }
-            }
-            if (maskedPixels != PS_SQR(2*(TST04_INNER_RADIUS-1))) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask had %d masked pixels, should have been %d.\n",
-                       maskedPixels, PS_SQR(2*(TST04_INNER_RADIUS-1)));
-                testStatus = false;
-            }
-            if (unmaskedPixels != (PS_SQR(2*TST04_OUTER_RADIUS) - PS_SQR(2*(TST04_INNER_RADIUS-1)))) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask had %d masked pixels, should have been %d.\n",
-                       unmaskedPixels, (PS_SQR(2*TST04_OUTER_RADIUS) - PS_SQR(2*(TST04_INNER_RADIUS-1))));
-                testStatus = false;
-            }
-        }
-
-        if (rc->moments == NULL) {
-            printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource->moments.\n");
-            testStatus = false;
-        } else {
-            if (rc->moments->Sky != TST04_SKY) {
-                printf("TEST ERROR: pmSourceLocalSky() pmSource->moments->Sky was %f, should have been %f.\n", rc->moments->Sky, TST04_SKY);
-                testStatus = false;
-            }
-        }
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    psFree(rc);
-    psFree(imgData);
-    psFree(imgDataF64);
-    return(testStatus);
-}
-
-#define TST06_NUM_ROWS 100
-#define TST06_NUM_COLS 100
-#define TST06_SKY 20.0
-#define TST06_INNER_RADIUS 3
-#define TST06_OUTER_RADIUS 5
-/******************************************************************************
-test06(): We first test pmSourceLocalSky() with various NULL and unallowable
-input parameters.
- 
-XXX: Should we produce tests with boundary numbers for the inner/outer radius?
- 
-XXX: Call this with varying sizes for the image.
- *****************************************************************************/
-int test06( void )
-{
-    bool testStatus = true;
-    pmSource *tmpSource = NULL;
-    bool rc = false;
-    // Create the image used in this test.
-    psImage *imgData = psImageAlloc(TST06_NUM_COLS, TST06_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST06_SKY;
-        }
-    }
-    psImage *imgDataF64 = psImageAlloc(TST06_NUM_COLS, TST06_NUM_ROWS, PS_TYPE_F64);
-    for (psS32 i = 0 ; i < imgDataF64->numRows; i++) {
-        for (psS32 j = 0 ; j < imgDataF64->numCols; j++) {
-            imgDataF64->data.F64[i][j] = 0.0;
-        }
-    }
-
-    //
-    // Create a pmPeak with the center pixel set to the peak.
-    //
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST06_NUM_ROWS / 2),
-                                  (psF32) (TST06_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    tmpSource = pmSourceLocalSky(imgData,
-                                 tmpPeak,
-                                 PS_STAT_SAMPLE_MEAN,
-                                 (psF32) TST06_INNER_RADIUS,
-                                 (psF32) TST06_OUTER_RADIUS);
-    if (tmpSource == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        psFree(imgData);
-        psFree(imgDataF64);
-        psFree(tmpSource);
-        testStatus = false;
-        return(testStatus);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSetPixelsCircle with NULL pmSource.  Should generate error and return NULL.\n");
-    rc = pmSourceSetPixelsCircle(NULL, imgData, 10.0);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-        testStatus = false;
-    }
-    // XXX: test with pmSource->peaks NULL
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSetPixelsCircle with NULL psImage.  Should generate error and return NULL.\n");
-    rc = pmSourceSetPixelsCircle(tmpSource, NULL, 10.0);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSetPixelsCircle with wrong type psImage.  Should generate error and return NULL.\n");
-    rc = pmSourceSetPixelsCircle(tmpSource, imgDataF64, 10.0);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSetPixelsCircle with radius < 0.0.  Should generate error and return NULL.\n");
-    rc = pmSourceSetPixelsCircle(tmpSource, imgData, -10.0);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    /* XXX: Commented away since the EAM mods no longer produced errors.
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceSetPixelsCircle with subImage startCol < 0.  Should generate error and return NULL.\n");
-        tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2);
-        tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2);
-        tmpSource->peak->x = 1;
-        rc = pmSourceSetPixelsCircle(tmpSource, imgData, 10.0);
-        if (rc == true) {
-            printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-            testStatus = false;
-        }
-
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceSetPixelsCircle with subImage endCol > numCols.  Should generate error and return NULL.\n");
-        tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2);
-        tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2);
-        tmpSource->peak->x = TST06_NUM_COLS;
-        rc = pmSourceSetPixelsCircle(tmpSource, imgData, 10.0);
-        if (rc == true) {
-            printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-            testStatus = false;
-        }
-
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceSetPixelsCircle with subImage startRow < 0.  Should generate error and return NULL.\n");
-        tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2);
-        tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2);
-        tmpSource->peak->y = 1;
-        rc = pmSourceSetPixelsCircle(tmpSource, imgData, 10.0);
-        if (rc == true) {
-            printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-            testStatus = false;
-        }
-
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceSetPixelsCircle with subImage endRow > numRows.  Should generate error and return NULL.\n");
-        tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2);
-        tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2);
-        tmpSource->peak->y = TST06_NUM_ROWS;
-        rc = pmSourceSetPixelsCircle(tmpSource, imgData, 10.0);
-        if (rc == true) {
-            printf("TEST ERROR: pmSourceSetPixelsCircle() returned TRUE.\n");
-            testStatus = false;
-        }
-    */
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSetPixelsCircle with valid data.\n");
-    tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2);
-    tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2);
-    rc = pmSourceSetPixelsCircle(tmpSource, imgData, 10.0);
-
-    if (rc == false) {
-        printf("TEST ERROR: pmSourceSetPixelsCircle() returned FALSE.\n");
-        testStatus = false;
-    } else {
-        // XXX: Test correctness of the various psSetPixelsCircle members.
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    //    psFree(imgData);
-    //    psFree(imgDataF64);
-    psFree(tmpSource);
-    return(testStatus);
-
-}
-
-#define TST05_NUM_ROWS 100
-#define TST05_NUM_COLS 100
-#define TST05_SKY 20.0
-#define TST05_INNER_RADIUS 3
-#define TST05_OUTER_RADIUS 5
-/******************************************************************************
-test05(): We first test pmSourceMoments() with various NULL and unallowable
-input parameters.
- 
-XXX: Should we produce tests with boundary numbers for the inner/outer radius?
- 
-XXX: Call this with varying sizes for the image.
- 
-XXX: The actual values of the moments are not tested.
- *****************************************************************************/
-int test05( void )
-{
-    bool testStatus = true;
-    pmSource *tmpSource = NULL;
-    pmSource *rc = NULL;
-    // Create the image used in this test.
-    psImage *imgData = psImageAlloc(TST05_NUM_COLS, TST05_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST05_SKY;
-        }
-    }
-
-    //
-    // Create a pmPeak with the center pixel set to the peak.
-    //
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST05_NUM_ROWS / 2),
-                                  (psF32) (TST05_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    tmpSource = pmSourceLocalSky(imgData,
-                                 tmpPeak,
-                                 PS_STAT_SAMPLE_MEAN,
-                                 (psF32) TST05_INNER_RADIUS,
-                                 (psF32) TST05_OUTER_RADIUS);
-    if (tmpSource == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        psFree(tmpSource);
-        testStatus = false;
-        return(testStatus);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceMoments with NULL pmSource.  Should generate error and return NULL.\n");
-    rc = pmSourceMoments(NULL, 10.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceMoments() returned a non-NULL pmSource.\n");
-        testStatus = false;
-    }
-    // XXX: test with pmSource->peaks NULL
-    // XXX: test with pmSource->pixels NULL
-    // XXX: test with pmSource->mask NULL
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceMoments with radius < 0.0.  Should generate error and return NULL.\n");
-    rc = pmSourceMoments(tmpSource, -10.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceMoments() returned a non-NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    psFree(tmpSource);
-    return(testStatus);
-
-}
-
-/******************************************************************************
-test07(): We first test the various psMinLM_... routines with various NULL and
-unallowable input parameters.
- 
-XXX: We don't verify the numbers.  Must do this.
- *****************************************************************************/
-int test07( void )
-{
-    bool testStatus = true;
-    psF32 rc;
-    psVector *deriv = psVectorAlloc(7, PS_TYPE_F32);
-    psVector *params = psVectorAlloc(7, PS_TYPE_F32);
-    psVector *x = psVectorAlloc(2, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 7 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Gauss2D with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_Gauss2D(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Gauss2D() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Gauss2D with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Gauss2D(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Gauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Gauss2D with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Gauss2D(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Gauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    psFree(deriv);
-    psFree(params);
-
-    deriv = psVectorAlloc(7, PS_TYPE_F32);
-    params = psVectorAlloc(7, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 7 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_PsuedoGauss2D with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_PsuedoGauss2D(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_PsuedoGauss2D() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_PsuedoGauss2D with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_PsuedoGauss2D(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_PsuedoGauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_PsuedoGauss2D with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_PsuedoGauss2D(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_PsuedoGauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    psFree(deriv);
-    psFree(params);
-
-
-    deriv = psVectorAlloc(9, PS_TYPE_F32);
-    params = psVectorAlloc(9, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 9 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Wauss2D with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_Wauss2D(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Wauss2D() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Wauss2D with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Wauss2D(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Wauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Wauss2D with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Wauss2D(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Wauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    psFree(deriv);
-    psFree(params);
-
-    deriv = psVectorAlloc(11, PS_TYPE_F32);
-    params = psVectorAlloc(11, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 11 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_TwistGauss2D with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_TwistGauss2D(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_TwistGauss2D() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_TwistGauss2D with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_TwistGauss2D(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_TwistGauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_TwistGauss2D with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_TwistGauss2D(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_TwistGauss2D() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    psFree(deriv);
-    psFree(params);
-
-    deriv = psVectorAlloc(8, PS_TYPE_F32);
-    params = psVectorAlloc(8, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 8 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Sersic with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_Sersic(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Sersic() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Sersic with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Sersic(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Sersic() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_Sersic with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_Sersic(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_Sersic() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    psFree(deriv);
-    psFree(params);
-
-    deriv = psVectorAlloc(12, PS_TYPE_F32);
-    params = psVectorAlloc(12, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < 12 ; i++) {
-        deriv->data.F32[i] = 1.0;
-        params->data.F32[i] = 1.0;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_SersicCore with NULL deriv vector.  Should not generate error.\n");
-    rc = pmMinLM_SersicCore(NULL, params, x);
-    if (isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_SersicCore() returned a NAN psF32.\n");
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_SersicCore with NULL params vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_SersicCore(deriv, NULL, x);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_SersicCore() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmMinLM_SersicCore with NULL x vector.  Should generate error and return NAN.\n");
-    rc = pmMinLM_SersicCore(deriv, params, NULL);
-    if (!isnan(rc)) {
-        printf("TEST ERROR: pmMinLM_SersicCore() returned a non-NAN psF32 (%f).\n", rc);
-        testStatus = false;
-    }
-
-    psFree(deriv);
-    psFree(params);
-    psFree(x);
-    return(testStatus);
-}
-
-/******************************************************************************
-test08(): We first test pmSourceModelGuess() with various NULL and unallowable
-input parameters.
- 
-XXX: We don't verify the numbers.
- *****************************************************************************/
-int test08( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST04_NUM_COLS, TST04_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST04_SKY;
-        }
-    }
-    pmSource *mySrc = NULL;
-    bool rc = false;
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
-                                  (psF32) (TST04_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);
-    mySrc = pmSourceLocalSky(imgData,
-                             tmpPeak,
-                             PS_STAT_SAMPLE_MEAN,
-                             (psF32) TST04_INNER_RADIUS,
-                             (psF32) TST04_OUTER_RADIUS);
-
-    if (mySrc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with NULL pmSource.  Should generate error, return FALSE.\n");
-    rc = pmSourceModelGuess(NULL, imgData, PS_MODEL_GAUSS);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with NULL psImage.  Should generate error, return FALSE.\n");
-    rc = pmSourceModelGuess(mySrc, NULL, PS_MODEL_GAUSS);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with bad model type.  Should generate error, return FALSE.\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_UNDEFINED);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_GAUSS\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_GAUSS);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_PGAUSS\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_PGAUSS);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_TWIST_GAUSS\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_TWIST_GAUSS);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_WAUSS\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_WAUSS);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_SERSIC\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_SERSIC);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceModelGuess with PS_MODEL_SERSIC_CORE\n");
-    rc = pmSourceModelGuess(mySrc, imgData, PS_MODEL_SERSIC_CORE);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    psFree(mySrc);
-    //    psFree(tmpPeak);
-    psFree(imgData);
-    return(testStatus);
-}
-
-
-#define TST09_NUM_ROWS 70
-#define TST09_NUM_COLS 70
-#define TST09_SKY 5.0
-#define TST09_INNER_RADIUS 3
-#define TST09_OUTER_RADIUS 10
-#define LEVEL (TST09_SKY + 10.0)
-/******************************************************************************
-test09(): We first test pmSourceContour() with various NULL and unallowable
-input parameters.
- 
-XXX: We don't verify the numbers.
- *****************************************************************************/
-int test09( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST09_NUM_COLS, TST09_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST09_SKY;
-        }
-    }
-    pmSource *mySrc = NULL;
-    psArray *rc = NULL;
-
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST09_NUM_ROWS / 2),
-                                  (psF32) (TST09_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST09_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST09_NUM_COLS / 2);
-    mySrc = pmSourceLocalSky(imgData,
-                             tmpPeak,
-                             PS_STAT_SAMPLE_MEAN,
-                             (psF32) TST09_INNER_RADIUS,
-                             (psF32) TST09_OUTER_RADIUS);
-
-    if (mySrc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    bool rcBool = pmSourceModelGuess(mySrc, imgData, PS_MODEL_GAUSS);
-    if (rcBool != true) {
-        printf("TEST ERROR: pmSourceModelGuess() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceContour with NULL pmSource .  Should generate error, return NULL.\n");
-    rc = pmSourceContour(NULL, imgData, LEVEL, PS_CONTOUR_CRUDE);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceContour() returned non-NULL.\n");
-        testStatus = false;
-        psFree(rc);
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceContour with NULL psImage .  Should generate error, return NULL.\n");
-    rc = pmSourceContour(mySrc, NULL, LEVEL, PS_CONTOUR_CRUDE);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmSourceContour() returned non-NULL.\n");
-        testStatus = false;
-        psFree(rc);
-    }
-
-    //
-    // XXX: pmSourceContour() has a problem with contour tops/bottoms.
-    // Must correct this.
-    //
-    if (0) {
-        printf("----------------------------------------------------------------------------------\n");
-        printf("Calling pmSourceContour with acceptable data.\n");
-        printf("NOTE: must figure out the parameters for this test to be meaningful.\n");
-        mySrc->modelPSF->params->data.F32[0] = TST09_SKY;
-        mySrc->modelPSF->params->data.F32[1] = 15.0;
-        mySrc->modelPSF->params->data.F32[2] = (psF32) (TST09_NUM_ROWS / 2);
-        mySrc->modelPSF->params->data.F32[3] = (psF32) (TST09_NUM_COLS / 2);
-        mySrc->modelPSF->params->data.F32[4] = 2.0;
-        mySrc->modelPSF->params->data.F32[5] = 2.0;
-        mySrc->modelPSF->params->data.F32[6] = 2.0;
-        rc = pmSourceContour(mySrc, imgData, LEVEL, PS_CONTOUR_CRUDE);
-        if (rc == NULL) {
-            printf("TEST ERROR: pmSourceContour() returned NULL.\n");
-            testStatus = false;
-        } else {
-            psFree(rc);
-        }
-    }
-
-    psFree(mySrc);
-    psFree(imgData);
-    // XXX: This psFree() causes an error.  Why?
-    //psFree(tmpPeak);
-    return(testStatus);
-}
-
-#define TST15_NUM_ROWS 100
-#define TST15_NUM_COLS 100
-#define TST15_SKY 10.0
-#define TST15_INNER_RADIUS 3
-#define TST15_OUTER_RADIUS 5
-/******************************************************************************
-test15(): We first test pmSourceAddModel() with various NULL and unallowable
-input parameters.
- 
-XXX: We don't verify the numbers.
- *****************************************************************************/
-int test15( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST15_NUM_COLS, TST15_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST15_SKY;
-        }
-    }
-    pmSource *mySrc = NULL;
-    psBool rc = false;
-
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST15_NUM_ROWS / 2),
-                                  (psF32) (TST15_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST15_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST15_NUM_COLS / 2);
-    mySrc = pmSourceLocalSky(imgData,
-                             tmpPeak,
-                             PS_STAT_SAMPLE_MEAN,
-                             (psF32) TST15_INNER_RADIUS,
-                             (psF32) TST15_OUTER_RADIUS);
-
-    if (mySrc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
-    mySrc->modelPSF->params->data.F32[0] = 5.0;
-    mySrc->modelPSF->params->data.F32[1] = 70.0;
-    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST15_NUM_ROWS / 2);
-    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST15_NUM_COLS / 2);
-    mySrc->modelPSF->params->data.F32[4] = 1.0;
-    mySrc->modelPSF->params->data.F32[5] = 1.0;
-    mySrc->modelPSF->params->data.F32[6] = 2.0;
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceAddModel with NULL psImage.  Should generate error, return FALSE.\n");
-    rc = pmSourceAddModel(NULL, mySrc, true);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceAddModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceAddModel with NULL psSrc.  Should generate error, return FALSE.\n");
-    rc = pmSourceAddModel(imgData, NULL, true);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceAddModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceAddModel with acceptable data.\n");
-    rc = pmSourceAddModel(imgData, mySrc, true);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceAddModel() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    psFree(mySrc);
-    psFree(imgData);
-    return(testStatus);
-}
-
-#define TST16_NUM_ROWS 100
-#define TST16_NUM_COLS 100
-#define TST16_SKY 10.0
-#define TST16_INNER_RADIUS 3
-#define TST16_OUTER_RADIUS 5
-/******************************************************************************
-test16(): We first test pmSourceSubModel() with various NULL and unallowable
-input parameters.
- 
-XXX: We don't verify the numbers.
- *****************************************************************************/
-int test16( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST16_NUM_COLS, TST16_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST16_SKY;
-        }
-    }
-    pmSource *mySrc = NULL;
-    psBool rc = false;
-
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST16_NUM_ROWS / 2),
-                                  (psF32) (TST16_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST16_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST16_NUM_COLS / 2);
-    mySrc = pmSourceLocalSky(imgData,
-                             tmpPeak,
-                             PS_STAT_SAMPLE_MEAN,
-                             (psF32) TST16_INNER_RADIUS,
-                             (psF32) TST16_OUTER_RADIUS);
-
-    if (mySrc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
-    mySrc->modelPSF->params->data.F32[0] = 5.0;
-    mySrc->modelPSF->params->data.F32[1] = 70.0;
-    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST16_NUM_ROWS / 2);
-    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST16_NUM_COLS / 2);
-    mySrc->modelPSF->params->data.F32[4] = 1.0;
-    mySrc->modelPSF->params->data.F32[5] = 1.0;
-    mySrc->modelPSF->params->data.F32[6] = 2.0;
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSubModel with NULL psImage.  Should generate error, return FALSE.\n");
-    rc = pmSourceSubModel(NULL, mySrc, true);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSubModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSubModel with NULL psSrc.  Should generate error, return FALSE.\n");
-    rc = pmSourceSubModel(imgData, NULL, true);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceSubModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceSubModel with acceptable data.\n");
-    rc = pmSourceSubModel(imgData, mySrc, true);
-    if (rc != true) {
-        printf("TEST ERROR: pmSourceSubModel() returned FALSE.\n");
-        testStatus = false;
-    }
-
-    psFree(mySrc);
-    psFree(imgData);
-    return(testStatus);
-}
-
-#define TST20_NUM_ROWS 100
-#define TST20_NUM_COLS 100
-#define TST20_SKY 10.0
-#define TST20_INNER_RADIUS 3
-#define TST20_OUTER_RADIUS 5
-/******************************************************************************
-test20(): We first test pmSourceSubModel() with various NULL and unallowable
-input parameters.
- 
-XXX: We don't verify the numbers.
- *****************************************************************************/
-int test20( void )
-{
-    bool testStatus = true;
-    psImage *imgData = psImageAlloc(TST20_NUM_COLS, TST20_NUM_ROWS, PS_TYPE_F32);
-    for (psS32 i = 0 ; i < imgData->numRows; i++) {
-        for (psS32 j = 0 ; j < imgData->numCols; j++) {
-            imgData->data.F32[i][j] = TST20_SKY;
-        }
-    }
-    pmSource *mySrc = NULL;
-    psBool rc = false;
-
-    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST20_NUM_ROWS / 2),
-                                  (psF32) (TST20_NUM_COLS / 2),
-                                  200.0,
-                                  PM_PEAK_LONE);
-
-    printf("Calling pmSourceLocalSky with valid data.\n");
-    tmpPeak->x = (psF32) (TST20_NUM_ROWS / 2);
-    tmpPeak->y = (psF32) (TST20_NUM_COLS / 2);
-    mySrc = pmSourceLocalSky(imgData,
-                             tmpPeak,
-                             PS_STAT_SAMPLE_MEAN,
-                             (psF32) TST20_INNER_RADIUS,
-                             (psF32) TST20_OUTER_RADIUS);
-
-    if (mySrc == NULL) {
-        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
-        testStatus = false;
-    }
-
-    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
-
-
-    mySrc->modelPSF->params->data.F32[0] = 5.0;
-    mySrc->modelPSF->params->data.F32[1] = 70.0;
-    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST20_NUM_ROWS / 2);
-    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST20_NUM_COLS / 2);
-    mySrc->modelPSF->params->data.F32[4] = 1.0;
-    mySrc->modelPSF->params->data.F32[5] = 1.0;
-    mySrc->modelPSF->params->data.F32[6] = 2.0;
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceFitModel with NULL psImage.  Should generate error, return FALSE.\n");
-    rc = pmSourceFitModel(mySrc, NULL);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceFitModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceFitModel with NULL pmSource.  Should generate error, return FALSE.\n");
-    rc = pmSourceFitModel(NULL, imgData);
-    if (rc == true) {
-        printf("TEST ERROR: pmSourceFitModel() returned TRUE.\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmSourceFitModel with acceptable data.\n");
-    rc = pmSourceFitModel(mySrc, imgData);
-    printf("pmSourceFitModel returned %d\n", rc);
-
-    // XXX: Memory leaks are not being tested
-    psVector *junk = psVectorAlloc(10, PS_TYPE_F32);
-    junk->data.F32[0] = 0.0;
-
-    psFree(mySrc);
-    psFree(imgData);
-    return(testStatus);
-}
-
-
-// this code will
-
-
-
Index: unk/psModules/test/tst_pmReadoutCombine.c
===================================================================
--- /trunk/psModules/test/tst_pmReadoutCombine.c	(revision 5170)
+++ 	(revision )
@@ -1,452 +1,0 @@
-/** @file tst_pmReadoutCombine.c
- *
- *  test00() This routine will test the basic functionality.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-17 22:49:18 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- *  XXX: Untested:
- * S16, S32 types
- * Multiple input readouts with varying sizes and offsets.
- * params->fracLow and params->fracHigh
- * params->nKeep
- * (gain > 0.0) && (readnoise >= 0.0) (applyZeroScale == true)
- * (gain > 0.0) && (readnoise >= 0.0) (applyZeroScale == false)
- *
- */
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmReadoutCombine.h"
-static int test00(void);
-static int test01(void);
-testDescription tests[] = {
-                              {test00, 000, "pmSubtractBias(): Basic readout combines with no image overlap", true, false},
-                              {test01, 000, "pmSubtractBias(): input parameter error conditions", true, false},
-                              {NULL}
-                          };
-
-#define NUM_READOUTS  10
-#define INPUT_NUM_ROWS 20
-#define INPUT_NUM_COLS 20
-#define VEC_ZERO 1.0
-#define VEC_SCALE 2.0
-
-psS32 VerifyTheOutput(psImage *output, psF32 expect)
-{
-    bool testStatus = true;
-
-    for (psS32 i = 0 ; i < output->numRows ; i++) {
-        for (psS32 j = 0 ; j < output->numCols ; j++) {
-            if (output->data.F32[i][j] != expect) {
-                printf("TEST ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect);
-                testStatus = false;
-            }
-        }
-    }
-    return(testStatus);
-}
-
-
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-/******************************************************************************
-simpleCombineNoOverlap(): this routine creates a list of NUM_READOUTS input
-readouts and calls pmReadoutCombine().
- *****************************************************************************/
-int simpleCombineNoOverlap(psS32 numInputCols, psS32 numInputRows)
-{
-    int i;
-    int r;
-    psList *list = NULL;
-    int baseRowsReadout[NUM_READOUTS];
-    int baseColsReadout[NUM_READOUTS];
-    int baseRows[NUM_READOUTS];
-    int baseCols[NUM_READOUTS];
-    int numRows[NUM_READOUTS];
-    int numCols[NUM_READOUTS];
-    int minOutRow = 10000;
-    int minOutCol = 10000;
-    int maxOutRow = -1;
-    int maxOutCol = -1;
-    psImage *output = NULL;
-    psCombineParams *params = (psCombineParams *) psAlloc(sizeof(psCombineParams));
-    psVector *zero = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
-    psVector *scale = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
-    printPositiveTestHeader(stdout, "pmReadoutCombine", "simpleCombineNoOverlap");
-
-    for (i=0;i<NUM_READOUTS;i++) {
-        zero->data.F32[i] = VEC_ZERO;
-    }
-    for (i=0;i<NUM_READOUTS;i++) {
-        scale->data.F32[i] = VEC_SCALE;
-    }
-
-    params->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    params->maskVal = 1;
-    params->fracLow = 0.0;
-    params->fracHigh = 10000.0;
-    params->nKeep = 0;
-
-    //
-    // Create a psList of psReadouts.  The pixels in readout r will all have the
-    // value r.
-    //
-    for (r=0;r<NUM_READOUTS;r++) {
-        baseRowsReadout[r] = r + 40;
-        baseColsReadout[r] = r + 42;
-        baseRows[r] = r;
-        baseCols[r] = r+2;
-        numRows[r] = 4 + (2 * r);
-        numCols[r] = 8 + (2 * r);
-
-        baseRowsReadout[r] = 0;
-        baseColsReadout[r] = 0;
-        baseRows[r] = 0;
-        baseCols[r] = 0;
-        numRows[r] = numInputRows;
-        numCols[r] = numInputCols;
-
-        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
-        PS_IMAGE_SET_F32(tmpImage, ((float) r));
-        *(int *) (& (tmpImage->row0)) = baseRows[r];
-        *(int *) (& (tmpImage->col0)) = baseCols[r];
-        pmReadout *tmpReadout = pmReadoutAlloc(NULL);
-        tmpReadout->row0 = 0;
-        tmpReadout->col0 = 0;
-        tmpReadout->image = tmpImage;
-
-        minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r]));
-        minOutCol = PS_MIN(minOutCol, (baseColsReadout[r] + baseCols[r]));
-        maxOutRow = PS_MAX(maxOutRow, (baseRowsReadout[r] + baseRows[r] + numRows[r]));
-        maxOutCol = PS_MAX(maxOutCol, (baseColsReadout[r] + baseCols[r] + numCols[r]));
-
-        if (r == 0) {
-            list = psListAlloc(tmpReadout);
-        } else {
-            psListAdd(list, PS_LIST_HEAD, tmpReadout);
-        }
-    }
-    printf("tst_pmReadoutCombine(): (minOutRow, minOutCol) to (maxOutRow, maxOutCol) is (%d, %d) (%d, %d)\n",
-           minOutRow, minOutCol, maxOutRow, maxOutCol);
-
-    output = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
-    psF32 NR = (psF32) NUM_READOUTS;
-    psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
-
-    int testStatus = VerifyTheOutput(output, expectedPixel);
-
-    psFree(params->stats);
-    psFree(params);
-    psFree(output);
-    psFree(zero);
-    psFree(scale);
-
-    psListElem *tmpInput = (psListElem *) list->head;
-    while (NULL != tmpInput) {
-        pmReadout *tmpReadout = (pmReadout *) tmpInput->data;
-        psFree(tmpReadout);
-        tmpInput = tmpInput->next;
-    }
-    psFree(list);
-
-    printFooter(stdout, "pmReadoutCombine", "simpleCombineNoOverlap", true);
-    return(testStatus);
-}
-
-int test00( void )
-{
-    int testStatus = 0;
-
-    testStatus |= simpleCombineNoOverlap(1, 1);
-    testStatus |= simpleCombineNoOverlap(INPUT_NUM_COLS, 1);
-    testStatus |= simpleCombineNoOverlap(1, INPUT_NUM_ROWS);
-    testStatus |= simpleCombineNoOverlap(INPUT_NUM_COLS, INPUT_NUM_ROWS);
-
-    return(testStatus);
-}
-
-/******************************************************************************
-test01(): we simply call pmReadoutCombine() with a variety of erroneous input
-parameter combinations and verify that it behaves properly.
- *****************************************************************************/
-int test01()
-{
-    int testStatus = true;
-    int i;
-    int r;
-    psList *list = NULL;
-    int baseRowsReadout[NUM_READOUTS];
-    int baseColsReadout[NUM_READOUTS];
-    int baseRows[NUM_READOUTS];
-    int baseCols[NUM_READOUTS];
-    int numRows[NUM_READOUTS];
-    int numCols[NUM_READOUTS];
-    int minOutRow = 10000;
-    int minOutCol = 10000;
-    int maxOutRow = -1;
-    int maxOutCol = -1;
-    psImage *output = NULL;
-    psImage *rc = NULL;
-    psCombineParams *params = (psCombineParams *) psAlloc(sizeof(psCombineParams));
-    psVector *zero = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
-    psVector *zeroHalf = psVectorAlloc(NUM_READOUTS/2, PS_TYPE_F32);
-    psVector *zeroBig = psVectorAlloc(NUM_READOUTS+1, PS_TYPE_F32);
-    psVector *zeroF64 = psVectorAlloc(NUM_READOUTS, PS_TYPE_F64);
-    psVector *scale = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
-    psVector *scaleHalf = psVectorAlloc(NUM_READOUTS/2, PS_TYPE_F32);
-    psVector *scaleBig = psVectorAlloc(NUM_READOUTS*2, PS_TYPE_F32);
-    psVector *scaleF64 = psVectorAlloc(NUM_READOUTS, PS_TYPE_F64);
-    for (i=0;i<NUM_READOUTS;i++) {
-        zero->data.F32[i] = 3.0;
-        zeroBig->data.F32[i] = 3.0;
-        zero->data.F32[i] = VEC_ZERO;
-        zeroBig->data.F32[i] = VEC_ZERO;
-    }
-    for (i=0;i<NUM_READOUTS;i++) {
-        scale->data.F32[i] = 6.0;
-        scaleBig->data.F32[i] = 6.0;
-        scale->data.F32[i] = VEC_SCALE;
-        scaleBig->data.F32[i] = VEC_SCALE;
-    }
-    printPositiveTestHeader(stdout, "pmReadoutCombine", "Testing bad input parameter conditions");
-
-    params->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    params->maskVal = 1;
-    params->fracLow = 0.0;
-    params->fracHigh = 10000.0;
-    params->nKeep = 0;
-
-    for (r=0;r<NUM_READOUTS;r++) {
-        baseRowsReadout[r] = 0;
-        baseColsReadout[r] = 0;
-        baseRows[r] = 0;
-        baseCols[r] = 0;
-        numRows[r] = INPUT_NUM_ROWS;
-        numCols[r] = INPUT_NUM_COLS;
-
-        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
-        PS_IMAGE_SET_F32(tmpImage, ((float) r));
-        *(int *) (& (tmpImage->row0)) = baseRows[r];
-        *(int *) (& (tmpImage->col0)) = baseCols[r];
-        pmReadout *tmpReadout = pmReadoutAlloc(NULL);
-        tmpReadout->row0 = 0;
-        tmpReadout->col0 = 0;
-        tmpReadout->image = tmpImage;
-        minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r]));
-        minOutCol = PS_MIN(minOutCol, (baseColsReadout[r] + baseCols[r]));
-        maxOutRow = PS_MAX(maxOutRow, (baseRowsReadout[r] + baseRows[r] + numRows[r]));
-        maxOutCol = PS_MAX(maxOutCol, (baseColsReadout[r] + baseCols[r] + numCols[r]));
-
-        if (r == 0) {
-            list = psListAlloc(tmpReadout);
-        } else {
-            psListAdd(list, PS_LIST_HEAD, tmpReadout);
-        }
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with NULL zero vector.\n");
-    rc = pmReadoutCombine(NULL, list, params, NULL, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        psF32 NR = (psF32) NUM_READOUTS;
-        psF32 expectedPixel = ((NR/2.0) * (0.0 + (0.0 + VEC_SCALE * (NR - 1)))) / NR;
-        if (false == VerifyTheOutput(rc, expectedPixel)) {
-            testStatus = false;
-        }
-
-        if (rc->type.type != scale->type.type) {
-            printf("TEST ERROR: output readout->image has incorrect type.\n");
-            testStatus = false;
-        }
-        psFree(rc);
-    } else {
-        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
-        testStatus = false;
-
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect length zero vector (too small).  Should generate error.\n");
-    rc = pmReadoutCombine(NULL, list, params, zeroHalf, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect type zero vector.  Should generate error.\n");
-    rc = pmReadoutCombine(NULL, list, params, zeroF64, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect length zero vector (too big).  Should generate warning.\n");
-    rc = pmReadoutCombine(output, list, params, zeroBig, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        psF32 NR = (psF32) NUM_READOUTS;
-        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
-
-        if (false == VerifyTheOutput(rc, expectedPixel)) {
-            testStatus = false;
-        }
-        psFree(rc);
-        rc = NULL;
-    } else {
-        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with NULL scale vector.\n");
-    rc = pmReadoutCombine(output, list, params, zero, NULL, true, 0.0, 0.0);
-
-    if (rc != NULL) {
-        psF32 NR = (psF32) NUM_READOUTS;
-        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + 1.0 * (NR - 1)))) / NR;
-        if (false == VerifyTheOutput(rc, expectedPixel)) {
-            testStatus = false;
-        }
-
-        if (rc->type.type != scale->type.type) {
-            printf("TEST ERROR: output readout->image has incorrect type.\n");
-            testStatus = false;
-        }
-        psFree(rc);
-    } else {
-        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
-        testStatus = false;
-
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect length scale vector (too small).  Should generate error.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleHalf, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect type scale vector.  Should generate error.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleF64, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with incorrect length scale vector (too big).  Should generate warning.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleBig, true, 0.0, 0.0);
-    if (rc != NULL) {
-        psF32 NR = (psF32) NUM_READOUTS;
-        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
-
-        if (false == VerifyTheOutput(rc, expectedPixel)) {
-            testStatus = false;
-        }
-        psFree(rc);
-        rc = NULL;
-    } else {
-        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() insufficient size output image.  Should generate error, return NULL.\n");
-    output = psImageAlloc(1, 1, PS_TYPE_F32);
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-    psFree(output);
-    output = NULL;
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() row0/col0 too large.  Should generate error, return NULL.\n");
-    output = psImageAlloc(1, 1, PS_TYPE_F32);
-    *(psS32*)&output->row0 = 10000;
-    *(psS32*)&output->col0 = 10000;
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-    psFree(output);
-    output = NULL;
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with NULL input list.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, NULL, params, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("Calling pmReadoutCombine() with NULL params.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, list, NULL, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-
-    printf("----------------------------------------------------------------------------\n");
-    psStatsOptions oldStatsOpts = params->stats->options |= PS_STAT_MIN;
-    printf("Calling pmReadoutCombine() with multiple stats->options.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-    params->stats->options = oldStatsOpts;
-
-    printf("----------------------------------------------------------------------------\n");
-    psStats *oldStats = params->stats;
-    printf("Calling pmReadoutCombine() with NULL param->stats.  Should generate error, return NULL.\n");
-    params->stats = NULL;
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
-    if (rc != NULL) {
-        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
-        testStatus = false;
-    }
-    params->stats = oldStats;
-
-    printf("----------------------------------------------------------------------------\n");
-    printf("============================================================================\n");
-
-    psFree(params->stats);
-    psFree(params);
-    //    psFree(output);
-    //    psFree(rc);
-    psFree(zero);
-    psFree(zeroHalf);
-    psFree(zeroBig);
-    psFree(zeroF64);
-    psFree(scale);
-    psFree(scaleHalf);
-    psFree(scaleBig);
-    psFree(scaleF64);
-    psListElem *tmpInput = (psListElem *) list->head;
-    while (NULL != tmpInput) {
-        pmReadout *tmpReadout = (pmReadout *) tmpInput->data;
-        psFree(tmpReadout);
-        tmpInput = tmpInput->next;
-    }
-    psFree(list);
-
-    printFooter(stdout, "pmReadoutCombine", "Testing bad input parameter conditions", true);
-    return(testStatus);
-}
Index: unk/psModules/test/tst_pmSubtractBias.c
===================================================================
--- /trunk/psModules/test/tst_pmSubtractBias.c	(revision 5170)
+++ 	(revision )
@@ -1,1095 +1,0 @@
-/** @file tst_pmSubtractBias.c
- *
- *  @brief Contains the tests for pmSubtractBias.c:
- *
- * test00: This code will subtract full bias frames from the input image.
- * test01: Multiple overscan regions, calculate a scalar statistic for
- *  each, then subtract from the input image.
- * test02: Calculate a column overscan vector and subtract it from each
- *  column in the input image.
- * test03: Calculate a row overscan vector and subtract it from each
- *  row in the input image.
- * test04: 
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-23 18:36:25 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-#include "psTest.h"
-#include "pslib.h"
-#include "pmSubtractBias.h"
-static int test00(void);
-static int test01(void);
-static int test02(void);
-static int test03(void);
-static int test04(void);
-static int testX(void);
-testDescription tests[] = {
-                              {test00, 000, "pmSubtractBias", 0, true},
-                              {test01, 000, "pmSubtractBias", 0, true},
-                              {test02, 000, "pmSubtractBias", 0, true},
-                              {test03, 000, "pmSubtractBias", 0, false},
-                              {test04, 000, "pmSubtractBias", 0, true},
-                              {testX,  000, "pmSubtractBias", 0, true},
-                              {NULL}
-                          };
-
-
-int main(int argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
-}
-
-#define NUM_ROWS 8
-#define NUM_COLS 8
-/******************************************************************************
-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(numCols, numRows, tmpImage1);
-    //    pmReadout *myBias = pmReadoutAlloc(numCols, numRows, tmpImage2);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    pmReadout *myBias = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    myBias->image = tmpImage2;
-
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "doSubtractBiasFullFrame");
-    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, NULL, PM_OVERSCAN_NONE, NULL,
-                               0, PM_FIT_NONE, myBias);
-
-    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", "doSubtractBiasFullFrame", true);
-    return(testStatus);
-}
-
-
-int test00( 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);
-}
-
-/******************************************************************************
-doSubtractFullOverscans(): a sample pmReadout as well as several overscan
-images of the same size are created.  The overscan images are then subtracted
-from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscans(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);
-    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImage1);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "doSubtractFullOverscans");
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    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;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    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++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-
-    printFooter(stdout, "pmSubtractBias", "doSubtractFullOverscans", true);
-    return(testStatus);
-}
-
-int test01( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doSubtractFullOverscans(1, 1);
-    testStatus |= doSubtractFullOverscans(1, NUM_ROWS);
-    testStatus |= doSubtractFullOverscans(NUM_COLS, 1);
-    testStatus |= doSubtractFullOverscans(NUM_COLS, NUM_ROWS);
-
-    return(testStatus);
-}
-
-/******************************************************************************
-doSubtractFullOverscans(): a sample pmReadout as well as several overscan
-images of the same size are created.  The overscan images are collected
-pixel-by-pixel then subtracted column-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanColumns(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);
-    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    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;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Column Overscans");
-
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_COLUMNS, stat,
-                               0, PM_FIT_NONE, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-
-    printFooter(stdout, "pmSubtractBias", "Column Overscans", true);
-    return(testStatus);
-}
-/******************************************************************************
-doSubtractFullOverscans(): a sample pmReadout as well as several overscan
-images of the same size are created.  The overscan images are collected
-pixel-by-pixel then subtracted column-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanColumnsPoly(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);
-    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(1, PS_POLYNOMIAL_ORD);
-
-    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;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Column Overscans");
-
-    myReadout = pmSubtractBias(myReadout, myPoly, list, PM_OVERSCAN_COLUMNS, stat,
-                               0, PM_FIT_POLYNOMIAL, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-    psFree(myPoly);
-
-    printFooter(stdout, "pmSubtractBias", "Column Overscans", true);
-    return(testStatus);
-}
-/******************************************************************************
-doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
-images of smaller size are created.  The overscan images are collected
-pixel-by-pixel then subtracted column-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanColumnsSmall(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    psImage *tmpImage2 = psImageAlloc(numCols/2, numRows/2, PS_TYPE_F32);
-    psImage *tmpImage3 = psImageAlloc(numCols/2, numRows/2, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols/2, numRows/2, PS_TYPE_F32);
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-    for (i=0;i<numRows/2;i++) {
-        for (j=0;j<numCols/2;j++) {
-            tmpImage2->data.F32[i][j] = 3.0;
-            tmpImage3->data.F32[i][j] = 4.0;
-            tmpImage4->data.F32[i][j] = 5.0;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Column Overscans");
-
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_COLUMNS, stat,
-                               0, PM_FIT_POLYNOMIAL, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-
-    printFooter(stdout, "pmSubtractBias", "Column Overscans", true);
-    return(testStatus);
-}
-
-int test02( void )
-{
-    int testStatus = 0;
-
-    testStatus |= doSubtractFullOverscanColumns(1, 1);
-    testStatus |= doSubtractFullOverscanColumns(1, NUM_ROWS);
-    testStatus |= doSubtractFullOverscanColumns(NUM_COLS, 1);
-    testStatus |= doSubtractFullOverscanColumns(NUM_COLS, NUM_ROWS);
-    /* These tests do not make sense until the SDRS is clarified.
-        testStatus |= doSubtractFullOverscanColumnsSmall(1, 1);
-        testStatus |= doSubtractFullOverscanColumnsSmall(1, NUM_ROWS);
-        testStatus |= doSubtractFullOverscanColumnsSmall(NUM_COLS, 1);
-        testStatus |= doSubtractFullOverscanColumnsSmall(NUM_COLS, NUM_ROWS);
-    */
-
-    return(testStatus);
-}
-
-/******************************************************************************
-doSubtractFullOverscans(): a sample pmReadout as well as several overscan
-images of the same size are created.  The overscan images are collected
-pixel-by-pixel then subtracted row-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanRows(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);
-    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    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;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Row Overscans");
-
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_ROWS, stat,
-                               0, PM_FIT_NONE, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-
-    printFooter(stdout, "pmSubtractBias", "Row Overscans", true);
-    return(testStatus);
-}
-
-/******************************************************************************
-doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
-images of smaller size are created.  The overscan images are collected
-pixel-by-pixel then subtracted row-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanRowsSmall(int numCols, int numRows)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-    psS32 OSnumRows = numRows-1;
-    if (OSnumRows == 0) {
-        OSnumRows = 1;
-    }
-    psS32 OSnumCols = numCols-1;
-    if (OSnumCols == 0) {
-        OSnumCols = 1;
-    }
-    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psImage *tmpImage2 = psImageAlloc(OSnumCols, OSnumRows, PS_TYPE_F32);
-    psImage *tmpImage3 = psImageAlloc(OSnumCols, OSnumRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(OSnumCols, OSnumRows, PS_TYPE_F32);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    psList *list;
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-    for (i=0;i<OSnumRows;i++) {
-        for (j=0;j<OSnumCols;j++) {
-            tmpImage2->data.F32[i][j] = 3.0;
-            tmpImage3->data.F32[i][j] = 4.0;
-            tmpImage4->data.F32[i][j] = 5.0;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Row Overscans");
-
-    myReadout = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_ROWS, stat,
-                               0, PM_FIT_SPLINE, NULL);
-
-    for (i=0;i<numRows;i++) {
-        for (j=0;j<numCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-
-    printFooter(stdout, "pmSubtractBias", "Row Overscans", true);
-    return(testStatus);
-}
-
-
-// XXX: HEY
-int test03( void )
-{
-    int testStatus = 0;
-
-    //    testStatus |= doSubtractFullOverscanRows(1, 1);
-    //    testStatus |= doSubtractFullOverscanRows(1, NUM_ROWS);
-    //    testStatus |= doSubtractFullOverscanRows(NUM_COLS, 1);
-    //    testStatus |= doSubtractFullOverscanRows(NUM_COLS, NUM_ROWS);
-    //    testStatus |= doSubtractFullOverscanRowsSmall(1, 1);
-    //    testStatus |= doSubtractFullOverscanRowsSmall(1, NUM_ROWS);
-    //    testStatus |= doSubtractFullOverscanRowsSmall(NUM_COLS, 1);
-    testStatus |= doSubtractFullOverscanRowsSmall(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.
-        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);
-    /*
-        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);
-    /*
-        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);
-    }
-
-    /*
-        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);
-}
-
-/******************************************************************************
-doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
-images of smaller size are created.  The overscan images are collected
-pixel-by-pixel then subtracted column-wise from the pmReadout.
- *****************************************************************************/
-int doSubtractFullOverscanColumnsGeneric(int imageNumCols,
-        int imageNumRows,
-        int overscanNumCols,
-        int overscanNumRows,
-        pmOverscanAxis overscanaxis,
-        pmFit fit,
-        psS32 nBin)
-{
-    int i;
-    int j;
-    float actual;
-    float expect;
-    int testStatus = 0;
-
-    psImage *tmpImage1 = psImageAlloc(imageNumCols, imageNumRows, PS_TYPE_F32);
-    //    pmReadout *myReadout = pmReadoutAlloc(imageNumCols, imageNumRows, tmpImage1);
-    pmReadout *myReadout = pmReadoutAlloc(NULL);
-    myReadout->image = tmpImage1;
-    for (i=0;i<imageNumRows;i++) {
-        for (j=0;j<imageNumCols;j++) {
-            myReadout->image->data.F32[i][j] = (float) (i + j);
-        }
-    }
-
-    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(1, PS_POLYNOMIAL_ORD);
-    psSpline1D *mySpline = NULL;
-
-
-    /*
-        if (overscanNumRows <= 0) {
-            overscanNumRows = 1;
-        }
-        if (overscanNumCols <= 0) {
-            overscanNumCols = 1;
-        }
-    */
-    psImage *tmpImage2 = psImageAlloc(overscanNumCols, overscanNumRows, PS_TYPE_F32);
-    psImage *tmpImage3 = psImageAlloc(overscanNumCols, overscanNumRows, PS_TYPE_F32);
-    psImage *tmpImage4 = psImageAlloc(overscanNumCols, overscanNumRows, PS_TYPE_F32);
-    psList *list;
-    for (i=0;i<overscanNumRows;i++) {
-        for (j=0;j<overscanNumCols;j++) {
-            tmpImage2->data.F32[i][j] = 3.0;
-            tmpImage3->data.F32[i][j] = 4.0;
-            tmpImage4->data.F32[i][j] = 5.0;
-        }
-    }
-    list = psListAlloc(tmpImage2);
-    psListAdd(list, PS_LIST_HEAD, tmpImage3);
-    psListAdd(list, PS_LIST_HEAD, tmpImage4);
-
-    printPositiveTestHeader(stdout, "pmSubtractBias", "Column Overscans");
-
-    if (fit == PM_FIT_NONE) {
-        myReadout = pmSubtractBias(myReadout, NULL, list, overscanaxis, stat,
-                                   nBin, fit, NULL);
-    } else if (fit == PM_FIT_POLYNOMIAL) {
-        myReadout = pmSubtractBias(myReadout, myPoly, list, overscanaxis, stat,
-                                   nBin, fit, NULL);
-    } else if (fit == PM_FIT_SPLINE) {
-        myReadout = pmSubtractBias(myReadout, mySpline, list, overscanaxis, stat,
-                                   nBin, fit, NULL);
-    }
-
-    for (i=0;i<imageNumRows;i++) {
-        for (j=0;j<imageNumCols;j++) {
-            expect = ((float) (i + j)) - 12.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(tmpImage2);
-    psFree(tmpImage3);
-    psFree(tmpImage4);
-    psFree(stat);
-    psFree(list);
-    psFree(myPoly);
-    psFree(mySpline);
-
-    printFooter(stdout, "pmSubtractBias", "Column Overscans", true);
-    return(testStatus);
-}
-
-int testX( void )
-{
-    int testStatus = 0;
-
-    // imageNumCols, imageNumRows, overscanNumCols, overscanNumRows,
-    // overscanaxis, fit, nBin
-
-    //
-    // Overscan images are same size, no fit, bin factor is 1.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_NONE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_NONE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_NONE, 1);
-
-    //
-    // Overscan images are same size, no fit, bin factor is 2.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_NONE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_NONE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_NONE, 2);
-    //
-    // Overscan images are too small, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-
-    //
-    // Overscan images are too small, spline fit, bin factor is 2.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS-1, NUM_ROWS-1,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 2);
-
-    //
-    // Overscan images are same size, spline fit, bin factor is 1.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 1);
-    //
-    // Overscan images are same size, spline fit, bin factor is 2.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_SPLINE, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_SPLINE, 2);
-
-    //
-    // Overscan images are same size, polynomial fit, bin factor is 1.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 1);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 1);
-    //
-    // Overscan images are same size, polynomial fit, bin factor is 2.
-    //
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ALL,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_COLUMNS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    testStatus |= doSubtractFullOverscanColumnsGeneric(NUM_COLS, NUM_ROWS,
-                  NUM_COLS, NUM_ROWS,
-                  PM_OVERSCAN_ROWS,
-                  PM_FIT_POLYNOMIAL, 2);
-
-    return(testStatus);
-}
-
Index: unk/psModules/test/tst_pmSubtractSky.c
===================================================================
--- /trunk/psModules/test/tst_pmSubtractSky.c	(revision 5170)
+++ 	(revision )
@@ -1,366 +1,0 @@
-/** @file tst_pmSubtractSky.c
- *
- *  @brief Contains the tests for pmSubtractSky.c:
- *
- * test00: This code will ...
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-16 01:10:36 $
- *
- *  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(POLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);
-
-    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);
-    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(POLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);
-    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);
-    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(POLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);
-
-    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);
-}
