Changeset 19968 for trunk/ppStats/src/ppStatsFromMetadataStats.c
- Timestamp:
- Oct 7, 2008, 3:20:16 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppStats/src/ppStatsFromMetadataStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStats/src/ppStatsFromMetadataStats.c
r19967 r19968 5 5 { 6 6 for (int i = 0; i < entries->n; i++) { 7 ppStatsEntry *entry = entries->data[i];7 ppStatsEntry *entry = entries->data[i]; 8 8 9 if (!strcasecmp(entry->statistic, "constant")) { 10 continue; 11 } 9 if (!strcasecmp (entry->statistic, "constant")) continue; 10 11 // XXX skip or warn on missing stats? 12 if (!entry->vector) continue; 12 13 13 // XXX skip or warn on missing stats? 14 if (!entry->vector) { 15 continue; 16 } 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 } 17 31 18 psStatsOptions option; 19 if (!strcasecmp (entry->statistic, "RMS")) { 20 option = psStatsOptionFromString ("ROBUST_MEDIAN"); 21 } else if (!strcasecmp (entry->statistic, "SUM")) { 22 option = psStatsOptionFromString ("SAMPLE_MEAN"); 23 } else if (!strcasecmp (entry->statistic, "UQ")) { 24 option = psStatsOptionFromString ("ROBUST_QUARTILE"); 25 } else if (!strcasecmp (entry->statistic, "LQ")) { 26 option = psStatsOptionFromString ("ROBUST_QUARTILE"); 27 } else { 28 option = psStatsOptionFromString (entry->statistic); 29 } 32 option = psStatsOptionFromString (entry->statistic); 33 34 got_stats: 35 stats = psStatsAlloc (option); 30 36 31 psStats *stats = psStatsAlloc(option);37 if (entry->vector->n == 0) continue; 32 38 33 psVectorStats(stats, entry->vector, NULL, NULL, 0);39 psVectorStats (stats, entry->vector, NULL, NULL, 0); 34 40 35 double value; 36 if (!strcasecmp (entry->statistic, "RMS")) { 37 value = sqrt(stats->robustMedian); 38 } else if (!strcasecmp (entry->statistic, "SUM")) { 39 value = stats->sampleMean * entry->vector->n; 40 } else if (!strcasecmp (entry->statistic, "UQ")) { 41 value = stats->robustUQ; 42 } else if (!strcasecmp (entry->statistic, "LQ")) { 43 value = stats->robustLQ; 44 } else { 45 value = psStatsGetValue (stats, option); 46 } 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 47 59 entry->value = psMetadataItemAllocF32(entry->keyword, entry->statistic, value); 48 60 psFree(stats);
Note:
See TracChangeset
for help on using the changeset viewer.
