Changeset 30104
- Timestamp:
- Dec 17, 2010, 10:06:58 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205/psLib
- Files:
-
- 6 edited
-
src/imageops (modified) (1 prop)
-
src/imageops/psImageMapFit.c (modified) (12 diffs)
-
src/imageops/psImageMapFit.h (modified) (4 diffs)
-
src/math/psStats.c (modified) (7 diffs)
-
src/types/psMetadata.c (modified) (4 diffs)
-
test/math (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/psLib/src/imageops
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20101205/psLib/src/imageops/psImageMapFit.c
r30019 r30104 48 48 49 49 // map defines the output image dimensions and scaling. 50 bool psImageMapFit(bool * goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,50 bool psImageMapFit(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 51 51 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 52 52 { 53 53 // XXX Add Asserts 54 54 55 * goodFit = false;55 *pGoodFit = false; 56 56 57 57 // dimensions of the output map image … … 83 83 map->map->data.F32[0][0] = psStatsGetValue(map->stats, mean); 84 84 map->error->data.F32[0][0] = psStatsGetValue(map->stats, stdev); 85 *goodFit = true; 85 if (isfinite(map->map->data.F32[0][0]) && isfinite( map->error->data.F32[0][0])) { 86 *pGoodFit = true; 87 } 86 88 return true; 87 89 } … … 89 91 if (Nx == 1) { 90 92 bool status; 91 status = psImageMapFit1DinY ( goodFit, map, mask, maskValue, x, y, f, df);93 status = psImageMapFit1DinY (pGoodFit, map, mask, maskValue, x, y, f, df); 92 94 return status; 93 95 } 94 96 if (Ny == 1) { 95 97 bool status; 96 status = psImageMapFit1DinX ( goodFit, map, mask, maskValue, x, y, f, df);98 status = psImageMapFit1DinX (pGoodFit, map, mask, maskValue, x, y, f, df); 97 99 return status; 98 100 } … … 339 341 psFree (Empty); 340 342 341 * goodFit = true;343 *pGoodFit = true; 342 344 return true; 343 345 } 344 346 345 347 // measure residuals on each pass and clip outliers based on stats 346 bool psImageMapClipFit(bool * goodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,348 bool psImageMapClipFit(bool *pGoodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue, 347 349 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 348 350 { … … 354 356 psAssert(f, "impossible"); 355 357 356 * goodFit = false;358 *pGoodFit = false; 357 359 358 360 // the user supplies one of various stats option pairs, … … 398 400 psTrace("psLib.imageops", 6, "Loop iteration %d. Calling psImageMapFit()\n", N); 399 401 psS32 Nkeep = 0; 400 if (!psImageMapFit( goodFit, map, mask, maskValue, x, y, f, df)) {402 if (!psImageMapFit(pGoodFit, map, mask, maskValue, x, y, f, df)) { 401 403 psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n"); 402 404 psFree(resid); … … 404 406 return false; 405 407 } 406 if (! goodFit) {408 if (!*pGoodFit) { 407 409 psWarning ("bad fit to image map, try something else"); 408 410 return true; … … 463 465 psFree(resid); 464 466 if (!inMask) psFree (mask); 465 * goodFit = true; // XXX probably don't need to set this (set by psImageMapFit)467 *pGoodFit = true; // XXX probably don't need to set this (set by psImageMapFit) 466 468 return true; 467 469 } 468 470 469 471 // map defines the output image dimensions and scaling. 470 bool psImageMapFit1DinY(bool * goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,472 bool psImageMapFit1DinY(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 471 473 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 472 474 { … … 474 476 assert (map->binning->nXruff == 1); 475 477 476 * goodFit = false;478 *pGoodFit = false; 477 479 478 480 // dimensions of the output map image … … 613 615 psFree (Empty); 614 616 615 * goodFit = true;617 *pGoodFit = true; 616 618 return true; 617 619 } 618 620 619 621 // map defines the output image dimensions and scaling. 620 bool psImageMapFit1DinX(bool * goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,622 bool psImageMapFit1DinX(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 621 623 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 622 624 { … … 624 626 assert (map->binning->nYruff == 1); 625 627 626 * goodFit = false;628 *pGoodFit = false; 627 629 628 630 // dimensions of the output map image … … 763 765 psFree (Empty); 764 766 765 * goodFit = true;767 *pGoodFit = true; 766 768 return true; 767 769 } -
branches/eam_branches/ipp-20101205/psLib/src/imageops/psImageMapFit.h
r30019 r30104 8 8 9 9 // fit the image map to a set of points 10 bool psImageMapFit(bool * goodFit,10 bool psImageMapFit(bool *pGoodFit, 11 11 psImageMap *map, 12 12 const psVector *mask, … … 19 19 20 20 // fit the image map to a set of points 21 bool psImageMapClipFit(bool * goodFit,21 bool psImageMapClipFit(bool *pGoodFit, 22 22 psImageMap *map, 23 23 psStats *stats, … … 30 30 ); 31 31 32 bool psImageMapFit1DinY(bool * goodFit,32 bool psImageMapFit1DinY(bool *pGoodFit, 33 33 psImageMap *map, 34 34 const psVector *mask, … … 40 40 ); 41 41 42 bool psImageMapFit1DinX(bool * goodFit,42 bool psImageMapFit1DinX(bool *pGoodFit, 43 43 psImageMap *map, 44 44 const psVector *mask, -
branches/eam_branches/ipp-20101205/psLib/src/math/psStats.c
r28998 r30104 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 -
branches/eam_branches/ipp-20101205/psLib/src/types/psMetadata.c
r29833 r30104 1371 1371 break; 1372 1372 case PS_DATA_S64: 1373 fprintf(fd, "% jd\n", item->data.S64);1373 fprintf(fd, "%" PRId64 "\n", item->data.S64); 1374 1374 break; 1375 1375 case PS_DATA_U8: … … 1383 1383 break; 1384 1384 case PS_DATA_U64: 1385 fprintf(fd, "% ju\n", item->data.U64);1385 fprintf(fd, "%" PRIu64 "\n", item->data.U64); 1386 1386 break; 1387 1387 case PS_DATA_F32: … … 1458 1458 fprintf(fd, "U64 "); 1459 1459 for (int i = 0; i < vector->n; i++) { 1460 fprintf(fd, "% ju ", vector->data.U64[i]);1460 fprintf(fd, "%" PRIu64, vector->data.U64[i]); 1461 1461 } 1462 1462 fprintf(fd, "\n"); … … 1486 1486 fprintf(fd, "S64 "); 1487 1487 for (int i = 0; i < vector->n; i++) { 1488 fprintf(fd, "% jd ", vector->data.S64[i]);1488 fprintf(fd, "%" PRId64, vector->data.S64[i]); 1489 1489 } 1490 1490 fprintf(fd, "\n"); -
branches/eam_branches/ipp-20101205/psLib/test/math
-
Property svn:mergeinfo
set to
/branches/czw_branch/20101203/psLib/test/math merged eligible /branches/eam_branches/ipp-20101103/psLib/test/math merged eligible /trunk/psLib/test/math merged eligible
-
Property svn:mergeinfo
set to
Note:
See TracChangeset
for help on using the changeset viewer.
