IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12242


Ignore:
Timestamp:
Mar 5, 2007, 1:23:38 PM (19 years ago)
Author:
gusciora
Message:

I recalculated the correct values for the sample-mean tests with
an error vector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/math/tap_psStats00.c

    r11656 r12242  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2007-02-06 00:50:03 $
     11 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2007-03-05 23:23:38 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    5454static psF64 expectedMeanRangeNoMaskF32         =  0.137500;
    5555static psF64 expectedMeanRangeWithMaskF32       = -0.366667;
    56 static psF64 expectedWeightMeanNoMaskF32        =  1.807210;
    57 static psF64 expectedWeightMeanWithMaskF32      =  1.890217;
    58 static psF64 expectedWeightMeanNoMaskRangeF32   =  0.640952;
    59 static psF64 expectedWeightMeanWithMaskRangeF32 =  0.046574;
     56static psF64 expectedWeightMeanNoMaskF32        =  2.020035;
     57static psF64 expectedWeightMeanWithMaskF32      =  2.036018;
     58static psF64 expectedWeightMeanNoMaskRangeF32   = -0.650684;
     59static psF64 expectedWeightMeanWithMaskRangeF32 = -1.046423;
    6060
    6161#include <unistd.h>
     
    6969    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    7070    psVector *myVector = psVectorAlloc(N, PS_TYPE_F32);
    71     myVector->n = N;
    7271    psVector *myErrors = psVectorAlloc(N, PS_TYPE_F32);
    73     myErrors->n = N;
    7472    psVector *maskVector = psVectorAlloc(N, PS_TYPE_U8);
    75     maskVector->n = N;
    7673    // Set the appropriate values for the vector data.
    7774    for (long i = 0; i < N; i++) {
     
    8582    }
    8683
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
    87116    // Call psVectorStats() with no vector mask.
    88117    {
    89118        psMemId id = psMemGetId();
    90119        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
    91         ok(result, "psVectorStats suceeded");
     120        ok(result, "psVectorStats suceeded (F32: no mask vector, no error vector)");
    92121        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    93122        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4,
     
    100129        psMemId id = psMemGetId();
    101130        bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0);
    102         ok(result, "psVectorStats suceeded");
     131        ok(result, "psVectorStats suceeded (F32: no mask vector, with error vector)");
    103132        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    104133        ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskF32);
     
    113142        myStats->max =   8.0;
    114143        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
    115         ok(result, "psVectorStats suceeded");
     144        ok(result, "psVectorStats suceeded (F32, no mask, no errors, with data range)");
    116145        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    117146        ok_float_tol(myStats->sampleMean, expectedMeanRangeNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeNoMaskF32);
     
    125154        myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
    126155        bool result = psVectorStats(myStats, myVector, myErrors, NULL, 0);
    127         ok(result, "psVectorStats suceeded");
     156        ok(result, "psVectorStats suceeded (F32, no mask, with errors and data range)");
    128157        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    129158        ok_float_tol(myStats->sampleMean, expectedWeightMeanNoMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanNoMaskRangeF32);
     
    136165        myStats->options = PS_STAT_SAMPLE_MEAN;
    137166        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
    138         ok(result, "psVectorStats suceeded");
     167        ok(result, "psVectorStats suceeded (F32, with mask, no errors)");
    139168        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    140169        ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32);
     
    146175        psMemId id = psMemGetId();
    147176        bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
    148         ok(result, "psVectorStats suceeded");
     177        ok(result, "psVectorStats suceeded (F32, with mask and errors)");
    149178        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    150179        ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskF32);
     
    157186        myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
    158187        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
    159         ok(result, "psVectorStats suceeded");
     188        ok(result, "psVectorStats suceeded (F32, with mask and data range)");
    160189        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    161190        ok_float_tol(myStats->sampleMean, expectedMeanRangeWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanRangeWithMaskF32);
     
    167196        psMemId id = psMemGetId();
    168197        bool result = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
    169         ok(result, "psVectorStats suceeded");
     198        ok(result, "psVectorStats suceeded (F32, withmask, errors, and data range)");
    170199        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    171200        ok_float_tol(myStats->sampleMean, expectedWeightMeanWithMaskRangeF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedWeightMeanWithMaskRangeF32);
     
    183212        }
    184213        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 2);
    185         ok(result, "psVectorStats suceeded");
     214        ok(result, "psVectorStats suceeded (F32, with mask = 2, no errors)");
    186215        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    187216        ok_float_tol(myStats->sampleMean, expectedMeanWithMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanWithMaskF32);
     
    199228        }
    200229        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 4);
    201         ok(result, "psVectorStats suceeded");
     230        ok(result, "psVectorStats suceeded (F32, with mask = 3, no errors)");
    202231        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    203232        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF32, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF32);
     
    205234    }
    206235
    207     // Mask all values and verify return is NAN
     236    // Mask all values and verify return is FALSE
    208237    {
    209238        psMemId id = psMemGetId();
     
    213242        }
    214243        bool result = psVectorStats(myStats, myVector, NULL, maskVector, 1);
    215         ok(result, "psVectorStats suceeded");
     244        ok(result == false, "psVectorStats suceeded (All values masked)");
    216245        ok(isnan(myStats->sampleMean), "psVectorStats() returned NAN");
    217246        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    245274
    246275        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
    247         ok(result, "psVectorStats suceeded");
     276        ok(result, "psVectorStats suceeded (S8, no mask, no errors)");
    248277        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    249278        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskS8, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskS8);
     
    266295
    267296        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
    268         ok(result, "psVectorStats suceeded");
     297        ok(result, "psVectorStats suceeded (U16, no mask, no errors)");
    269298        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    270299        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskU16, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskU16);
     
    286315
    287316        bool result = psVectorStats(myStats, myVector, NULL, NULL, 0);
    288         ok(result, "psVectorStats suceeded");
     317        ok(result, "psVectorStats suceeded (F64, no mask, no errors)");
    289318        ok(!isnan(myStats->sampleMean), "psVectorStats() returned non-NAN");
    290319        ok_float_tol(myStats->sampleMean, expectedMeanNoMaskF64, 1e-4, "The mean was %f, should be %f", myStats->sampleMean, expectedMeanNoMaskF64);
Note: See TracChangeset for help on using the changeset viewer.