Changeset 19944
- Timestamp:
- Oct 7, 2008, 9:57:23 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppStats/src/ppStatsFromMetadataStats.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStats/src/ppStatsFromMetadataStats.c
r19626 r19944 3 3 // calculate the stats for the non-constant entries (already calculated) 4 4 bool ppStatsFromMetadataStats (psArray *entries) { 5 6 double value; 5 7 6 8 for (int i = 0; i < entries->n; i++) { … … 13 15 14 16 psStatsOptions option; 15 if (!strcasecmp (entry->statistic, " rms")) {17 if (!strcasecmp (entry->statistic, "RMS")) { 16 18 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); 20 35 36 got_stats: 21 37 psStats *stats = psStatsAlloc (option); 22 38 23 39 psVectorStats (stats, entry->vector, NULL, NULL, 0); 24 40 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 25 58 double value = psStatsGetValue (stats, option); 26 59 27 if (!strcasecmp (entry->statistic, "rms")) { 28 value = sqrt(value); 29 } 30 60 got_value: 31 61 entry->value = psMetadataItemAllocF32 (entry->keyword, entry->statistic, value); 32 62 }
Note:
See TracChangeset
for help on using the changeset viewer.
