IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19969


Ignore:
Timestamp:
Oct 7, 2008, 3:22:56 PM (18 years ago)
Author:
Paul Price
Message:

Fixing compilation errors.

File:
1 edited

Legend:

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

    r19968 r19969  
    55{
    66    for (int i = 0; i < entries->n; i++) {
    7         ppStatsEntry *entry = entries->data[i];
     7        ppStatsEntry *entry = entries->data[i];
    88
    9         if (!strcasecmp (entry->statistic, "constant")) continue;
    10        
    11         // XXX skip or warn on missing stats?
    12         if (!entry->vector) continue;
     9        if (!strcasecmp (entry->statistic, "constant")) continue;
    1310
    14         psStatsOptions option;
    15         if (!strcasecmp (entry->statistic, "RMS")) {
    16             option = psStatsOptionFromString ("SAMPLE_MEAN");
    17             goto got_stats;
    18         }
    19         if (!strcasecmp (entry->statistic, "SUM")) {
    20             option = psStatsOptionFromString ("SAMPLE_MEAN");
    21             goto got_stats;
    22         }
    23         if (!strcasecmp (entry->statistic, "UQ")) {
    24             option = psStatsOptionFromString ("ROBUST_QUARTILE");
    25             goto got_stats;
    26         }
    27         if (!strcasecmp (entry->statistic, "LQ")) {
    28             option = psStatsOptionFromString ("ROBUST_QUARTILE");
    29             goto got_stats;
    30         }
     11        // XXX skip or warn on missing stats?
     12        if (!entry->vector) continue;
    3113
    32         option = psStatsOptionFromString (entry->statistic);
    33        
     14        psStatsOptions option;
     15        if (!strcasecmp (entry->statistic, "RMS")) {
     16            option = psStatsOptionFromString ("SAMPLE_MEAN");
     17            goto got_stats;
     18        }
     19        if (!strcasecmp (entry->statistic, "SUM")) {
     20            option = psStatsOptionFromString ("SAMPLE_MEAN");
     21            goto got_stats;
     22        }
     23        if (!strcasecmp (entry->statistic, "UQ")) {
     24            option = psStatsOptionFromString ("ROBUST_QUARTILE");
     25            goto got_stats;
     26        }
     27        if (!strcasecmp (entry->statistic, "LQ")) {
     28            option = psStatsOptionFromString ("ROBUST_QUARTILE");
     29            goto got_stats;
     30        }
     31
     32        option = psStatsOptionFromString (entry->statistic);
     33
    3434    got_stats:
    35         stats = psStatsAlloc (option);
     35        if (entry->vector->n == 0) {
     36            continue;
     37        }
    3638
    37         if (entry->vector->n == 0) continue;
     39        psStats *stats = psStatsAlloc(option);
     40        psVectorStats(stats, entry->vector, NULL, NULL, 0);
    3841
    39         psVectorStats (stats, entry->vector, NULL, NULL, 0);
     42        double value;
     43        if (!strcasecmp (entry->statistic, "RMS")) {
     44            value = sqrt(stats->sampleMean * entry->vector->n);
     45            goto got_value;
     46        }
     47        if (!strcasecmp (entry->statistic, "SUM")) {
     48            value = stats->sampleMean * entry->vector->n;
     49            goto got_value;
     50        }
     51        if (!strcasecmp (entry->statistic, "UQ")) {
     52            value = stats->robustUQ;
     53            goto got_value;
     54        }
     55        if (!strcasecmp (entry->statistic, "LQ")) {
     56            value = stats->robustLQ;
     57            goto got_value;
     58        }
     59        value = psStatsGetValue(stats, option);
    4060
    41         if (!strcasecmp (entry->statistic, "RMS")) {
    42             value = sqrt(sampleMean * entry->vector->n);
    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         value = psStatsGetValue (stats, option);
    58 
     61    got_value:
    5962        entry->value = psMetadataItemAllocF32(entry->keyword, entry->statistic, value);
    6063        psFree(stats);
Note: See TracChangeset for help on using the changeset viewer.