IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2915


Ignore:
Timestamp:
Jan 5, 2005, 1:25:25 PM (22 years ago)
Author:
gusciora
Message:

Added tests to for various input parameters being NULL, or of incorrect
length.

Location:
trunk/psModules
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmNonLinear.c

    r2857 r2915  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-30 22:22:00 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-01-05 23:25:24 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     11 *
     12 *  XXX: The SDR is silent about image types.  Only F32 was implemented.
    1113 *
    1214 */
     
    2830 *****************************************************************************/
    2931
    30 psReadout *pmNonLinearityPolynomial(psReadout *in,
    31                                     const psPolynomial1D *coeff)
     32psReadout *pmNonLinearityPolynomial(psReadout *inputReadout,
     33                                    const psPolynomial1D *input1DPoly)
    3234{
    33     PS_PTR_CHECK_NULL(in,NULL);
    34     PS_PTR_CHECK_NULL(in->image, NULL);
    35     PS_PTR_CHECK_NULL(coeff,NULL);
     35    PS_PTR_CHECK_NULL(inputReadout, NULL);
     36    PS_PTR_CHECK_NULL(inputReadout->image, NULL);
     37    PS_PTR_CHECK_NULL(input1DPoly, NULL);
    3638
    3739    psS32 i;
    3840    psS32 j;
    3941
    40     for (i=0;i<(in->image)->numRows;i++) {
    41         for (j=0;j<(in->image)->numCols;j++) {
    42             (in->image)->data.F32[i][j] = psPolynomial1DEval(coeff, (in->image)->data.F32[i][j]);
     42    for (i=0;i<(inputReadout->image)->numRows;i++) {
     43        for (j=0;j<(inputReadout->image)->numCols;j++) {
     44            (inputReadout->image)->data.F32[i][j] = psPolynomial1DEval(input1DPoly, (inputReadout->image)->data.F32[i][j]);
    4345        }
    4446    }
    45     return(in);
     47    return(inputReadout);
    4648}
    4749
     
    5456be set to the value from outFlux.
    5557 *****************************************************************************/
    56 psReadout *pmNonLinearityLookup(psReadout *in,
     58psReadout *pmNonLinearityLookup(psReadout *inputReadout,
    5759                                const psVector *inFlux,
    5860                                const psVector *outFlux)
    5961{
    60     PS_PTR_CHECK_NULL(in,NULL);
    61     PS_PTR_CHECK_NULL(in->image,NULL);
     62    PS_PTR_CHECK_NULL(inputReadout,NULL);
     63    PS_PTR_CHECK_NULL(inputReadout->image,NULL);
    6264    PS_PTR_CHECK_NULL(inFlux,NULL);
     65    psS32 tableSize = inFlux->n;
     66    if (inFlux->n < 2) {
     67        psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements.  Returning inputReadout image.");
     68        return(inputReadout);
     69    }
    6370    PS_PTR_CHECK_NULL(outFlux,NULL);
     71    if (inFlux->n != outFlux->n) {
     72        tableSize = PS_MIN(inFlux->n, outFlux->n);
     73        psLogMsg(__func__, PS_LOG_WARN,
     74                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n);
     75    }
    6476
    6577    psS32 i;
    6678    psS32 j;
    67     psS32 tableSize = inFlux->n;
    6879    psS32 binNum;
    6980    psScalar x;
     
    7283
    7384    x.type.type = PS_TYPE_F32;
    74     if (inFlux->n != outFlux->n) {
    75         tableSize = PS_MIN(inFlux->n, outFlux->n);
    76         psLogMsg(__func__, PS_LOG_WARN,
    77                  "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n);
    78     }
    79     if (inFlux->n < 2) {
    80         psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements.  Returning in image.");
    81         return(in);
    82     }
    83     for (i=0;i<(in->image)->numRows;i++) {
    84         for (j=0;j<(in->image)->numCols;j++) {
    85             x.data.F32 = (in->image)->data.F32[i][j];
     85    for (i=0;i<(inputReadout->image)->numRows;i++) {
     86        for (j=0;j<(inputReadout->image)->numCols;j++) {
     87            x.data.F32 = (inputReadout->image)->data.F32[i][j];
    8688
    8789            binNum = p_psVectorBinDisect((psVector *)inFlux, &x);
     
    8991            if (binNum == -2) {
    9092                // We get here if x is below the table lookup range.
    91                 (in->image)->data.F32[i][j] = outFlux->data.F32[0];
     93                (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[0];
    9294                numPixels++;
    9395
    9496            } else if (binNum == -1) {
    9597                // We get here if x is above the table lookup range.
    96                 (in->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1];
     98                (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1];
    9799
    98100                numPixels++;
    99101            } else if (binNum < -2) {
    100102                // We get here if there was some other problem.
    101                 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect().  Returning in image.");
    102                 return(in);
     103                psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect().  Returning inputReadout image.");
     104                return(inputReadout);
    103105                numPixels++;
    104106            } else {
     
    106108                slope = (outFlux->data.F32[binNum+1] - outFlux->data.F32[binNum]) /
    107109                        (inFlux->data.F32[binNum+1]  - inFlux->data.F32[binNum]);
    108                 (in->image)->data.F32[i][j] = outFlux->data.F32[binNum] +
    109                                               ((x.data.F32 - inFlux->data.F32[binNum]) * slope);
     110                (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[binNum] +
     111                                                        ((x.data.F32 - inFlux->data.F32[binNum]) * slope);
    110112            }
    111113        }
     
    115117                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): %d pixels outside table.", numPixels);
    116118    }
    117     return(in);
     119    return(inputReadout);
    118120}
  • trunk/psModules/src/pmReadoutCombine.c

    r2857 r2915  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-30 22:22:00 $
     7 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-01-05 23:25:24 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    144144        } else if (numInputs < scale->n) {
    145145            psLogMsg(__func__, PS_LOG_WARN,
    146                      "WARNING: the scale vector too many elements (%d)\n", scale->n);
     146                     "WARNING: the scale vector has too many elements (%d)\n", scale->n);
    147147        }
    148148    }
  • trunk/psModules/test/tst_pmNonLinear.c

    r2857 r2915  
    1111 * N), (N, 1), (N, N)]. 
    1212 *
     13 * test02, test03: This code tests the functions with various unallowable
     14 * input parameters (NULLS) and incorrect vector sizes.
     15 *
    1316 *  @author GLG, MHPCC
    1417 *
    15  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-12-30 22:22:00 $
     18 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2005-01-05 23:25:25 $
    1720 *
    1821 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2427static int test00(void);
    2528static int test01(void);
     29static int test02(void);
     30static int test03(void);
    2631testDescription tests[] = {
    27                               {test00, 000, "pmNonLinearityPolynomial", 0, false},
    28                               {test01, 000, "pmNonLinearityLookup", 0, false},
     32                              {test00, 000, "pmNonLinearityPolynomial", true, false},
     33                              {test01, 000, "pmNonLinearityLookup", true, false},
     34                              {test02, 000, "pmNonLinearityPolynomial(): error/warning conditions", true, false},
     35                              {test03, 000, "pmNonLinearityLookup(): error/warning conditions", true, false},
    2936                              {NULL}
    3037                          };
     
    4451    float actual;
    4552    float expect;
    46     int testStatus = 0;
     53    int testStatus = true;
    4754    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    48     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
    4955    psReadout *myReadout = psReadoutAlloc();
    5056    myReadout->image = myImage;
     
    6470            actual = myReadout->image->data.F32[i][j];
    6571            if (FLT_EPSILON < fabs(expect - actual)) {
    66                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    67                 testStatus = 1;
     72                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     73                testStatus = false;
    6874            }
    6975        }
     
    94100    float actual;
    95101    float expect;
    96     int testStatus = 0;
     102    int testStatus = true;
    97103    int tableSize = PS_MAX(numCols, numRows)*2;
    98104    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    99     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
    100105    psReadout *myReadout = psReadoutAlloc();
    101106    myReadout->image = myImage;
     
    120125            actual = myReadout->image->data.F32[i][j];
    121126            if (FLT_EPSILON < fabs(expect - actual)) {
    122                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    123                 testStatus = 1;
     127                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     128                testStatus = false;
    124129            }
    125130        }
     
    144149    return(testStatus);
    145150}
     151
     152int test02( void )
     153{
     154    int i;
     155    int j;
     156    int testStatus = true;
     157    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
     158    psReadout *myReadout = psReadoutAlloc();
     159    psReadout *rc = NULL;
     160    myReadout->image = myImage;
     161    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
     162    myPoly->coeff[1] = 1.0;
     163
     164    for (i=0;i<NUM_ROWS;i++) {
     165        for (j=0;j<NUM_COLS;j++) {
     166            myReadout->image->data.F32[i][j] = (float) (i + j);
     167        }
     168    }
     169
     170    printf("------------------------------------------------------------\n");
     171    printf("Calling pmNonLinearityPolynomial() with NULL input readout.  Should generate error, return NULL.\n");
     172    rc = pmNonLinearityPolynomial(NULL, myPoly);
     173    if (rc != NULL) {
     174        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     175        testStatus = false;
     176    }
     177
     178    printf("------------------------------------------------------------\n");
     179    printf("Calling pmNonLinearityPolynomial() with NULL input readout->image.  Should generate error, return NULL.\n");
     180    psImage *tmpImage = myReadout->image;
     181    myReadout->image = NULL;
     182    rc = pmNonLinearityPolynomial(myReadout, myPoly);
     183    if (rc != NULL) {
     184        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     185        testStatus = false;
     186    }
     187    myReadout->image = tmpImage;
     188
     189    printf("------------------------------------------------------------\n");
     190    printf("Calling pmNonLinearityPolynomial() with NULL polynomial.  Should generate error, return NULL.\n");
     191    rc = pmNonLinearityPolynomial(myReadout, NULL);
     192    if (rc != NULL) {
     193        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     194        testStatus = false;
     195    }
     196
     197    psFree(myReadout);
     198    psFree(myPoly);
     199    return(testStatus);
     200}
     201
     202
     203int test03Init(psReadout *myReadout)
     204{
     205    for (psS32 i=0;i<NUM_ROWS;i++) {
     206        for (psS32 j=0;j<NUM_COLS;j++) {
     207            myReadout->image->data.F32[i][j] = (float) (i + j);
     208        }
     209    }
     210    return(0);
     211}
     212
     213int test03()
     214{
     215    int i;
     216    int j;
     217    int testStatus = true;
     218    int tableSize = PS_MAX(NUM_COLS, NUM_ROWS)*3;
     219    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
     220    psReadout *myReadout = psReadoutAlloc();
     221    psReadout *rc = NULL;
     222    myReadout->image = myImage;
     223    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
     224    psVector *inOne = psVectorAlloc(1, PS_TYPE_F32);
     225    psVector *inSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
     226    psVector *inBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
     227    psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
     228    psVector *outOne = psVectorAlloc(1, PS_TYPE_F32);
     229    psVector *outSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
     230    psVector *outBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
     231
     232    test03Init(myReadout);
     233    for (i=0;i<tableSize;i++) {
     234        in->data.F32[i] = (float) i;
     235        out->data.F32[i] = (float) (2 * i);
     236        inBig->data.F32[i] = (float) i;
     237        outBig->data.F32[i] = (float) (2 * i);
     238        if (i < tableSize-1) {
     239            inSmall->data.F32[i] = (float) (2 * i);
     240            outSmall->data.F32[i] = (float) (2 * i);
     241        }
     242    }
     243    inBig->data.F32[tableSize] = (float) tableSize;
     244    outBig->data.F32[tableSize] = (float) (2 * tableSize);
     245    inOne->data.F32[0] = 0.0;
     246    outOne->data.F32[0] = 0.0;
     247
     248    printf("------------------------------------------------------------\n");
     249    printf("Calling pmNonLinearityLookup() with NULL input psReadout.  Should generate error, return NULL.\n");
     250    rc = pmNonLinearityLookup(NULL, in, out);
     251    if (rc != NULL) {
     252        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     253        testStatus = false;
     254    }
     255
     256    printf("------------------------------------------------------------\n");
     257    printf("Calling pmNonLinearityLookup() with NULL input psReadout->image.  Should generate error, return NULL.\n");
     258    psImage *tmpImage = myReadout->image;
     259    myReadout->image = NULL;
     260    rc = pmNonLinearityLookup(myReadout, in, out);
     261    if (rc != NULL) {
     262        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     263        testStatus = false;
     264    }
     265    myReadout->image = tmpImage;
     266
     267    printf("------------------------------------------------------------\n");
     268    printf("Calling pmNonLinearityLookup() with NULL inFlux psVector.  Should generate error, return NULL.\n");
     269    rc = pmNonLinearityLookup(myReadout, NULL, out);
     270    if (rc != NULL) {
     271        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     272        testStatus = false;
     273    }
     274
     275    printf("------------------------------------------------------------\n");
     276    printf("Calling pmNonLinearityLookup() with NULL outFlux psVector.  Should generate error, return NULL.\n");
     277    rc = pmNonLinearityLookup(myReadout, in, NULL);
     278    if (rc != NULL) {
     279        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     280        testStatus = false;
     281    }
     282
     283    test03Init(myReadout);
     284    printf("------------------------------------------------------------\n");
     285    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     286    rc = pmNonLinearityLookup(myReadout, in, outBig);
     287    if (rc == NULL) {
     288        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     289        testStatus = false;
     290    }
     291    for (i=0;i<NUM_ROWS;i++) {
     292        for (j=0;j<NUM_COLS;j++) {
     293            psF32 expect = (float) (2 * (i + j));
     294            psF32 actual = rc->image->data.F32[i][j];
     295            if (FLT_EPSILON < fabs(expect - actual)) {
     296                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     297                testStatus = false;
     298            }
     299        }
     300    }
     301
     302
     303    test03Init(myReadout);
     304    printf("------------------------------------------------------------\n");
     305    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     306    rc = pmNonLinearityLookup(myReadout, in, outSmall);
     307    if (rc == NULL) {
     308        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     309        testStatus = false;
     310    }
     311
     312    test03Init(myReadout);
     313    printf("------------------------------------------------------------\n");
     314    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     315    rc = pmNonLinearityLookup(myReadout, inSmall, out);
     316    if (rc == NULL) {
     317        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     318        testStatus = false;
     319    }
     320
     321    test03Init(myReadout);
     322    printf("------------------------------------------------------------\n");
     323    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     324    rc = pmNonLinearityLookup(myReadout, inBig, out);
     325    if (rc == NULL) {
     326        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     327        testStatus = false;
     328    }
     329
     330    test03Init(myReadout);
     331    printf("------------------------------------------------------------\n");
     332    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     333    rc = pmNonLinearityLookup(myReadout, inSmall, outBig);
     334    if (rc == NULL) {
     335        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     336        testStatus = false;
     337    }
     338
     339    test03Init(myReadout);
     340    printf("------------------------------------------------------------\n");
     341    printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
     342    rc = pmNonLinearityLookup(myReadout, inBig, outSmall);
     343    if (rc == NULL) {
     344        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     345        testStatus = false;
     346    }
     347
     348    test03Init(myReadout);
     349    printf("------------------------------------------------------------\n");
     350    printf("Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original psReadout.\n");
     351    rc = pmNonLinearityLookup(myReadout, inOne, out);
     352    if (rc != myReadout) {
     353        printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original psReadout\n");
     354        testStatus = false;
     355    }
     356
     357    printf("------------------------------------------------------------\n");
     358    printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
     359    test03Init(myReadout);
     360    myReadout->image->data.F32[0][0] = -1;
     361    rc = pmNonLinearityLookup(myReadout, in, out);
     362    if (rc == NULL) {
     363        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     364        testStatus = false;
     365    }
     366
     367
     368    psFree(myReadout);
     369    psFree(in);
     370    psFree(inOne);
     371    psFree(inSmall);
     372    psFree(inBig);
     373    psFree(out);
     374    psFree(outOne);
     375    psFree(outSmall);
     376    psFree(outBig);
     377
     378    return(testStatus);
     379}
  • trunk/psModules/test/tst_pmReadoutCombine.c

    r2856 r2915  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-30 21:35:04 $
     7 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-01-05 23:25:25 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444        for (psS32 j = 0 ; j < output->numCols ; j++) {
    4545            if (output->data.F32[i][j] != expect) {
    46                 printf("ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect);
     46                printf("TEST ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect);
    4747                testStatus = false;
    4848            }
     
    261261
    262262        if (rc->type.type != scale->type.type) {
    263             printf("ERROR: output readout->image has incorrect type.\n");
     263            printf("TEST ERROR: output readout->image has incorrect type.\n");
    264264            testStatus = false;
    265265        }
    266266        psFree(rc);
    267267    } else {
    268         printf("ERROR: pmReadoutCombine() returned NULL\n");
     268        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
    269269        testStatus = false;
    270270
     
    275275    rc = pmReadoutCombine(NULL, list, params, zeroHalf, scale, true, 0.0, 0.0);
    276276    if (rc != NULL) {
    277         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     277        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    278278        testStatus = false;
    279279    }
     
    283283    rc = pmReadoutCombine(NULL, list, params, zeroF64, scale, true, 0.0, 0.0);
    284284    if (rc != NULL) {
    285         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     285        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    286286        testStatus = false;
    287287    }
     
    300300        rc = NULL;
    301301    } else {
    302         printf("ERROR: pmReadoutCombine() returned NULL\n");
     302        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
    303303        testStatus = false;
    304304    }
     
    316316
    317317        if (rc->type.type != scale->type.type) {
    318             printf("ERROR: output readout->image has incorrect type.\n");
     318            printf("TEST ERROR: output readout->image has incorrect type.\n");
    319319            testStatus = false;
    320320        }
    321321        psFree(rc);
    322322    } else {
    323         printf("ERROR: pmReadoutCombine() returned NULL\n");
     323        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
    324324        testStatus = false;
    325325
     
    330330    rc = pmReadoutCombine(output, list, params, zero, scaleHalf, true, 0.0, 0.0);
    331331    if (rc != NULL) {
    332         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     332        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    333333        testStatus = false;
    334334    }
     
    338338    rc = pmReadoutCombine(output, list, params, zero, scaleF64, true, 0.0, 0.0);
    339339    if (rc != NULL) {
    340         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     340        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    341341        testStatus = false;
    342342    }
     
    355355        rc = NULL;
    356356    } else {
    357         printf("ERROR: pmReadoutCombine() returned NULL\n");
     357        printf("TEST ERROR: pmReadoutCombine() returned NULL\n");
    358358        testStatus = false;
    359359    }
     
    364364    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
    365365    if (rc != NULL) {
    366         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     366        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    367367        testStatus = false;
    368368    }
     
    377377    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
    378378    if (rc != NULL) {
    379         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     379        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    380380        testStatus = false;
    381381    }
     
    387387    rc = pmReadoutCombine(output, NULL, params, zero, scale, true, 0.0, 0.0);
    388388    if (rc != NULL) {
    389         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     389        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    390390        testStatus = false;
    391391    }
     
    395395    rc = pmReadoutCombine(output, list, NULL, zero, scale, true, 0.0, 0.0);
    396396    if (rc != NULL) {
    397         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     397        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    398398        testStatus = false;
    399399    }
     
    404404    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
    405405    if (rc != NULL) {
    406         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     406        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    407407        testStatus = false;
    408408    }
     
    412412    psStats *oldStats = params->stats;
    413413    printf("Calling pmReadoutCombine() with NULL param->stats.  Should generate error, return NULL.\n");
     414    params->stats = NULL;
    414415    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
    415416    if (rc != NULL) {
    416         printf("ERROR: pmReadoutCombine() did not return NULL\n");
     417        printf("TEST ERROR: pmReadoutCombine() did not return NULL\n");
    417418        testStatus = false;
    418419    }
  • trunk/psModules/test/tst_pmSubtractBias.c

    r2856 r2915  
    1313 *  @author GLG, MHPCC
    1414 *
    15  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-12-30 21:35:04 $
     15 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-01-05 23:25:25 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8282            actual = myReadout->image->data.F32[i][j];
    8383            if (FLT_EPSILON < fabs(expect - actual)) {
    84                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     84                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    8585                testStatus = 1;
    8686            }
     
    150150            actual = myReadout->image->data.F32[i][j];
    151151            if (FLT_EPSILON < fabs(expect - actual)) {
    152                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     152                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    153153                testStatus = 1;
    154154            }
     
    223223            actual = myReadout->image->data.F32[i][j];
    224224            if (FLT_EPSILON < fabs(expect - actual)) {
    225                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     225                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    226226                testStatus = 1;
    227227            }
     
    285285            actual = myReadout->image->data.F32[i][j];
    286286            if (FLT_EPSILON < fabs(expect - actual)) {
    287                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     287                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    288288                testStatus = 1;
    289289            }
     
    351351            actual = myReadout->image->data.F32[i][j];
    352352            if (FLT_EPSILON < fabs(expect - actual)) {
    353                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     353                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    354354                testStatus = 1;
    355355            }
     
    431431            actual = myReadout->image->data.F32[i][j];
    432432            if (FLT_EPSILON < fabs(expect - actual)) {
    433                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     433                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    434434                testStatus = 1;
    435435            }
     
    505505            actual = myReadout->image->data.F32[i][j];
    506506            if (FLT_EPSILON < fabs(expect - actual)) {
    507                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     507                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    508508                testStatus = 1;
    509509            }
     
    614614    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL);
    615615    if (rc != myReadout) {
    616         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     616        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    617617        testStatus = false;
    618618    }
     
    622622    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL);
    623623    if (rc != myReadout) {
    624         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     624        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    625625        testStatus = false;
    626626        psFree(rc);
     
    631631    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL);
    632632    if (rc != myReadout) {
    633         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     633        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    634634        testStatus = false;
    635635        psFree(rc);
     
    645645            psF32 actual = rc->image->data.F32[i][j];
    646646            if (FLT_EPSILON < fabs(expect - actual)) {
    647                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     647                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    648648                testStatus = 1;
    649649            }
     
    664664            psF32 actual = rc->image->data.F32[i][j];
    665665            if (FLT_EPSILON < fabs(expect - actual)) {
    666                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     666                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    667667                testStatus = 1;
    668668            }
     
    681681            psF32 actual = rc->image->data.F32[i][j];
    682682            if (FLT_EPSILON < fabs(expect - actual)) {
    683                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     683                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    684684                testStatus = 1;
    685685            }
     
    695695    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias);
    696696    if (rc != myReadout) {
    697         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     697        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    698698        testStatus = false;
    699699        psFree(rc);
     
    705705            psF32 actual = rc->image->data.F32[i][j];
    706706            if (FLT_EPSILON < fabs(expect - actual)) {
    707                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     707                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    708708                testStatus = 1;
    709709            }
     
    725725            psF32 actual = rc->image->data.F32[i][j];
    726726            if (FLT_EPSILON < fabs(expect - actual)) {
    727                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     727                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    728728                testStatus = 1;
    729729            }
     
    742742                psF32 actual = rc->image->data.F32[i][j];
    743743                if (FLT_EPSILON < fabs(expect - actual)) {
    744                     printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     744                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    745745                    testStatus = 1;
    746746                }
     
    759759                psF32 actual = rc->image->data.F32[i][j];
    760760                if (FLT_EPSILON < fabs(expect - actual)) {
    761                     printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     761                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    762762                    testStatus = 1;
    763763                }
     
    771771                               0, PM_FIT_NONE, myBiasShortRows);
    772772    if (rc != myReadout) {
    773         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     773        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    774774        testStatus = false;
    775775        psFree(rc);
     
    782782                               0, PM_FIT_NONE, myBiasShortCols);
    783783    if (rc != myReadout) {
    784         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     784        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    785785        testStatus = false;
    786786        psFree(rc);
     
    792792                               0, 54321, NULL);
    793793    if (rc != myReadout) {
    794         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     794        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    795795        testStatus = false;
    796796        psFree(rc);
     
    802802                               0, PM_FIT_NONE, NULL);
    803803    if (rc != myReadout) {
    804         printf("ERROR: pmSubtractBias() did not return input psReadout.\n");
     804        printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
    805805        testStatus = false;
    806806        psFree(rc);
     
    813813                psF32 actual = rc->image->data.F32[i][j];
    814814                if (FLT_EPSILON < fabs(expect - actual)) {
    815                     printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     815                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    816816                    testStatus = 1;
    817817                }
     
    921921            actual = myReadout->image->data.F32[i][j];
    922922            if (FLT_EPSILON < fabs(expect - actual)) {
    923                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     923                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    924924                testStatus = 1;
    925925            }
  • trunk/psModules/test/tst_pmSubtractSky.c

    r2856 r2915  
    77 *  @author GLG, MHPCC
    88 *
    9  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-12-30 21:35:04 $
     9 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-01-05 23:25:25 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6565        for (j=0;j<numCols;j++) {
    6666            if (ERROR_TOLERANCE < fabs(myReadout->image->data.F32[i][j])) {
    67                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]);
     67                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]);
    6868                testStatus = 1;
    6969            }
     
    113113        for (j=0;j<numCols;j++) {
    114114            if (errorTolerance < fabs(myReadout->image->data.F32[i][j] - trueImage->data.F32[i][j])) {
    115                 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j,
     115                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j,
    116116                       myReadout->image->data.F32[i][j], trueImage->data.F32[i][j]);
    117117                testStatus = 1;
     
    201201    rc = pmSubtractSky(NULL, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    202202    if (rc != NULL) {
    203         printf("ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
     203        printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
    204204        testStatus = false;
    205205    }
     
    210210    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    211211    if (rc != NULL) {
    212         printf("ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
     212        printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
    213213        testStatus = false;
    214214    }
     
    220220    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    221221    if (rc != NULL) {
    222         printf("ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
    223         testStatus = false;
    224     }
    225     myReadout->image = tmpImageF32;
    226 
    227     printf("----------------------------------------------------------------\n");
    228     printf("Calling pmSubtractSky() with NULL fitSpec.  Should return image, no ERROR, no WARNING.\n\n");
     222        printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
     223        testStatus = false;
     224    }
     225    myReadout->image = tmpImageF32;
     226
     227    printf("----------------------------------------------------------------\n");
     228    printf("Calling pmSubtractSky() with NULL fitSpec.  Should return image, no TEST ERROR, no WARNING.\n\n");
    229229    rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    230230    if (rc != myReadout) {
    231         printf("ERROR: pmSubtractSky() returned something other than psReadout\n");
    232         testStatus = false;
    233     }
    234 
    235     printf("----------------------------------------------------------------\n");
    236     printf("Calling pmSubtractSky() with PM_FIT_NONE fit.  Should return image, no ERROR, no WARNING.\n\n");
     231        printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     232        testStatus = false;
     233    }
     234
     235    printf("----------------------------------------------------------------\n");
     236    printf("Calling pmSubtractSky() with PM_FIT_NONE fit.  Should return image, no TEST ERROR, no WARNING.\n\n");
    237237    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0);
    238238    if (rc != myReadout) {
    239         printf("ERROR: pmSubtractSky() returned something other than psReadout\n");
    240         testStatus = false;
    241     }
    242 
    243     printf("----------------------------------------------------------------\n");
    244     printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit.  Should return image, no ERROR, no WARNING.\n\n");
     239        printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     240        testStatus = false;
     241    }
     242
     243    printf("----------------------------------------------------------------\n");
     244    printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit.  Should return image, no TEST ERROR, no WARNING.\n\n");
    245245    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0);
    246246    if (rc != myReadout) {
    247         printf("ERROR: pmSubtractSky() returned something other than psReadout\n");
     247        printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
    248248        testStatus = false;
    249249    }
     
    255255        for (j=0;j<NUM_COLS_SMALL;j++) {
    256256            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    257                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     257                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    258258                       rc->image->data.F32[i][j]);
    259259                testStatus = false;
     
    270270        for (j=0;j<NUM_COLS_SMALL;j++) {
    271271            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    272                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     272                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    273273                       rc->image->data.F32[i][j]);
    274274                testStatus = false;
     
    286286        for (j=0;j<NUM_COLS_SMALL;j++) {
    287287            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    288                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     288                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    289289                       rc->image->data.F32[i][j]);
    290290                testStatus = false;
     
    300300        for (j=0;j<NUM_COLS_SMALL;j++) {
    301301            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    302                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     302                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    303303                       rc->image->data.F32[i][j]);
    304304                testStatus = false;
     
    313313        for (j=0;j<NUM_COLS_SMALL;j++) {
    314314            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    315                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     315                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    316316                       rc->image->data.F32[i][j]);
    317317                testStatus = false;
     
    326326        for (j=0;j<NUM_COLS_SMALL;j++) {
    327327            if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) {
    328                 printf("ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
     328                printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,
    329329                       rc->image->data.F32[i][j]);
    330330                testStatus = false;
     
    337337    rc = pmSubtractSky(myReadout, (void *) myPoly, 54321, 1, myStats, -1.0);
    338338    if (rc != myReadout) {
    339         printf("ERROR: pmSubtractSky() returned something other than psReadout\n");
     339        printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
    340340        testStatus = false;
    341341    }
Note: See TracChangeset for help on using the changeset viewer.