Changeset 30075
- Timestamp:
- Dec 16, 2010, 6:10:00 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r28998 r30075 827 827 // values; nearly bi-modal distribution). if so, keep only points within 5? 10? 828 828 // bins of that excess bin: 829 int nMaxBin = 0;829 int nMaxBin = histogram->nums->data.F32[0]; 830 830 int iMaxBin = 0; 831 831 for (long i = 1; i < histogram->nums->n; i++) { … … 843 843 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal) continue; 844 844 bool invalid = false; 845 invalid |= (myVector->data.F32[i] < =minKeep);846 invalid |= (myVector->data.F32[i] > =maxKeep);845 invalid |= (myVector->data.F32[i] < minKeep); 846 invalid |= (myVector->data.F32[i] > maxKeep); 847 847 invalid |= (!isfinite(myVector->data.F32[i])); 848 848 if (!invalid) continue; … … 852 852 853 853 if (nInvalid) { 854 psTrace(TRACE, 6, "data is concentrated in a single bin, masking %d extreme outliers and retrying\n", nInvalid); 854 psTrace(TRACE, 6, "data is concentrated in a single bin (%d = %f - %f), masking %d extreme outliers and retrying\n", 855 iMaxBin, histogram->bounds->data.F32[iMaxBin], histogram->bounds->data.F32[iMaxBin+1], nInvalid); 855 856 psFree(histogram); 856 857 psFree(cumulative); … … 1108 1109 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1109 1110 if (isnan(stats->robustMedian)) { 1110 stats->fittedStdev = NAN; 1111 stats->fittedStdev = NAN; 1111 stats->fittedMean = NAN; 1112 stats->fittedStdev = NAN; 1113 stats->results |= PS_STAT_FITTED_MEAN; 1114 stats->results |= PS_STAT_FITTED_STDEV; 1115 return true; 1116 } 1117 1118 if (stats->robustStdev <= FLT_EPSILON) { 1119 stats->fittedMean = stats->robustMedian; 1120 stats->fittedStdev = stats->robustStdev; 1121 stats->results |= PS_STAT_FITTED_MEAN; 1122 stats->results |= PS_STAT_FITTED_STDEV; 1112 1123 return true; 1113 1124 } … … 1289 1300 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1290 1301 if (isnan(stats->robustMedian)) { 1291 stats->fittedStdev = NAN; 1292 stats->fittedStdev = NAN; 1293 psTrace(TRACE, 4, "---- %s() end ----\n", __func__); 1302 stats->fittedMean = NAN; 1303 stats->fittedStdev = NAN; 1304 stats->results |= PS_STAT_FITTED_MEAN_V2; 1305 stats->results |= PS_STAT_FITTED_STDEV_V2; 1306 return true; 1307 } 1308 1309 if (stats->robustStdev <= FLT_EPSILON) { 1310 stats->fittedMean = stats->robustMedian; 1311 stats->fittedStdev = stats->robustStdev; 1312 stats->results |= PS_STAT_FITTED_MEAN_V2; 1313 stats->results |= PS_STAT_FITTED_STDEV_V2; 1294 1314 return true; 1295 1315 } … … 1486 1506 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1487 1507 if (isnan(stats->robustMedian)) { 1488 stats->fittedStdev = NAN; 1489 stats->fittedStdev = NAN; 1490 psTrace(TRACE, 4, "---- %s() end ----\n", __func__); 1508 stats->fittedMean = NAN; 1509 stats->fittedStdev = NAN; 1510 stats->results |= PS_STAT_FITTED_MEAN_V3; 1511 stats->results |= PS_STAT_FITTED_STDEV_V3; 1512 return true; 1513 } 1514 1515 if (stats->robustStdev <= FLT_EPSILON) { 1516 stats->fittedMean = stats->robustMedian; 1517 stats->fittedStdev = stats->robustStdev; 1518 stats->results |= PS_STAT_FITTED_MEAN_V3; 1519 stats->results |= PS_STAT_FITTED_STDEV_V3; 1491 1520 return true; 1492 1521 } … … 1782 1811 1783 1812 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1784 if (isnan(stats->robustMedian)) goto escape; 1813 if (isnan(stats->robustMedian)) { 1814 stats->fittedMean = NAN; 1815 stats->fittedStdev = NAN; 1816 stats->results |= PS_STAT_FITTED_MEAN_V4; 1817 stats->results |= PS_STAT_FITTED_STDEV_V4; 1818 return true; 1819 } 1820 1821 if (stats->robustStdev <= FLT_EPSILON) { 1822 stats->fittedMean = stats->robustMedian; 1823 stats->fittedStdev = stats->robustStdev; 1824 stats->results |= PS_STAT_FITTED_MEAN_V4; 1825 stats->results |= PS_STAT_FITTED_STDEV_V4; 1826 return true; 1827 } 1785 1828 1786 1829 float guessStdev = stats->robustStdev; // pass the guess sigma
Note:
See TracChangeset
for help on using the changeset viewer.
