Changeset 19969
- Timestamp:
- Oct 7, 2008, 3:22:56 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppStats/src/ppStatsFromMetadataStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStats/src/ppStatsFromMetadataStats.c
r19968 r19969 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")) continue; 10 11 // XXX skip or warn on missing stats? 12 if (!entry->vector) continue; 9 if (!strcasecmp (entry->statistic, "constant")) continue; 13 10 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; 31 13 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 34 34 got_stats: 35 stats = psStatsAlloc (option); 35 if (entry->vector->n == 0) { 36 continue; 37 } 36 38 37 if (entry->vector->n == 0) continue; 39 psStats *stats = psStatsAlloc(option); 40 psVectorStats(stats, entry->vector, NULL, NULL, 0); 38 41 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); 40 60 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: 59 62 entry->value = psMetadataItemAllocF32(entry->keyword, entry->statistic, value); 60 63 psFree(stats);
Note:
See TracChangeset
for help on using the changeset viewer.
