IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 20, 2005, 1:06:24 PM (21 years ago)
Author:
gusciora
Message:

....

Location:
trunk/psModules/test/detrend
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/detrend/tst_pmFlatField.c

    r5169 r5435  
    2121 *  @author Ross Harman, MHPCC
    2222 *
    23  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2005-09-28 20:42:52 $
     23 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-10-20 23:06:24 $
    2525 *
    2626 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8585    inReadout->row0 = 0;
    8686    inReadout->col0 = 0;
     87    CREATE_AND_SET_IMAGE(inMask, U8, 0, 3,3);
     88    inReadout->mask = inMask;
     89    PRINT_MATRIX((inReadout->mask),U8,"Input mask:");
    8790    PRINT_MATRIX(inImage,F64,"Input image:");
    88 
    89     CREATE_AND_SET_IMAGE(inMask,U8,0,3,3)
    90     pmReadout *inMaskReadout = pmReadoutAlloc(NULL);
    91     inMaskReadout->image = inMask;
    92     inMaskReadout->row0 = 0;
    93     inMaskReadout->col0 = 0;
    94     PRINT_MATRIX(inMask,U8,"Input mask:");
    9591
    9692    CREATE_AND_SET_IMAGE(flatImage1,F64,2.0,3,3)
     
    10197    PRINT_MATRIX(flatImage1,F64,"Flat image:");
    10298
    103     if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     99    if ( !pmFlatField(inReadout, flatReadout) ) {
    104100        psError(PS_ERR_UNKNOWN,true,"Test A - Returned false should be true");
    105101        return 1;
     
    116112    PRINT_MATRIX(flatImage2, F64, "Flat image:");
    117113    flatReadout->image = flatImage2;
    118     if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     114    if ( !pmFlatField(inReadout, flatReadout) ) {
    119115        psError(PS_ERR_UNKNOWN,true,"Test B - Returned false should be true");
    120116        return 2;
    121117    }
    122     PRINT_MATRIX(inMaskReadout->image, PS_TYPE_MASK_DATA, "Resulting mask:");
     118    PRINT_MATRIX(inReadout->mask, PS_TYPE_MASK_DATA, "Resulting mask:");
    123119    PRINT_MATRIX(inImage,F64,"Resulting image:");
    124120    printFooter(stdout, "pmFlatField", "Test B - Mask flat image data", true);
     
    135131    psFree(inReadout->mask);
    136132    inReadout->mask = mask1;
    137     if ( !pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     133    if ( !pmFlatField(inReadout, flatReadout) ) {
    138134        psError(PS_ERR_UNKNOWN,true,"Test C - Returned false should be true");
    139135        return 3;
     
    149145    printNegativeTestHeader(stdout,"pmFlatField", "Test D - Attempt to use null flat readout",
    150146                            "Null not allowed for flat readout", 0);
    151     if( pmFlatField(inReadout, inMaskReadout, NULL) ) {
     147    if( pmFlatField(inReadout, NULL) ) {
    152148        psError(PS_ERR_UNKNOWN,true,"Test D - Returned true should be false");
    153149        return 4;
     
    162158    psImage *temp = inReadout->image;
    163159    inReadout->image = NULL;
    164     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     160    if ( pmFlatField(inReadout, flatReadout) ) {
    165161        psError(PS_ERR_UNKNOWN,true,"Test E - Returned true should be false" );
    166162        return 5;
    167163    }
    168     inReadout->image = temp;
     164    inReadout->image = temp    ;
    169165    printFooter(stdout, "pmFlatField", "Test E - Attempt to use null input image", true);
    170166    printf("\n\n\n");
     
    176172    temp = flatReadout->image;
    177173    flatReadout->image = NULL;
    178     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     174    if ( pmFlatField(inReadout, flatReadout) ) {
    179175        psError(PS_ERR_UNKNOWN,true,"Test F - Returned true should be false" );
    180176        return 6;
     
    191187    temp = flatReadout->image;
    192188    flatReadout->image = smallFlat;
    193     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     189    if ( pmFlatField(inReadout, flatReadout) ) {
    194190        psError(PS_ERR_UNKNOWN,true,"Test G - Returned true should be false");
    195191        return 7;
     
    198194    printFooter(stdout, "pmFlatField", "Test G - Attempt to use input image bigger than flat image", true);
    199195    printf("\n\n\n");
    200 
    201196
    202197    // Test H - Attempt to use input image mask bigger than flat image
     
    204199                            "Input image mask size exceeds that of flat image", 0);
    205200    CREATE_AND_SET_IMAGE(largeMask,F64,0.0,5,5);
    206     temp = inReadout->mask;
    207     inMaskReadout->image = largeMask;
    208     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     201    inReadout->mask = largeMask;
     202    if ( pmFlatField(inReadout, flatReadout) ) {
    209203        psError(PS_ERR_UNKNOWN,true,"Test H - Returned true should be false");
    210204        return 8;
    211205    }
    212     inReadout->mask = temp;
    213206    printFooter(stdout, "pmFlatField", "Test H - Attempt to use input image mask bigger than flat image", true);
    214207    printf("\n\n\n");
    215 
     208    inReadout->mask = mask1;
    216209
    217210    // Test I - Attempt to use offset greater than input image
     
    220213    *(int*)&inReadout->col0 = 50;
    221214    *(int*)&inReadout->row0 = 50;
    222     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     215    if ( pmFlatField(inReadout, flatReadout) ) {
    223216        psError(PS_ERR_UNKNOWN,true,"Test I - Returned true should be false");
    224217        return 9;
     
    234227                            "Complex types not allowed for input image", 0);
    235228    *(psElemType* ) & inReadout->image->type.type = PS_TYPE_C64;
    236     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     229    if ( pmFlatField(inReadout, flatReadout) ) {
    237230        psError(PS_ERR_UNKNOWN,true,"Test J - Returned true should be false");
    238231        return 10;
     
    247240                            "Complex types not allowed for flat image", 0);
    248241    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_C64;
    249     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     242    if ( pmFlatField(inReadout, flatReadout) ) {
    250243        psError(PS_ERR_UNKNOWN,true,"Test K - Returned ture should be false");
    251244        return 11;
     
    260253                            "Input and flat image types differ", 0);
    261254    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_F32;
    262     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     255    if ( pmFlatField(inReadout, flatReadout) ) {
    263256        psError(PS_ERR_UNKNOWN,true,"Test L - Returned true should be false");
    264257        return 12;
     
    273266                            "Mask must be PS_TYPE_MASK type", 0);
    274267    *(psElemType* ) & inReadout->mask->type.type = PS_TYPE_F32;
    275     if ( pmFlatField(inReadout, inMaskReadout, flatReadout) ) {
     268    if ( pmFlatField(inReadout, flatReadout) ) {
    276269        psError(PS_ERR_UNKNOWN,true,"Test M - Returned true should be false");
    277270        return 13;
     
    283276
    284277    // Free memory
    285     psFree(inMask);
    286     psFree(largeMask);
    287     inMaskReadout->image = NULL;
    288     psFree(inMaskReadout);
    289278    psFree(inReadout);
    290279    psFree(flatReadout);
     
    293282    //psFree(flatImage1);
    294283    psFree(smallFlat);
     284    psFree(largeMask);
    295285
    296286    return 0;
  • trunk/psModules/test/detrend/tst_pmNonLinear.c

    r5169 r5435  
    1 /** @file tst_pmNonLinear.c
     1/* @file tst_pmNonLinear.c
    22 *
    33 *  @brief Contains the tests for pmNonLinear.c:
     
    1616 *  @author GLG, MHPCC
    1717 *
    18  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2005-09-28 20:42:52 $
     18 *  XXX: Add tests in which the lookup file has incorrect number of entries,
     19 *  and where the data is outside the pmReadout range.
     20 *
     21 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-10-20 23:06:24 $
    2023 *
    2124 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3740                          };
    3841
    39 
    40 int main(int argc, char* argv[])
    41 {
    42     psLogSetFormat("HLNM");
    43     return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    44 }
    45 
    4642#define NUM_ROWS 8
    4743#define NUM_COLS 8
     44#define LOOKUP_FILENAME ".tmp_tst_pmNonLinearLookupFile"
     45int main(int argc, char* argv[])
     46{
     47    psLogSetFormat("HLNM");
     48    //
     49    // We generate a lookup file for future tests.  We should probably remove
     50    // it when we're done.
     51    //
     52    FILE *fp = fopen(LOOKUP_FILENAME, "w");
     53    ;
     54    for (psS32 i=0;i<PS_MAX(NUM_COLS, NUM_ROWS)*3;i++) {
     55        fprintf(fp, "%f %f\n", (float) i, (float) (2 * i));
     56    }
     57    fclose(fp);
     58
     59    //    system("rm LOOKUP_FILENAME");
     60    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
     61}
     62
    4863int doNonLinearityPolynomialTest(int numCols, int numRows)
    4964{
     
    105120    float expect;
    106121    int testStatus = true;
    107     int tableSize = PS_MAX(numCols, numRows)*2;
    108122    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    109123    pmReadout *myReadout = pmReadoutAlloc(NULL);
    110124    myReadout->image = myImage;
    111     psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
    112     psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
    113125
    114126    printPositiveTestHeader(stdout, "pmNonLinear", "doNonLinearityLookupTest");
     
    119131    }
    120132
    121     for (i=0;i<tableSize;i++) {
    122         in->data.F32[i] = (float) i;
    123         out->data.F32[i] = (float) (2 * i);
    124     }
    125 
    126     myReadout = pmNonLinearityLookup(myReadout, in, out);
     133    myReadout = pmNonLinearityLookup(myReadout, LOOKUP_FILENAME);
    127134    for (i=0;i<numRows;i++) {
    128135        for (j=0;j<numCols;j++) {
     
    136143    }
    137144
    138 
    139     psFree(myReadout);
    140     psFree(in);
    141     psFree(out);
     145    psFree(myReadout);
    142146    printFooter(stdout, "pmNonLinear", "doNonLinearityLookupTest", true);
    143147    return(testStatus);
     
    220224int test03()
    221225{
    222     int i;
    223     int j;
    224     int testStatus = true;
    225     int tableSize = PS_MAX(NUM_COLS, NUM_ROWS)*3;
     226    int testStatus = true;
    226227    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
    227228    pmReadout *myReadout = pmReadoutAlloc(NULL);
    228229    pmReadout *rc = NULL;
    229230    myReadout->image = myImage;
    230     psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
    231     psVector *inOne = psVectorAlloc(1, PS_TYPE_F32);
    232     psVector *inSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
    233     psVector *inBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
    234     psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
    235     psVector *outOne = psVectorAlloc(1, PS_TYPE_F32);
    236     psVector *outSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32);
    237     psVector *outBig = psVectorAlloc(tableSize+1, PS_TYPE_F32);
    238231
    239232    test03Init(myReadout);
    240     for (i=0;i<tableSize;i++) {
    241         in->data.F32[i] = (float) i;
    242         out->data.F32[i] = (float) (2 * i);
    243         inBig->data.F32[i] = (float) i;
    244         outBig->data.F32[i] = (float) (2 * i);
    245         if (i < tableSize-1) {
    246             inSmall->data.F32[i] = (float) i;
    247             outSmall->data.F32[i] = (float) (2 * i);
    248         }
    249     }
    250     inBig->data.F32[tableSize] = (float) tableSize;
    251     outBig->data.F32[tableSize] = (float) (2 * tableSize);
    252     inOne->data.F32[0] = 0.0;
    253     outOne->data.F32[0] = 0.0;
    254 
    255233    printf("------------------------------------------------------------\n");
    256234    printf("Calling pmNonLinearityLookup() with NULL input pmReadout.  Should generate error, return NULL.\n");
    257     rc = pmNonLinearityLookup(NULL, in, out);
     235    rc = pmNonLinearityLookup(NULL, LOOKUP_FILENAME);
    258236    if (rc != NULL) {
    259237        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
     
    265243    psImage *tmpImage = myReadout->image;
    266244    myReadout->image = NULL;
    267     rc = pmNonLinearityLookup(myReadout, in, out);
     245    rc = pmNonLinearityLookup(myReadout, LOOKUP_FILENAME);
    268246    if (rc != NULL) {
    269247        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
     
    273251
    274252    printf("------------------------------------------------------------\n");
    275     printf("Calling pmNonLinearityLookup() with NULL inFlux psVector.  Should generate error, return NULL.\n");
    276     rc = pmNonLinearityLookup(myReadout, NULL, out);
    277     if (rc != NULL) {
    278         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    279         testStatus = false;
    280     }
    281 
    282     printf("------------------------------------------------------------\n");
    283     printf("Calling pmNonLinearityLookup() with NULL outFlux psVector.  Should generate error, return NULL.\n");
    284     rc = pmNonLinearityLookup(myReadout, in, NULL);
    285     if (rc != NULL) {
    286         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    287         testStatus = false;
    288     }
    289 
    290     test03Init(myReadout);
    291     printf("------------------------------------------------------------\n");
    292     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    293     rc = pmNonLinearityLookup(myReadout, in, outBig);
     253    printf("Calling pmNonLinearityLookup() with non-existent lookup file.\n");
     254    rc = pmNonLinearityLookup(myReadout, "I_DONT_EXIST");
    294255    if (rc == NULL) {
    295256        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    296257        testStatus = false;
    297258    }
    298     for (i=0;i<NUM_ROWS;i++) {
    299         for (j=0;j<NUM_COLS;j++) {
    300             psF32 expect = (float) (2 * (i + j));
    301             psF32 actual = rc->image->data.F32[i][j];
    302             if (FLT_EPSILON < fabs(expect - actual)) {
    303                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    304                 testStatus = false;
    305             }
    306         }
    307     }
    308 
    309 
    310     test03Init(myReadout);
    311     printf("------------------------------------------------------------\n");
    312     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    313     rc = pmNonLinearityLookup(myReadout, in, outSmall);
    314     if (rc == NULL) {
    315         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    316         testStatus = false;
    317     }
    318     for (i=0;i<NUM_ROWS;i++) {
    319         for (j=0;j<NUM_COLS;j++) {
    320             psF32 expect = (float) (2 * (i + j));
    321             psF32 actual = rc->image->data.F32[i][j];
    322             if (FLT_EPSILON < fabs(expect - actual)) {
    323                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    324                 testStatus = false;
    325             }
    326         }
    327     }
    328 
    329     test03Init(myReadout);
    330     printf("------------------------------------------------------------\n");
    331     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    332     rc = pmNonLinearityLookup(myReadout, inSmall, out);
    333     if (rc == NULL) {
    334         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    335         testStatus = false;
    336     }
    337     for (i=0;i<NUM_ROWS;i++) {
    338         for (j=0;j<NUM_COLS;j++) {
    339             psF32 expect = (float) (2 * (i + j));
    340             psF32 actual = rc->image->data.F32[i][j];
    341             if (FLT_EPSILON < fabs(expect - actual)) {
    342                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    343                 testStatus = false;
    344             }
    345         }
    346     }
    347 
    348     test03Init(myReadout);
    349     printf("------------------------------------------------------------\n");
    350     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    351     rc = pmNonLinearityLookup(myReadout, inBig, out);
    352     if (rc == NULL) {
    353         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    354         testStatus = false;
    355     }
    356     for (i=0;i<NUM_ROWS;i++) {
    357         for (j=0;j<NUM_COLS;j++) {
    358             psF32 expect = (float) (2 * (i + j));
    359             psF32 actual = rc->image->data.F32[i][j];
    360             if (FLT_EPSILON < fabs(expect - actual)) {
    361                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    362                 testStatus = false;
    363             }
    364         }
    365     }
    366 
    367     test03Init(myReadout);
    368     printf("------------------------------------------------------------\n");
    369     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    370     rc = pmNonLinearityLookup(myReadout, inSmall, outBig);
    371     if (rc == NULL) {
    372         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    373         testStatus = false;
    374     }
    375     for (i=0;i<NUM_ROWS;i++) {
    376         for (j=0;j<NUM_COLS;j++) {
    377             psF32 expect = (float) (2 * (i + j));
    378             psF32 actual = rc->image->data.F32[i][j];
    379             if (FLT_EPSILON < fabs(expect - actual)) {
    380                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    381                 testStatus = false;
    382             }
    383         }
    384     }
    385 
    386     test03Init(myReadout);
    387     printf("------------------------------------------------------------\n");
    388     printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.\n");
    389     rc = pmNonLinearityLookup(myReadout, inBig, outSmall);
    390     if (rc == NULL) {
    391         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    392         testStatus = false;
    393     }
    394     for (i=0;i<NUM_ROWS;i++) {
    395         for (j=0;j<NUM_COLS;j++) {
    396             psF32 expect = (float) (2 * (i + j));
    397             psF32 actual = rc->image->data.F32[i][j];
    398             if (FLT_EPSILON < fabs(expect - actual)) {
    399                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    400                 testStatus = false;
    401             }
    402         }
    403     }
    404 
    405     test03Init(myReadout);
    406     printf("------------------------------------------------------------\n");
    407     printf("Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original pmReadout.\n");
    408     rc = pmNonLinearityLookup(myReadout, inOne, out);
    409     if (rc != myReadout) {
    410         printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original pmReadout\n");
    411         testStatus = false;
    412     }
    413     for (i=0;i<NUM_ROWS;i++) {
    414         for (j=0;j<NUM_COLS;j++) {
    415             psF32 expect = (float) ((i + j));
    416             psF32 actual = rc->image->data.F32[i][j];
    417             if (FLT_EPSILON < fabs(expect - actual)) {
    418                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    419                 testStatus = false;
    420             }
    421         }
    422     }
     259
    423260
    424261    printf("------------------------------------------------------------\n");
    425262    printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
    426     test03Init(myReadout);
    427     myReadout->image->data.F32[0][0] = -1;
    428     rc = pmNonLinearityLookup(myReadout, in, out);
    429     if (rc == NULL) {
    430         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    431         testStatus = false;
    432     }
    433     for (i=0;i<NUM_ROWS;i++) {
    434         for (j=0;j<NUM_COLS;j++) {
    435             psF32 expect = (float) (2 * (i + j));
    436             psF32 actual = rc->image->data.F32[i][j];
    437             if(i==0 && j==0) {
    438                 if(actual != 0.0) {
    439                     printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,0.0);
    440                 }
    441             } else {
    442                 if (FLT_EPSILON < fabs(expect - actual)) {
    443                     printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    444                     testStatus = false;
    445                 }
    446             }
    447         }
    448     }
    449 
    450     printf("------------------------------------------------------------\n");
    451     printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
    452     test03Init(myReadout);
    453     myReadout->image->data.F32[NUM_ROWS-1][NUM_COLS-1] = 100;
    454     rc = pmNonLinearityLookup(myReadout, in, out);
    455     if (rc == NULL) {
    456         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    457         testStatus = false;
    458     }
    459     for (i=0;i<NUM_ROWS;i++) {
    460         for (j=0;j<NUM_COLS;j++) {
    461             psF32 expect = (float) (2 * (i + j));
    462             psF32 actual = rc->image->data.F32[i][j];
    463             if(i==(NUM_ROWS-1) && j==(NUM_COLS-1)) {
    464                 if(actual != (tableSize-1)*2) {
    465                     printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,(tableSize-1)*2.0);
    466                 }
    467             } else {
    468                 if (FLT_EPSILON < fabs(expect - actual)) {
    469                     printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    470                     testStatus = false;
    471                 }
    472             }
    473         }
    474     }
    475 
    476     test03Init(myReadout);
    477     printf("------------------------------------------------------------\n");
    478     printf("Calling pmNonLinearityLookup() with image values not in vector.\n");
    479     myReadout->image->data.F32[0][0] = 0.5;
    480     rc = pmNonLinearityLookup(myReadout, in, out);
    481     if (rc == NULL) {
    482         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    483         testStatus = false;
    484     }
    485     for (i=0;i<NUM_ROWS;i++) {
    486         for (j=0;j<NUM_COLS;j++) {
    487             psF32 expect = (float) (2 * (i + j));
    488             if(i==0 && j==0) {
    489                 expect = 1.0;
    490             }
    491             psF32 actual = rc->image->data.F32[i][j];
    492             if (FLT_EPSILON < fabs(expect - actual)) {
    493                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    494                 testStatus = false;
    495             }
    496         }
    497     }
    498 
    499     psFree(myReadout);
    500     psFree(in);
    501     psFree(inOne);
    502     psFree(inSmall);
    503     psFree(inBig);
    504     psFree(out);
    505     psFree(outOne);
    506     psFree(outSmall);
    507     psFree(outBig);
     263
     264    psFree(myReadout);
    508265
    509266    printFooter(stdout, "pmNonLinear", "Testing bad input parameter conditions.", true);
Note: See TracChangeset for help on using the changeset viewer.