IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6304


Ignore:
Timestamp:
Feb 2, 2006, 11:06:10 AM (20 years ago)
Author:
gusciora
Message:

....

Location:
trunk/psLib/test
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/imageops/tst_psImageStats.c

    r6283 r6304  
    718718            }
    719719        }
    720         tmpImage->data.F32[ tmpImage->numRows/4 ][ tmpImage->numCols/4 ] = 10000000.0;
    721         tmpImage->data.F32[ tmpImage->numRows/4 ][ 3 * tmpImage->numCols/4 ] = 10000000.0;
    722         tmpImage->data.F32[ 3 * tmpImage->numRows/4 ][ tmpImage->numCols/4 ] = 10000000.0;
    723         tmpImage->data.F32[ 3 * tmpImage->numRows/4 ][ 3 * tmpImage->numCols/4 ] = 10000000.0;
    724 
    725720
    726721        for ( i = 0;i < tmpMask->numRows;i++ ) {
     
    736731
    737732        myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
    738         //        myStats = psStatsAlloc( PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | PS_STAT_ROBUST_QUARTILE | PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV );
    739733        /*************************************************************************/
    740734        /*  Calculate Sample Mean with no mask                           */
  • trunk/psLib/test/math/Makefile.am

    r6226 r6304  
    88    tst_psHist02 \
    99    tst_psHist03 \
     10    tst_psMathUtils \
    1011    tst_psMatrix01 \
    1112    tst_psMatrix02 \
     
    4748tst_psHist02_SOURCES =  tst_psHist02.c
    4849tst_psHist03_SOURCES =  tst_psHist03.c
     50tst_psMathUtils_SOURCES =  tst_psMathUtils.c
    4951tst_psMatrix01_SOURCES =  tst_psMatrix01.c
    5052tst_psMatrix02_SOURCES =  tst_psMatrix02.c
  • trunk/psLib/test/math/tst_psPolyFit1D.c

    r6226 r6304  
    104104
    105105        if (flags & TS00_POLY_CHEB) {
    106             p_psNormalizeVectorRangeF32(x, -1.0, 1.0);
     106            p_psNormalizeVectorRange(x, -1.0, 1.0);
    107107        }
    108108    }
     
    116116
    117117        if (flags & TS00_POLY_CHEB) {
    118             p_psNormalizeVectorRangeS32(x, -1, 1);
     118            p_psNormalizeVectorRange(x, -1, 1);
    119119        }
    120120    }
     
    128128
    129129        if (flags & TS00_POLY_CHEB) {
    130             p_psNormalizeVectorRangeF64(x, -1.0, 1.0);
     130            p_psNormalizeVectorRange(x, -1.0, 1.0);
    131131        }
    132132    }
  • trunk/psLib/test/math/tst_psStats07.c

    r6215 r6304  
    1313#include <math.h>
    1414
    15 #define N 90
     15#define NUM_DATA 10000
    1616#define MEAN 32.0
    1717#define STDEV 2.0
    1818#define ERROR_TOLERANCE 0.15
     19#define PERCENT_OUTLIERS 10
    1920
    2021psS32 t00()
     
    2728    psVector *myVector = NULL;
    2829    psVector *maskVector = NULL;
    29     // NOTE: These values were calculated by running the function on the data.
    30     // They must be changed if we adjust the number of data points.
    31     // We don't really know that they are correct.
    3230    psS32 count = 0;
    3331    psS32 currentId = psMemGetId();
     
    3533    float realMeanNoMask = MEAN;
    3634    float realMedianNoMask = MEAN;
    37     //    float realModeNoMask = MEAN;
    3835    float realStdevNoMask = STDEV;
    3936    float realLQNoMask = MEAN - ( 0.6 * STDEV );
    4037    float realUQNoMask = MEAN + ( 0.6 * STDEV );
    41     psS32 realN50NoMask = N / 4;
     38    psS32 realN50NoMask = NUM_DATA / 4;
    4239
    4340    /*************************************************************************/
    4441    /*  Allocate and initialize data structures                              */
    4542    /*************************************************************************/
    46     maskVector = psVectorAlloc( N, PS_TYPE_U8 );
    47     maskVector->n = N;
    48     myVector = p_psGaussianDev( MEAN, STDEV, N );
     43    maskVector = psVectorAlloc( NUM_DATA, PS_TYPE_U8 );
     44    maskVector->n = NUM_DATA;
     45    myVector = p_psGaussianDev( MEAN, STDEV, NUM_DATA );
    4946    // Set the mask vector and calculate the expected maximum.
    50     for ( i = 0;i < N;i++ ) {
    51         if ( i < ( N / 2 ) ) {
     47    for ( i = 0;i < NUM_DATA;i++ ) {
     48        if ( i < ( NUM_DATA / 2 ) ) {
    5249            maskVector->data.U8[ i ] = 0;
    5350            count++;
     
    5653        }
    5754    }
     55
     56    //
     57    // We calculate the exact mean, median, stdev and quartiles with no mask.
     58    //
    5859    psStats *mySampleStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
    5960                                           PS_STAT_SAMPLE_MEDIAN |
     
    6768    psFree(mySampleStats);
    6869
     70    //
     71    // We calculate the exact mean, median, stdev and quartiles with mask.
     72    //
    6973    psStats *mySampleStatsWithMask = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
    7074                                     PS_STAT_SAMPLE_MEDIAN |
     
    8488                           PS_STAT_FITTED_STDEV);
    8589    // Create a full outliers:
    86     myVector->data.F32[N/4] = -1000.0 * MEAN;
    87     myVector->data.F32[N/2] = 1000.0 * MEAN;
     90    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
     91        if (PERCENT_OUTLIERS > (random() % 100)) {
     92            myVector->data.F32[i] = 1000.0 * MEAN;
     93        }
     94    }
    8895    /*************************************************************************/
    8996    /*  Call psVectorStats() with no vector mask.                            */
     
    130137                 "PS_STAT_ROBUST_STATS: robust Median: no vector mask",
    131138                 testStatus );
    132 
    133     /* XXX: Should we test mode?
    134         printPositiveTestHeader( stdout,
    135                                  "psStats functions",
    136                                  "PS_STAT_ROBUST_STATS: robust Mode: no vector mask" );
    137      
    138      
    139         printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n",
    140                 realModeNoMask, myStats->robustMode );
    141         if ( fabs( myStats->robustMode - realModeNoMask ) < ( ERROR_TOLERANCE * realModeNoMask ) ) {
    142             testStatus = true;
    143         } else {
    144             testStatus = false;
    145             globalTestStatus = false;
    146         }
    147         printFooter( stdout,
    148                      "psVector functions",
    149                      "PS_STAT_ROBUST_STATS: robust Mode: no vector mask",
    150                      testStatus );
    151     */
    152139
    153140    printPositiveTestHeader( stdout,
     
    268255    float realMeanWithMask = MEAN;
    269256    float realMedianWithMask = MEAN;
    270     //    float realModeWithMask = MEAN;
    271257    float realStdevWithMask = STDEV;
    272258    float realLQWithMask = MEAN;
    273259    float realUQWithMask = MEAN;
    274     psS32 realN50WithMask = N / 4;
     260    psS32 realN50WithMask = NUM_DATA / 4;
    275261    /*************************************************************************/
    276262    /*  Allocate and initialize data structures                              */
     
    282268                           PS_STAT_FITTED_STDEV);
    283269
    284     maskVector = psVectorAlloc( N, PS_TYPE_U8 );
    285     maskVector->n = N;
    286     myVector = p_psGaussianDev( MEAN, STDEV, N );
     270    maskVector = psVectorAlloc( NUM_DATA, PS_TYPE_U8 );
     271    maskVector->n = NUM_DATA;
     272    myVector = p_psGaussianDev( MEAN, STDEV, NUM_DATA );
    287273    // Set the mask vector and calculate the expected maximum.
    288     for ( i = 0;i < N;i++ ) {
    289         if ( i < ( N / 2 ) ) {
     274    for ( i = 0;i < NUM_DATA;i++ ) {
     275        if ( i < ( NUM_DATA / 2 ) ) {
    290276            maskVector->data.U8[ i ] = 0;
    291277            count++;
    292278        } else {
    293279            maskVector->data.U8[ i ] = 1;
     280        }
     281    }
     282    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
     283        if (PERCENT_OUTLIERS < (random() % 100)) {
     284            myVector->data.F32[i] = 1000.0 * MEAN;
    294285        }
    295286    }
     
    338329                 "PS_STAT_ROBUST_STATS: robust Median: with vector mask",
    339330                 testStatus );
    340 
    341 
    342     /* XXX: mode is not set?
    343         printPositiveTestHeader( stdout,
    344                                  "psStats functions",
    345                                  "PS_STAT_ROBUST_STATS: robust Mode: with vector mask" );
    346      
    347         printf( "The expected Mode was %.2f; the calculated Mode was %.2f\n",
    348                 realModeWithMask, myStats->robustMode );
    349         if ( fabs( myStats->robustMode - realModeWithMask ) < ( ERROR_TOLERANCE * realModeWithMask ) ) {
    350             testStatus = true;
    351         } else {
    352             testStatus = false;
    353             globalTestStatus = false;
    354         }
    355         printFooter( stdout,
    356                      "psVector functions",
    357                      "PS_STAT_ROBUST_STATS: robust Mode: with vector mask",
    358                      testStatus );
    359     */
    360331
    361332
     
    469440    // We list pertinent psStats.c functions here for debugging ease.
    470441    //
    471     psTraceSetLevel(".", 0);
    472     psTraceSetLevel("psGaussian", 0);
    473     psTraceSetLevel("p_psGetStatValue", 0);
    474     psTraceSetLevel("p_psVectorMax", 0);
    475     psTraceSetLevel("p_psVectorMin", 0);
    476     psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
    477     psTraceSetLevel("p_psNormalizeVectorRange", 0);
    478     psTraceSetLevel("p_ps1DPolyMedian", 0);
    479     psTraceSetLevel("fitQuadraticSearchForYThenReturnX", 0);
    480     psTraceSetLevel("PsVectorDup", 0);
    481     psTraceSetLevel("psMinimizeLMChi2Gauss1D", 0);
    482     psTraceSetLevel("LinInterpolate", 0);
    483     psTraceSetLevel("p_psVectorRobustStats", 0);
    484     psTraceSetLevel("psStatsAlloc", 0);
    485     psTraceSetLevel("psHistogramAlloc", 0);
    486     psTraceSetLevel("psHistogramAllocGeneric", 0);
    487     psTraceSetLevel("UpdateHistogramBins", 0);
    488     psTraceSetLevel("psVectorHistogram", 0);
    489     psTraceSetLevel("p_psConvertToF32", 0);
    490     psTraceSetLevel("psVectorStats", 0);
     442    #define TRACE_LEVEL 0
     443
     444    psTraceSetLevel(".", TRACE_LEVEL);
     445    psTraceSetLevel("psGaussian", TRACE_LEVEL);
     446    psTraceSetLevel("p_psGetStatValue", TRACE_LEVEL);
     447    psTraceSetLevel("p_psVectorMax", TRACE_LEVEL);
     448    psTraceSetLevel("p_psVectorMin", TRACE_LEVEL);
     449    psTraceSetLevel("p_psVectorCheckNonEmpty", TRACE_LEVEL);
     450    psTraceSetLevel("p_psNormalizeVectorRange", TRACE_LEVEL);
     451    psTraceSetLevel("p_ps1DPolyMedian", TRACE_LEVEL);
     452    psTraceSetLevel("fitQuadraticSearchForYThenReturnX", TRACE_LEVEL);
     453    psTraceSetLevel("PsVectorDup", TRACE_LEVEL);
     454    psTraceSetLevel("psMinimizeLMChi2Gauss1D", TRACE_LEVEL);
     455    psTraceSetLevel("LinInterpolate", TRACE_LEVEL);
     456    psTraceSetLevel("p_psVectorRobustStats", TRACE_LEVEL);
     457    psTraceSetLevel("psStatsAlloc", TRACE_LEVEL);
     458    psTraceSetLevel("psHistogramAlloc", TRACE_LEVEL);
     459    psTraceSetLevel("psHistogramAllocGeneric", TRACE_LEVEL);
     460    psTraceSetLevel("UpdateHistogramBins", TRACE_LEVEL);
     461    psTraceSetLevel("psVectorHistogram", TRACE_LEVEL);
     462    psTraceSetLevel("p_psConvertToF32", TRACE_LEVEL);
     463    psTraceSetLevel("psVectorStats", TRACE_LEVEL);
    491464    psBool rc0 = t00();
    492465    psBool rc1 = t01();
  • trunk/psLib/test/math/tst_psStats09.c

    r5117 r6304  
    1818#define MY_MEAN  30.0
    1919#define MY_RANGE 2.0
     20#define VERBOSE 1
     21
     22#define TST_IN_NULL  0x00000000
     23#define TST_IN_F32  0x00000000
     24#define TST_IN_F64  0x00000000
     25#define TST_IN_S8  0x00000000
     26#define TST_IN_U16  0x00000000
     27#define TST_IN_S32  0x00000000
     28#define TST_ERRORS_NULL  0x00000000
     29#define TST_ERRORS_F32  0x00000000
     30#define TST_ERRORS_F64  0x00000000
     31#define TST_ERRORS_S8  0x00000000
     32#define TST_ERRORS_U16  0x00000000
     33#define TST_ERRORS_S32  0x00000000
     34#define TST_MASK_NULL  0x00000000
     35#define TST_MASK_U8  0x00000000
     36#define TST_MASK_S32  0x00000000
     37
     38psS32 genericClippedStatsTest(
     39    unsigned int flags,
     40    psS32 numData,
     41    psU32 maskValue,
     42    psBool expectedRC)
     43{
     44    psS32 currentId = psMemGetId();
     45    psS32 testStatus = true;
     46    psS32 memLeaks = 0;
     47    psVector *in = NULL;
     48    psVector *errors = NULL;
     49    psVector *mask = NULL;
     50    printPositiveTestHeader(stdout, "psMathUtils functions", "psVectorStats Clipped Stats Routine");
     51
     52    if (expectedRC == false) {
     53        printf("This test should generate an error message, and return NULL.\n");
     54    }
     55
     56    if (flags & TST_IN_NULL) {
     57        printf("        using a NULL in vector\n");
     58    }
     59
     60    if (flags & TST_IN_F32) {
     61        printf("        using a psF32 in vector\n");
     62        in = psVectorAlloc(numData, PS_TYPE_F32);
     63        for (psS32 i=0;i<numData;i++) {
     64            in->data.F32[i] = (psF32) i;
     65        }
     66
     67        if (VERBOSE) {
     68            for (psS32 i=0;i<numData;i++) {
     69                printf("Original in data %d: (%.1f)\n", i, in->data.F32[i]);
     70            }
     71        }
     72    }
     73
     74    if (flags & TST_IN_F64) {
     75        printf("        using a psF64 in vector\n");
     76        in = psVectorAlloc(numData, PS_TYPE_F64);
     77        for (psS32 i=0;i<numData;i++) {
     78            in->data.F64[i] = (psF64) i;
     79        }
     80
     81        if (VERBOSE) {
     82            for (psS32 i=0;i<numData;i++) {
     83                printf("Original in data %d: (%.1f)\n", i, in->data.F64[i]);
     84            }
     85        }
     86    }
     87
     88    if (flags & TST_IN_S8) {
     89        printf("        using a psS8 in vector\n");
     90        in = psVectorAlloc(numData, PS_TYPE_S8);
     91        for (psS32 i=0;i<numData;i++) {
     92            in->data.S8[i] = (psS8) i;
     93        }
     94
     95        if (VERBOSE) {
     96            for (psS32 i=0;i<numData;i++) {
     97                printf("Original in data %d: (%d)\n", i, in->data.S8[i]);
     98            }
     99        }
     100    }
     101
     102    if (flags & TST_IN_U16) {
     103        printf("        using a psU16 in vector\n");
     104        in = psVectorAlloc(numData, PS_TYPE_U16);
     105        for (psS32 i=0;i<numData;i++) {
     106            in->data.U16[i] = (psU16) i;
     107        }
     108
     109        if (VERBOSE) {
     110            for (psS32 i=0;i<numData;i++) {
     111                printf("Original in data %d: (%d)\n", i, in->data.U16[i]);
     112            }
     113        }
     114    }
     115
     116    if (flags & TST_IN_S32) {
     117        printf("        using a psS32 in vector\n");
     118        in = psVectorAlloc(numData, PS_TYPE_S32);
     119        for (psS32 i=0;i<numData;i++) {
     120            in->data.S32[i] = (psS32) i;
     121        }
     122
     123        if (VERBOSE) {
     124            for (psS32 i=0;i<numData;i++) {
     125                printf("Original in data %d: (%d)\n", i, in->data.S32[i]);
     126            }
     127        }
     128    }
     129
     130
     131    if (flags & TST_ERRORS_NULL) {
     132        printf("        using a NULL errors vector\n");
     133    }
     134
     135    if (flags & TST_ERRORS_F32) {
     136        printf("        using a psF32 errors vector\n");
     137        errors = psVectorAlloc(numData, PS_TYPE_F32);
     138        for (psS32 i=0;i<numData;i++) {
     139            errors->data.F32[i] = (psF32) i;
     140        }
     141
     142        if (VERBOSE) {
     143            for (psS32 i=0;i<numData;i++) {
     144                printf("Original errors data %d: (%.1f)\n", i, errors->data.F32[i]);
     145            }
     146        }
     147    }
     148
     149    if (flags & TST_ERRORS_F64) {
     150        printf("        using a psF64 errors vector\n");
     151        errors = psVectorAlloc(numData, PS_TYPE_F64);
     152        for (psS32 i=0;i<numData;i++) {
     153            errors->data.F64[i] = (psF64) i;
     154        }
     155
     156        if (VERBOSE) {
     157            for (psS32 i=0;i<numData;i++) {
     158                printf("Original errors data %d: (%.1f)\n", i, errors->data.F64[i]);
     159            }
     160        }
     161    }
     162
     163    if (flags & TST_ERRORS_S8) {
     164        printf("        using a psS8 errors vector\n");
     165        errors = psVectorAlloc(numData, PS_TYPE_S8);
     166        for (psS32 i=0;i<numData;i++) {
     167            errors->data.S8[i] = (psS8) i;
     168        }
     169
     170        if (VERBOSE) {
     171            for (psS32 i=0;i<numData;i++) {
     172                printf("Original errors data %d: (%d)\n", i, errors->data.S8[i]);
     173            }
     174        }
     175    }
     176
     177    if (flags & TST_ERRORS_U16) {
     178        printf("        using a psU16 errors vector\n");
     179        errors = psVectorAlloc(numData, PS_TYPE_U16);
     180        for (psS32 i=0;i<numData;i++) {
     181            errors->data.U16[i] = (psU16) i;
     182        }
     183
     184        if (VERBOSE) {
     185            for (psS32 i=0;i<numData;i++) {
     186                printf("Original errors data %d: (%d)\n", i, errors->data.U16[i]);
     187            }
     188        }
     189    }
     190
     191    if (flags & TST_ERRORS_S32) {
     192        printf("        using a psS32 errors vector\n");
     193        errors = psVectorAlloc(numData, PS_TYPE_S32);
     194        for (psS32 i=0;i<numData;i++) {
     195            errors->data.S32[i] = (psS32) i;
     196        }
     197
     198        if (VERBOSE) {
     199            for (psS32 i=0;i<numData;i++) {
     200                printf("Original errors data %d: (%d)\n", i, errors->data.S32[i]);
     201            }
     202        }
     203    }
     204
     205
     206    if (flags & TST_MASK_NULL) {
     207        printf("        using a NULL mask vector\n");
     208    }
     209
     210    if (flags & TST_MASK_U8) {
     211        printf("        using a psU8 mask vector\n");
     212        mask = psVectorAlloc(numData, PS_TYPE_U8);
     213        for (psS32 i=0;i<numData;i++) {
     214            mask->data.U8[i] = (psU8) i;
     215        }
     216
     217        if (VERBOSE) {
     218            for (psS32 i=0;i<numData;i++) {
     219                printf("Original mask data %d: (%d)\n", i, mask->data.U8[i]);
     220            }
     221        }
     222    }
     223
     224    if (flags & TST_MASK_S32) {
     225        printf("        using a psS32 mask vector\n");
     226        mask = psVectorAlloc(numData, PS_TYPE_S32);
     227        for (psS32 i=0;i<numData;i++) {
     228            mask->data.S32[i] = (psS32) i;
     229        }
     230
     231        if (VERBOSE) {
     232            for (psS32 i=0;i<numData;i++) {
     233                printf("Original mask data %d: (%d)\n", i, mask->data.S32[i]);
     234            }
     235        }
     236    }
     237
     238    psStats *myStats = psStatsAlloc(PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     239    psStats *rc = psVectorStats(myStats, in, errors, mask, maskValue);
     240
     241    if (rc == NULL) {
     242        if (expectedRC == true) {
     243            printf("TEST ERROR: the psVectorStats() function returned NULL.\n");
     244            testStatus = false;
     245        }
     246    } else {
     247        if (expectedRC == false) {
     248            printf("TEST ERROR: the psVectorStats() function returned non-NULL.\n");
     249            testStatus = false;
     250        }
     251
     252    }
     253
     254    psMemCheckCorruption(1);
     255    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
     256    if (0 != memLeaks) {
     257        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
     258    }
     259
     260    return(testStatus);
     261}
     262
     263
     264
    20265
    21266psS32 main()
     
    38283    psTraceSetLevel("psVectorStats", 0);
    39284
    40     psStats *myStats    = NULL;
    41     psS32 testStatus      = true;
    42     psS32 globalTestStatus = true;
    43     psS32 i               = 0;
    44     psVector *maskVector= NULL;
    45     psVector *myGaussData  = NULL;
    46     // NOTE: These values were calculated by running the function on the data.
    47     // A: They must be changed if we adjust the number of data points.
    48     // B: We don't really know that they are correct.
    49     //    float realclippedMeanNoMask  = 0.0;
    50     //    float realclippedStdevNoMask = 0.0;
    51     //    float realclippedMeanWithMask  = 0.0;
    52     //    float realclippedStdevWithMask = 0.0;
    53     psS32 count           = 0;
    54     psS32 currentId       = psMemGetId();
    55     psS32 memLeaks        = 0;
    56 
    57     /*************************************************************************/
    58     /*  Allocate and initialize data structures                      */
    59     /*************************************************************************/
    60     myStats = psStatsAlloc(PS_STAT_CLIPPED_MEAN |
    61                            PS_STAT_CLIPPED_STDEV);
    62 
    63     myGaussData = psVectorAlloc(N, PS_TYPE_F32);
    64     myGaussData->n = myGaussData->nalloc;
    65     for (i=0;i<N;i++) {
    66         myGaussData->data.F32[i] = MY_MEAN - (MY_RANGE/1.9) +
    67                                    (MY_RANGE) * ((float) i) / ((float) N);
    68     }
    69 
    70     maskVector = psVectorAlloc(N, PS_TYPE_U8);
    71     maskVector->n = N;
    72 
    73     // Set the mask vector and calculate the expected maximum.
    74     for (i=0;i<N;i++) {
    75         if (i < (N/2)) {
    76             maskVector->data.U8[i] = 0;
    77             count++;
    78         } else {
    79             maskVector->data.U8[i] = 1;
    80         }
    81     }
    82 
    83     /*************************************************************************/
    84     /*  Call psVectorStats() with no vector mask.                    */
    85     /*************************************************************************/
    86     printPositiveTestHeader(stdout,
    87                             "psStats functions",
    88                             "PS_STAT_CLIPPED_MEAN: no vector mask");
    89 
    90     myStats = psVectorStats(myStats, myGaussData, NULL, NULL, 0);
    91 
    92     printf("Called psVectorStats() on a vector with no elements masked.\n");
    93     printf("The calculated clippedMean was %.2f\n", myStats->clippedMean);
    94 
    95     printFooter(stdout,
    96                 "psVector functions",
    97                 "PS_STAT_CLIPPED_MEAN/STDEV: no vector mask",
    98                 testStatus);
    99 
    100 
    101 
    102     printPositiveTestHeader(stdout,
    103                             "psStats functions",
    104                             "PS_STAT_CLIPPED_STDEV: no vector mask");
    105 
    106     printf("Called psVectorStats() on a vector with no elements masked.\n");
    107     printf("The calculated clippedStdev was %.2f\n", myStats->clippedStdev);
    108 
    109     printFooter(stdout,
    110                 "psVector functions",
    111                 "PS_STAT_CLIPPED_MEAN/STDEV: no vector mask",
    112                 testStatus);
    113 
    114     /*************************************************************************/
    115     /*  Call psVectorStats() with vector mask.                       */
    116     /*************************************************************************/
    117     printPositiveTestHeader(stdout,
    118                             "psStats functions",
    119                             "PS_STAT_CLIPPED_MEAN: vector mask");
    120 
    121     myStats = psVectorStats(myStats, myGaussData, NULL, maskVector, 1);
    122 
    123     printf("Called psVectorStats() on a vector with elements masked.\n");
    124     printf("The calculated clippedMean was %.2f\n", myStats->clippedMean);
    125     printFooter(stdout,
    126                 "psVector functions",
    127                 "PS_STAT_CLIPPED_MEAN/STDEV: vector mask",
    128                 testStatus);
    129 
    130 
    131 
    132     printPositiveTestHeader(stdout,
    133                             "psStats functions",
    134                             "PS_STAT_CLIPPED_STDEV: vector mask");
    135 
    136     printf("Called psVectorStats() on a vector with elements masked.\n");
    137     printf("The calculated clippedStdev was %.2f\n", myStats->clippedStdev);
    138     printFooter(stdout,
    139                 "psVector functions",
    140                 "PS_STAT_CLIPPED_MEAN/STDEV: vector mask",
    141                 testStatus);
    142 
    143     /*************************************************************************/
    144     /*  Deallocate data structures                                   */
    145     /*************************************************************************/
    146     printPositiveTestHeader(stdout,
    147                             "psStats functions",
    148                             "psStats(): deallocating memory");
    149 
    150     psFree(myStats);
    151     psFree(myGaussData);
    152     psFree(maskVector);
    153 
    154     psMemCheckCorruption(1);
    155     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    156     if (0 != memLeaks) {
    157         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    158     }
    159 
    160     printFooter(stdout,
    161                 "psVector functions",
    162                 "psStats(): deallocating memory",
    163                 testStatus);
    164 
    165     return (!globalTestStatus);
    166285}
Note: See TracChangeset for help on using the changeset viewer.