IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19944


Ignore:
Timestamp:
Oct 7, 2008, 9:57:23 AM (18 years ago)
Author:
eugene
Message:

add SUM, UQ, LQ stats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStats/src/ppStatsFromMetadataStats.c

    r19626 r19944  
    33// calculate the stats for the non-constant entries (already calculated)
    44bool ppStatsFromMetadataStats (psArray *entries) {
     5
     6    double value;
    57
    68    for (int i = 0; i < entries->n; i++) {
     
    1315
    1416        psStatsOptions option;
    15         if (!strcasecmp (entry->statistic, "rms")) {
     17        if (!strcasecmp (entry->statistic, "RMS")) {
    1618            option = psStatsOptionFromString ("ROBUST_MEDIAN");
    17         } else {
    18             option = psStatsOptionFromString (entry->statistic);
    19         }
     19            goto got_stats;
     20        }
     21        if (!strcasecmp (entry->statistic, "SUM")) {
     22            option = psStatsOptionFromString ("SAMPLE_MEAN");
     23            goto got_stats;
     24        }
     25        if (!strcasecmp (entry->statistic, "UQ")) {
     26            option = psStatsOptionFromString ("ROBUST_QUARTILE");
     27            goto got_stats;
     28        }
     29        if (!strcasecmp (entry->statistic, "LQ")) {
     30            option = psStatsOptionFromString ("ROBUST_QUARTILE");
     31            goto got_stats;
     32        }
     33
     34        option = psStatsOptionFromString (entry->statistic);
    2035       
     36    got_stats:
    2137        psStats *stats = psStatsAlloc (option);
    2238
    2339        psVectorStats (stats, entry->vector, NULL, NULL, 0);
    2440
     41        if (!strcasecmp (entry->statistic, "RMS")) {
     42            value = sqrt(value);
     43            goto got_value;
     44        }
     45        if (!strcasecmp (entry->statistic, "SUM")) {
     46            value = stats->sampleMean * entry->vector->n;
     47            goto got_value;
     48        }
     49        if (!strcasecmp (entry->statistic, "UQ")) {
     50            value = stats->robustUQ;
     51            goto got_value;
     52        }
     53        if (!strcasecmp (entry->statistic, "LQ")) {
     54            value = stats->robustLQ;
     55            goto got_value;
     56        }
     57
    2558        double value = psStatsGetValue (stats, option);
    2659
    27         if (!strcasecmp (entry->statistic, "rms")) {
    28             value = sqrt(value);
    29         }
    30 
     60    got_value:
    3161        entry->value = psMetadataItemAllocF32 (entry->keyword, entry->statistic, value);
    3262    }
Note: See TracChangeset for help on using the changeset viewer.