Changeset 10395
- Timestamp:
- Dec 1, 2006, 12:41:33 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
src/math/psStats.c (modified) (3 diffs)
-
test/math/tap_psStats_Sample_01.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r10274 r10395 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.19 1$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-1 1-29 17:55:25$18 * @version $Revision: 1.192 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-12-01 22:41:33 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1090 1090 tmpScalar.type.type = PS_TYPE_F32; 1091 1091 1092 // construct a histogram with (sigma/10 < binsize < sigma) 1093 // set roughly so that the lowest bins have about 2 cnts 1094 // Nsmallest ~ N50 / (4*dN)) 1095 psF32 dN = PS_MAX (1, PS_MIN (10, stats->robustN50 / 8)); 1096 psF32 newBinSize = stats->fittedStdev / dN; 1092 psF32 binSize = 1; 1093 if (stats->options & PS_STAT_USE_BINSIZE) { 1094 // Set initial bin size to the specified value. 1095 binSize = stats->binsize; 1096 psTrace("psLib.math", 6, "Setting initial robust bin size to %.2f\n", binSize); 1097 } else { 1098 // construct a histogram with (sigma/10 < binsize < sigma) 1099 // set roughly so that the lowest bins have about 2 cnts 1100 // Nsmallest ~ N50 / (4*dN)) 1101 psF32 dN = PS_MAX (1, PS_MIN (10, stats->robustN50 / 8)); 1102 binSize = stats->fittedStdev / dN; 1103 } 1097 1104 1098 1105 // Determine the min/max of the vector (which prior outliers masked out) … … 1108 1115 1109 1116 // Calculate the number of bins. 1110 long numBins = (max - min) / newBinSize;1117 long numBins = (max - min) / binSize; 1111 1118 psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max); 1112 psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize);1119 psTrace("psLib.math", 6, "The new bin size is %f.\n", binSize); 1113 1120 psTrace("psLib.math", 6, "The numBins is %ld\n", numBins); 1114 1121 -
trunk/psLib/test/math/tap_psStats_Sample_01.c
r10384 r10395 226 226 psMemId id = psMemGetId(); 227 227 228 diag("sample 1 ");228 diag("sample 1 : problem with integer-binned data driven to tiny sigma values"); 229 229 psStats *stats = psStatsAlloc (PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV | 230 230 PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | 231 231 PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV | 232 232 PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_MEDIAN | 233 PS_STAT_SAMPLE_STDEV); 233 PS_STAT_SAMPLE_STDEV | PS_STAT_USE_BINSIZE); 234 stats->binsize = 1.0; 235 234 236 235 237 // copy data in static array
Note:
See TracChangeset
for help on using the changeset viewer.
