Changeset 9540
- Timestamp:
- Oct 13, 2006, 12:04:58 PM (20 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 9 edited
-
astro/psCoord.c (modified) (9 diffs)
-
math/psMinimizeLMM.c (modified) (4 diffs)
-
math/psMinimizePolyFit.c (modified) (12 diffs)
-
math/psMinimizePowell.c (modified) (2 diffs)
-
math/psPolynomial.c (modified) (2 diffs)
-
math/psSpline.c (modified) (3 diffs)
-
math/psStats.c (modified) (13 diffs)
-
sys/psTrace.c (modified) (8 diffs)
-
sys/psTrace.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r9538 r9540 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.12 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-10-13 2 1:13:47$12 * @version $Revision: 1.125 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-10-13 22:04:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 612 612 { 613 613 psTrace("psLib.astro", 3, "---- %s() begin ----\n", __func__); 614 psTrace("psLib.astro", 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel( __func__));614 psTrace("psLib.astro", 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel("psLib.astro")); 615 615 616 616 PS_ASSERT_PTR_NON_NULL(trans1, NULL); … … 620 620 psTrace("psLib.astro", 5, "trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY); 621 621 psTrace("psLib.astro", 5, "trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY); 622 if (psTraceGetLevel( __func__) >= 6) {622 if (psTraceGetLevel("psLib.astro") >= 6) { 623 623 PS_POLY_PRINT_2D(trans1->x); 624 624 PS_POLY_PRINT_2D(trans1->y); … … 703 703 psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]); 704 704 705 if (psTraceGetLevel( __func__) >= 6) {705 if (psTraceGetLevel("psLib.astro") >= 6) { 706 706 PS_POLY_PRINT_2D(newPoly); 707 707 } … … 714 714 } 715 715 716 if (psTraceGetLevel( __func__) >= 6) {716 if (psTraceGetLevel("psLib.astro") >= 6) { 717 717 PS_POLY_PRINT_2D(myPT->x); 718 718 } … … 721 721 } 722 722 } 723 if (psTraceGetLevel( __func__) >= 6) {723 if (psTraceGetLevel("psLib.astro") >= 6) { 724 724 psTrace("psLib.astro", 6, "The final x-polynomial\n"); 725 725 PS_POLY_PRINT_2D(myPT->x); … … 737 737 psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]); 738 738 739 if (psTraceGetLevel( __func__) >= 6) {739 if (psTraceGetLevel("psLib.astro") >= 6) { 740 740 PS_POLY_PRINT_2D(newPoly); 741 741 } … … 747 747 } 748 748 } 749 if (psTraceGetLevel( __func__) >= 6) {749 if (psTraceGetLevel("psLib.astro") >= 6) { 750 750 PS_POLY_PRINT_2D(myPT->x); 751 751 } … … 754 754 } 755 755 } 756 if (psTraceGetLevel( __func__) >= 6) {756 if (psTraceGetLevel("psLib.astro") >= 6) { 757 757 psTrace("psLib.astro", 6, "The final y-polynomial\n"); 758 758 PS_POLY_PRINT_2D(myPT->y); -
trunk/psLib/src/math/psMinimizeLMM.c
r9538 r9540 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-10-13 2 1:13:48 $12 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-10-13 22:04:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 409 409 } 410 410 // dump some useful info if trace is defined 411 if (psTraceGetLevel( __func__) >= 6) {411 if (psTraceGetLevel("psLib.math") >= 6) { 412 412 p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)"); 413 413 p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)"); … … 438 438 439 439 // dump some useful info if trace is defined 440 if (psTraceGetLevel( __func__) >= 6) {440 if (psTraceGetLevel("psLib.math") >= 6) { 441 441 p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)"); 442 442 p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (1)"); 443 443 p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)"); 444 444 } 445 if (psTraceGetLevel( __func__) >= 6) {445 if (psTraceGetLevel("psLib.math") >= 6) { 446 446 if (psTraceGetLevel (__func__) >= 6) { 447 447 psTrace("psLib.math", 6, "The current Param vector: \n"); … … 470 470 471 471 // dump some useful info if trace is defined 472 if (psTraceGetLevel( __func__) >= 6) {472 if (psTraceGetLevel("psLib.math") >= 6) { 473 473 p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (2)"); 474 474 p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (2)"); -
trunk/psLib/src/math/psMinimizePolyFit.c
r8627 r9540 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2006- 08-26 04:34:28 $12 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-10-13 22:04:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 397 397 psFree(sums); 398 398 399 if (psTraceGetLevel( __func__) >= 6) {399 if (psTraceGetLevel("psLib.math") >= 6) { 400 400 PS_IMAGE_PRINT_F64(A); 401 401 PS_VECTOR_PRINT_F64(B); … … 487 487 } 488 488 489 if (psTraceGetLevel( __func__) >= 6) {489 if (psTraceGetLevel("psLib.math") >= 6) { 490 490 psTrace("psLib.math", 6, "VectorFitPolynomial1D()\n"); 491 491 for (psS32 i = 0; i < f->n; i++) { … … 579 579 psFree(xSums); 580 580 581 if (psTraceGetLevel( __func__) >= 4) {581 if (psTraceGetLevel("psLib.math") >= 4) { 582 582 printf("Least-squares vector:\n"); 583 583 for (int i = 0; i < nTerm; i++) { … … 818 818 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 819 819 psS32 Nkeep = 0; 820 if (psTraceGetLevel( __func__) >= 6) {820 if (psTraceGetLevel("psLib.math") >= 6) { 821 821 if (mask != NULL) { 822 822 for (psS32 i = 0 ; i < mask->n ; i++) { … … 847 847 } 848 848 } 849 if (psTraceGetLevel( __func__) >= 6) {849 if (psTraceGetLevel("psLib.math") >= 6) { 850 850 if (mask != NULL) { 851 851 for (psS32 i = 0 ; i < mask->n ; i++) { … … 1252 1252 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 1253 1253 psS32 Nkeep = 0; 1254 if (psTraceGetLevel( __func__) >= 6) {1254 if (psTraceGetLevel("psLib.math") >= 6) { 1255 1255 if (mask != NULL) { 1256 1256 for (psS32 i = 0 ; i < mask->n ; i++) { … … 1282 1282 } 1283 1283 1284 if (psTraceGetLevel( __func__) >= 6) {1284 if (psTraceGetLevel("psLib.math") >= 6) { 1285 1285 if (mask != NULL) { 1286 1286 for (psS32 i = 0 ; i < mask->n ; i++) { … … 1772 1772 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial1D()\n", N); 1773 1773 psS32 Nkeep = 0; 1774 if (psTraceGetLevel( __func__) >= 6) {1774 if (psTraceGetLevel("psLib.math") >= 6) { 1775 1775 if (mask != NULL) { 1776 1776 for (psS32 i = 0 ; i < mask->n ; i++) { … … 1801 1801 } 1802 1802 1803 if (psTraceGetLevel( __func__) >= 6) {1803 if (psTraceGetLevel("psLib.math") >= 6) { 1804 1804 if (mask != NULL) { 1805 1805 for (psS32 i = 0 ; i < mask->n ; i++) { … … 2340 2340 psTrace("psLib.math", 6, "Loop iteration %d. Calling psVectorFitPolynomial4D()\n", N); 2341 2341 psS32 Nkeep = 0; 2342 if (psTraceGetLevel( __func__) >= 6) {2342 if (psTraceGetLevel("psLib.math") >= 6) { 2343 2343 if (mask != NULL) { 2344 2344 for (psS32 i = 0 ; i < mask->n ; i++) { … … 2370 2370 } 2371 2371 2372 if (psTraceGetLevel( __func__) >= 6) {2372 if (psTraceGetLevel("psLib.math") >= 6) { 2373 2373 if (mask != NULL) { 2374 2374 for (psS32 i = 0 ; i < mask->n ; i++) { -
trunk/psLib/src/math/psMinimizePowell.c
r8245 r9540 11 11 * NOTE: XXX: The SDR is silent about data types. F32 is implemented here. 12 12 * 13 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2006- 08-09 02:26:44$13 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-10-13 22:04:58 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 380 380 } 381 381 382 if (6 <= psTraceGetLevel( __func__)) {382 if (6 <= psTraceGetLevel("psLib.math")) { 383 383 for (i=0;i<params->n;i++) { 384 384 psTrace("psLib.math", 6, "(params, paramMask, line)[%d] is (%f %d %f)\n", i, -
trunk/psLib/src/math/psPolynomial.c
r9538 r9540 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.15 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-10-13 2 1:13:48 $9 * @version $Revision: 1.151 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-10-13 22:04:58 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 189 189 } 190 190 191 if (psTraceGetLevel( __func__) >= 6) {191 if (psTraceGetLevel("psLib.math") >= 6) { 192 192 for (psS32 j = 0; j < numPolys; j++) { 193 193 PS_POLY_PRINT_1D(chebPolys[j]); -
trunk/psLib/src/math/psSpline.c
r9538 r9540 6 6 * This file contains the routines that allocate, free, and evaluate splines. 7 7 * 8 * @version $Revision: 1.15 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-10-13 2 1:13:48 $8 * @version $Revision: 1.155 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-10-13 22:04:58 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 120 120 { 121 121 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 122 if (psTraceGetLevel( __func__) >= 6) {122 if (psTraceGetLevel("psLib.math") >= 6) { 123 123 p_psVectorPrint(1, (psVector *) x, "x"); 124 124 p_psVectorPrint(1, (psVector *) y, "y"); … … 406 406 PS_ASSERT_VECTOR_NON_NULL(x, NULL); 407 407 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL); 408 if (psTraceGetLevel( __func__) >= 6) {408 if (psTraceGetLevel("psLib.math") >= 6) { 409 409 PS_VECTOR_PRINT_F32(x); 410 410 PS_PRINT_SPLINE2((psSpline1D *) spline); -
trunk/psLib/src/math/psStats.c
r9538 r9540 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.18 6$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-10-13 2 1:13:48 $18 * @version $Revision: 1.187 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-10-13 22:04:58 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 480 480 PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL); 481 481 PS_ASSERT_PTR_NON_NULL(histogram->nums, NULL); 482 if (psTraceGetLevel( __func__) >= 8) {482 if (psTraceGetLevel("psLib.math") >= 8) { 483 483 PS_VECTOR_PRINT_F32(histogram->nums); 484 484 } … … 561 561 } 562 562 563 if (psTraceGetLevel( __func__) >= 8) {563 if (psTraceGetLevel("psLib.math") >= 8) { 564 564 PS_VECTOR_PRINT_F32(smooth); 565 565 } … … 705 705 { 706 706 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 707 psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel( __func__));707 psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel("psLib.math")); 708 708 709 709 // Ensure that stats->clipIter is within the proper range. … … 886 886 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 887 887 psTrace("psLib.math", 5, "binNum, yVal is (%d, %f)\n", binNum, yVal); 888 if (psTraceGetLevel( __func__) >= 8) {888 if (psTraceGetLevel("psLib.math") >= 8) { 889 889 PS_VECTOR_PRINT_F32(xVec); 890 890 PS_VECTOR_PRINT_F32(yVec); … … 1058 1058 { 1059 1059 psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__); 1060 if (psTraceGetLevel( __func__) >= 8) {1060 if (psTraceGetLevel("psLib.math") >= 8) { 1061 1061 PS_VECTOR_PRINT_F32(myVector); 1062 1062 } … … 1141 1141 histogram = psHistogramAlloc(min, max, numBins); 1142 1142 histogram = psVectorHistogram(histogram, myVector, errors, mask, maskVal); 1143 if (psTraceGetLevel( __func__) >= 8) {1143 if (psTraceGetLevel("psLib.math") >= 8) { 1144 1144 PS_VECTOR_PRINT_F32(histogram->bounds); 1145 1145 PS_VECTOR_PRINT_F32(histogram->nums); … … 1152 1152 cumulative->nums->data.F32[i] = cumulative->nums->data.F32[i-1] + histogram->nums->data.F32[i]; 1153 1153 } 1154 if (psTraceGetLevel( __func__) >= 8) {1154 if (psTraceGetLevel("psLib.math") >= 8) { 1155 1155 PS_VECTOR_PRINT_F32(cumulative->bounds); 1156 1156 PS_VECTOR_PRINT_F32(cumulative->nums); … … 1417 1417 psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers) 1418 1418 histogram = psVectorHistogram(histogram, myVector, errors, mask, maskVal); 1419 if (psTraceGetLevel( __func__) >= 8) {1419 if (psTraceGetLevel("psLib.math") >= 8) { 1420 1420 PS_VECTOR_PRINT_F32(histogram->nums); 1421 1421 } … … 1423 1423 // Smooth the resulting histogram with a Gaussian with sigma_s = 1 bin. 1424 1424 psVector *smoothed = vectorSmoothHistGaussian(histogram, newBinSize); // Smoothed histogram 1425 if (psTraceGetLevel( __func__) >= 8) {1425 if (psTraceGetLevel("psLib.math") >= 8) { 1426 1426 PS_VECTOR_PRINT_F32(smoothed); 1427 1427 } … … 1496 1496 x->data[j] = ordinate; 1497 1497 } 1498 if (psTraceGetLevel( __func__) >= 8) {1498 if (psTraceGetLevel("psLib.math") >= 8) { 1499 1499 // XXX: Print the x array somehow. 1500 1500 PS_VECTOR_PRINT_F32(y); … … 1525 1525 params->data.F32[0] = stats->robustMedian; 1526 1526 params->data.F32[1] = sigma; 1527 if (psTraceGetLevel( __func__) >= 8) {1527 if (psTraceGetLevel("psLib.math") >= 8) { 1528 1528 PS_VECTOR_PRINT_F32(params); 1529 1529 PS_VECTOR_PRINT_F32(y); … … 1540 1540 return false; 1541 1541 } 1542 if (psTraceGetLevel( __func__) >= 8) {1542 if (psTraceGetLevel("psLib.math") >= 8) { 1543 1543 PS_VECTOR_PRINT_F32(params); 1544 1544 } -
trunk/psLib/src/sys/psTrace.c
r8601 r9540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2006- 08-25 22:01:29$11 * @version $Revision: 1.79 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-10-13 22:04:58 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 69 69 static void componentFree(p_psComponent* comp); 70 70 static p_psComponent* componentAlloc(const char *name, int level); 71 static int getLevel(const char *facil); 71 72 72 73 /***************************************************************************** … … 122 123 } 123 124 } 125 126 // Append the function name to the facility 127 // NB: declares TARGET! 128 #define FACILITY(TARGET, FUNC, FACIL) \ 129 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \ 130 size_t _funcLength = strlen(FUNC); /* Length of function name */ \ 131 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \ 132 strcpy(&TARGET[0], FACIL); \ 133 TARGET[_facilLength] = '.'; \ 134 strcpy(&TARGET[_facilLength + 1], FUNC); 135 124 136 125 137 /***************************************************************************** … … 283 295 compName = (char *) comp; 284 296 } 285 prevLevel = psTraceGetLevel(compName);297 prevLevel = getLevel(compName); 286 298 // Add the new component to the component tree. 287 299 if ( !componentAdd(compName, level) ) { … … 385 397 } 386 398 387 /***************************************************************************** 388 psTraceLevelGet() 399 400 /***************************************************************************** 401 getLevel() 389 402 Return a trace level of "name" in the root component tree. If the 390 403 exact string of components in "name" does not exist in the root 391 404 tree, we return the deepest level of the match. 392 Input: 393 name 394 Output: 395 none 396 Return: 397 The level of "name" in the root component tree. 398 *****************************************************************************/ 399 int psTraceGetLevel(const char *name) 400 { 401 PS_ASSERT_PTR_NON_NULL(name, 0); 402 403 psS32 traceLevel; 404 405 *****************************************************************************/ 406 static int getLevel(const char *name) 407 { 405 408 if (cRoot == NULL) { 406 409 return (PS_UNKNOWN_TRACE_LEVEL); 407 410 } 411 412 psS32 traceLevel; 408 413 409 414 // If the component name has no leading dot, then supply it. … … 430 435 431 436 return(traceLevel); 437 } 438 439 int p_psTraceGetLevel(const char *file, 440 int lineno, 441 const char *func, 442 const char *name) 443 { 444 PS_ASSERT_PTR_NON_NULL(name, 0); 445 PS_ASSERT_PTR_NON_NULL(func, 0); 446 447 FACILITY(facility, func, name); 448 return getLevel(facility); 432 449 } 433 450 … … 520 537 // Only display this message if it's trace level is less than the level 521 538 // of it's associatedcomponent. 522 if (level <= psTraceGetLevel(comp)) {539 if (level <= getLevel(comp)) { 523 540 524 541 char clevel = 0; // letter-name for level … … 641 658 PS_ASSERT_PTR_NON_NULL(format, ); 642 659 643 // XXX file & lineo are currently unused 644 645 // Append the function name to the facility 646 size_t facilLength = strlen(facil); // Length of facility name 647 size_t funcLength = strlen(func); // Length of function name 648 char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name 649 strcpy(&fullFacil[0], facil); 650 fullFacil[facilLength] = '.'; 651 strcpy(&fullFacil[facilLength + 1], func); 660 FACILITY(name, func, facil); 652 661 653 662 va_list ap; 654 663 va_start(ap, format); 655 psTraceV( fullFacil, level, format, ap);664 psTraceV(name, level, format, ap); 656 665 va_end(ap); 657 666 } -
trunk/psLib/src/sys/psTrace.h
r8627 r9540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2006- 08-26 04:34:28 $11 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-10-13 22:04:58 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 89 89 ); 90 90 91 /** Get the trace level 92 * 93 * @return int: Trace Level 94 */ 95 int psTraceGetLevel( 96 const char *facil ///< facilty of interest 97 ); 98 91 99 #else // DOXYGEN 92 100 #ifdef __GNUC__ … … 112 120 ); 113 121 #endif // __GNUC__ 122 123 /** Get the trace level 124 * 125 * @return int: Trace Level 126 */ 127 int p_psTraceGetLevel( 128 const char* file, ///< file name 129 int lineno, ///< line number in file 130 const char *func, ///< function name 131 const char *facil ///< facilty of interest 132 ); 133 114 134 #ifndef SWIG 115 135 #define psTrace(facil, level, ...) p_psTrace(__FILE__,__LINE__,__func__,facil, level, __VA_ARGS__) 136 #define psTraceGetLevel(facil) p_psTraceGetLevel(__FILE__,__LINE__,__func__,facil) 116 137 /** Sends a trace message. */ 117 138 void psTraceV( … … 131 152 const char *facil, ///< facilty of interest 132 153 int level ///< desired trace level 133 );134 135 /** Get the trace level136 *137 * @return int: Trace Level138 */139 int psTraceGetLevel(140 const char *facil ///< facilty of interest141 154 ); 142 155
Note:
See TracChangeset
for help on using the changeset viewer.
