Changeset 2206
- Timestamp:
- Oct 26, 2004, 3:15:47 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 13 edited
-
astro/psCoord.c (modified) (8 diffs)
-
astronomy/psAstrometry.c (modified) (21 diffs)
-
astronomy/psCoord.c (modified) (8 diffs)
-
dataManip/psConstants.h (modified) (2 diffs)
-
dataManip/psMinimize.c (modified) (5 diffs)
-
dataManip/psMinimize.h (modified) (2 diffs)
-
dataManip/psStats.c (modified) (3 diffs)
-
image/psImageStats.c (modified) (4 diffs)
-
imageops/psImageStats.c (modified) (4 diffs)
-
math/psConstants.h (modified) (2 diffs)
-
math/psMinimize.c (modified) (5 diffs)
-
math/psMinimize.h (modified) (2 diffs)
-
math/psStats.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r2204 r2206 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-27 0 0:57:30$12 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 01:15:47 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 81 81 const psPlane* coords) 82 82 { 83 PS_CHECK_NULL_PTR _RETURN_NULL(transform);84 PS_CHECK_NULL_PTR _RETURN_NULL(coords);83 PS_CHECK_NULL_PTR(transform, NULL); 84 PS_CHECK_NULL_PTR(coords, NULL); 85 85 if (out == NULL) { 86 86 out = (psPlane* ) psAlloc(sizeof(psPlane)); … … 117 117 float magnitude) 118 118 { 119 PS_CHECK_NULL_PTR _RETURN_NULL(transform);120 PS_CHECK_NULL_PTR _RETURN_NULL(coords);119 PS_CHECK_NULL_PTR(transform, NULL); 120 PS_CHECK_NULL_PTR(coords, NULL); 121 121 if (out == NULL) { 122 122 out = (psPlane* ) psAlloc(sizeof(psPlane)); … … 156 156 const psSphere* coord) 157 157 { 158 PS_CHECK_NULL_PTR _RETURN_NULL(transform);159 PS_CHECK_NULL_PTR _RETURN_NULL(coord);158 PS_CHECK_NULL_PTR(transform, NULL); 159 PS_CHECK_NULL_PTR(coord, NULL); 160 160 double sinY = 0.0; 161 161 double cosY = 0.0; … … 228 228 const psProjection* projection) 229 229 { 230 PS_CHECK_NULL_PTR _RETURN_NULL(coord);231 PS_CHECK_NULL_PTR _RETURN_NULL(projection);230 PS_CHECK_NULL_PTR(coord, NULL); 231 PS_CHECK_NULL_PTR(projection, NULL); 232 232 233 233 float R = 0.0; … … 280 280 const psProjection* projection) 281 281 { 282 PS_CHECK_NULL_PTR _RETURN_NULL(coord);283 PS_CHECK_NULL_PTR _RETURN_NULL(projection);282 PS_CHECK_NULL_PTR(coord, NULL); 283 PS_CHECK_NULL_PTR(projection, NULL); 284 284 285 285 float R = 0.0; … … 348 348 psSphereOffsetUnit unit) 349 349 { 350 PS_CHECK_NULL_PTR _RETURN_NULL(position1);351 PS_CHECK_NULL_PTR _RETURN_NULL(position2);350 PS_CHECK_NULL_PTR(position1, NULL); 351 PS_CHECK_NULL_PTR(position2, NULL); 352 352 353 353 psPlane* lin; … … 416 416 psSphereOffsetUnit unit) 417 417 { 418 PS_CHECK_NULL_PTR _RETURN_NULL(position);419 PS_CHECK_NULL_PTR _RETURN_NULL(offset);418 PS_CHECK_NULL_PTR(position, NULL); 419 PS_CHECK_NULL_PTR(offset, NULL); 420 420 421 421 psPlane lin; -
trunk/psLib/src/astronomy/psAstrometry.c
r2204 r2206 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-27 0 0:57:30$10 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 01:15:47 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 58 58 static psS32 isProjectionLinear(psPlaneTransform *transform) 59 59 { 60 psS32i = 0;61 PS_CHECK_NULL_PTR _RETURN_ZERO(transform);60 int i = 0; 61 PS_CHECK_NULL_PTR(transform, 0); 62 62 63 63 for (i=2;i<(transform->x->nX);i++) { … … 114 114 double F = transform->y->coeff[0][1]; 115 115 116 PS_CHECK_NULL_PTR _RETURN_NULL(transform);116 PS_CHECK_NULL_PTR(transform, NULL); 117 117 psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform)); 118 118 … … 286 286 const psObservatory* observatory) 287 287 { 288 PS_CHECK_NULL_PTR _RETURN_NULL(observatory);288 PS_CHECK_NULL_PTR(observatory, NULL); 289 289 psExposure* exp = psAlloc(sizeof(psExposure)); 290 290 … … 463 463 psGrommit* psGrommitAlloc(const psExposure* exp) 464 464 { 465 PS_CHECK_NULL_PTR _RETURN_NULL(exp);465 PS_CHECK_NULL_PTR(exp, NULL); 466 466 467 467 double date = psTimeToMJD(exp->time); … … 493 493 const psFPA* FPA) 494 494 { 495 PS_CHECK_NULL_PTR _RETURN_NULL(fpaCoord);496 PS_CHECK_NULL_PTR _RETURN_NULL(FPA);495 PS_CHECK_NULL_PTR(fpaCoord, NULL); 496 PS_CHECK_NULL_PTR(FPA, NULL); 497 497 psChip* tmpChip = NULL; 498 498 psPlane chipCoord; … … 517 517 const psFPA* FPA) 518 518 { 519 PS_CHECK_NULL_PTR _RETURN_NULL(fpaCoord);520 PS_CHECK_NULL_PTR _RETURN_NULL(FPA);521 PS_CHECK_NULL_PTR _RETURN_NULL(FPA->chips);519 PS_CHECK_NULL_PTR(fpaCoord, NULL); 520 PS_CHECK_NULL_PTR(FPA, NULL); 521 PS_CHECK_NULL_PTR(FPA->chips, NULL); 522 522 psArray* chips = FPA->chips; 523 523 psS32 nChips = chips->n; … … 545 545 const psChip* chip) 546 546 { 547 PS_CHECK_NULL_PTR _RETURN_NULL(chipCoord);548 PS_CHECK_NULL_PTR _RETURN_NULL(chip);547 PS_CHECK_NULL_PTR(chipCoord, NULL); 548 PS_CHECK_NULL_PTR(chip, NULL); 549 549 550 550 psPlane cellCoord; … … 588 588 const psCell* cell) 589 589 { 590 PS_CHECK_NULL_PTR _RETURN_NULL(inCoord);591 PS_CHECK_NULL_PTR _RETURN_NULL(cell);590 PS_CHECK_NULL_PTR(inCoord, NULL); 591 PS_CHECK_NULL_PTR(cell, NULL); 592 592 593 593 return (psPlaneTransformApply(outCoord, cell->toChip, inCoord)); … … 598 598 const psChip* chip) 599 599 { 600 PS_CHECK_NULL_PTR _RETURN_NULL(inCoord);601 PS_CHECK_NULL_PTR _RETURN_NULL(chip);600 PS_CHECK_NULL_PTR(inCoord, NULL); 601 PS_CHECK_NULL_PTR(chip, NULL); 602 602 603 603 return (psPlaneTransformApply(outCoord, chip->toFPA, inCoord)); … … 610 610 const psFPA* fpa) 611 611 { 612 PS_CHECK_NULL_PTR _RETURN_NULL(inCoord);613 PS_CHECK_NULL_PTR _RETURN_NULL(fpa);612 PS_CHECK_NULL_PTR(inCoord, NULL); 613 PS_CHECK_NULL_PTR(fpa, NULL); 614 614 615 615 return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord, … … 624 624 const psGrommit* grommit) 625 625 { 626 PS_CHECK_NULL_PTR _RETURN_NULL(tpCoord);627 PS_CHECK_NULL_PTR _RETURN_NULL(grommit);626 PS_CHECK_NULL_PTR(tpCoord, NULL); 627 PS_CHECK_NULL_PTR(grommit, NULL); 628 628 629 629 double AOB = 0.0; … … 644 644 const psCell* cell) 645 645 { 646 PS_CHECK_NULL_PTR _RETURN_NULL(cellCoord);647 PS_CHECK_NULL_PTR _RETURN_NULL(cell);646 PS_CHECK_NULL_PTR(cellCoord, NULL); 647 PS_CHECK_NULL_PTR(cell, NULL); 648 648 649 649 return (psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord)); … … 656 656 const psCell* cell) 657 657 { 658 PS_CHECK_NULL_PTR _RETURN_NULL(cellCoord);659 PS_CHECK_NULL_PTR _RETURN_NULL(cell);658 PS_CHECK_NULL_PTR(cellCoord, NULL); 659 PS_CHECK_NULL_PTR(cell, NULL); 660 660 661 661 psPlane* fpaCoord = NULL; … … 688 688 const psCell* cell) 689 689 { 690 PS_CHECK_NULL_PTR _RETURN_NULL(cellCoord);691 PS_CHECK_NULL_PTR _RETURN_NULL(cell);690 PS_CHECK_NULL_PTR(cellCoord, NULL); 691 PS_CHECK_NULL_PTR(cell, NULL); 692 692 693 693 psPlane *tpCoord = NULL; … … 724 724 const psGrommit* grommit) 725 725 { 726 PS_CHECK_NULL_PTR _RETURN_NULL(in);727 PS_CHECK_NULL_PTR _RETURN_NULL(grommit);726 PS_CHECK_NULL_PTR(in, NULL); 727 PS_CHECK_NULL_PTR(grommit, NULL); 728 728 729 729 char* type = "RA"; … … 745 745 const psFPA* fpa) 746 746 { 747 PS_CHECK_NULL_PTR _RETURN_NULL(tpCoord);748 PS_CHECK_NULL_PTR _RETURN_NULL(fpa);747 PS_CHECK_NULL_PTR(tpCoord, NULL); 748 PS_CHECK_NULL_PTR(fpa, NULL); 749 749 750 750 return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane, … … 756 756 const psChip* chip) 757 757 { 758 PS_CHECK_NULL_PTR _RETURN_NULL(fpaCoord);759 PS_CHECK_NULL_PTR _RETURN_NULL(chip);760 PS_CHECK_NULL_PTR _RETURN_NULL(chip->parent);758 PS_CHECK_NULL_PTR(fpaCoord, NULL); 759 PS_CHECK_NULL_PTR(chip, NULL); 760 PS_CHECK_NULL_PTR(chip->parent, NULL); 761 761 762 762 chipCoord = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord); … … 768 768 const psCell* cell) 769 769 { 770 PS_CHECK_NULL_PTR _RETURN_NULL(chipCoord);771 PS_CHECK_NULL_PTR _RETURN_NULL(cell);772 PS_CHECK_NULL_PTR _RETURN_NULL(cell->parent);770 PS_CHECK_NULL_PTR(chipCoord, NULL); 771 PS_CHECK_NULL_PTR(cell, NULL); 772 PS_CHECK_NULL_PTR(cell->parent, NULL); 773 773 774 774 cellCoord = psPlaneTransformApply(cellCoord, cell->fromChip, chipCoord); … … 782 782 const psCell* cell) 783 783 { 784 PS_CHECK_NULL_PTR _RETURN_NULL(skyCoord);785 PS_CHECK_NULL_PTR _RETURN_NULL(cell);784 PS_CHECK_NULL_PTR(skyCoord, NULL); 785 PS_CHECK_NULL_PTR(cell, NULL); 786 786 787 787 psChip *parChip = cell->parent; … … 813 813 const psCell* cell) 814 814 { 815 PS_CHECK_NULL_PTR _RETURN_NULL(skyCoord);816 PS_CHECK_NULL_PTR _RETURN_NULL(cell);815 PS_CHECK_NULL_PTR(skyCoord, NULL); 816 PS_CHECK_NULL_PTR(cell, NULL); 817 817 818 818 psPlane *tpCoord = NULL; -
trunk/psLib/src/astronomy/psCoord.c
r2204 r2206 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-27 0 0:57:30$12 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 01:15:47 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 81 81 const psPlane* coords) 82 82 { 83 PS_CHECK_NULL_PTR _RETURN_NULL(transform);84 PS_CHECK_NULL_PTR _RETURN_NULL(coords);83 PS_CHECK_NULL_PTR(transform, NULL); 84 PS_CHECK_NULL_PTR(coords, NULL); 85 85 if (out == NULL) { 86 86 out = (psPlane* ) psAlloc(sizeof(psPlane)); … … 117 117 float magnitude) 118 118 { 119 PS_CHECK_NULL_PTR _RETURN_NULL(transform);120 PS_CHECK_NULL_PTR _RETURN_NULL(coords);119 PS_CHECK_NULL_PTR(transform, NULL); 120 PS_CHECK_NULL_PTR(coords, NULL); 121 121 if (out == NULL) { 122 122 out = (psPlane* ) psAlloc(sizeof(psPlane)); … … 156 156 const psSphere* coord) 157 157 { 158 PS_CHECK_NULL_PTR _RETURN_NULL(transform);159 PS_CHECK_NULL_PTR _RETURN_NULL(coord);158 PS_CHECK_NULL_PTR(transform, NULL); 159 PS_CHECK_NULL_PTR(coord, NULL); 160 160 double sinY = 0.0; 161 161 double cosY = 0.0; … … 228 228 const psProjection* projection) 229 229 { 230 PS_CHECK_NULL_PTR _RETURN_NULL(coord);231 PS_CHECK_NULL_PTR _RETURN_NULL(projection);230 PS_CHECK_NULL_PTR(coord, NULL); 231 PS_CHECK_NULL_PTR(projection, NULL); 232 232 233 233 float R = 0.0; … … 280 280 const psProjection* projection) 281 281 { 282 PS_CHECK_NULL_PTR _RETURN_NULL(coord);283 PS_CHECK_NULL_PTR _RETURN_NULL(projection);282 PS_CHECK_NULL_PTR(coord, NULL); 283 PS_CHECK_NULL_PTR(projection, NULL); 284 284 285 285 float R = 0.0; … … 348 348 psSphereOffsetUnit unit) 349 349 { 350 PS_CHECK_NULL_PTR _RETURN_NULL(position1);351 PS_CHECK_NULL_PTR _RETURN_NULL(position2);350 PS_CHECK_NULL_PTR(position1, NULL); 351 PS_CHECK_NULL_PTR(position2, NULL); 352 352 353 353 psPlane* lin; … … 416 416 psSphereOffsetUnit unit) 417 417 { 418 PS_CHECK_NULL_PTR _RETURN_NULL(position);419 PS_CHECK_NULL_PTR _RETURN_NULL(offset);418 PS_CHECK_NULL_PTR(position, NULL); 419 PS_CHECK_NULL_PTR(offset, NULL); 420 420 421 421 psPlane lin; -
trunk/psLib/src/dataManip/psConstants.h
r2204 r2206 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-27 0 0:57:31$8 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 01:15:47 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 94 94 95 95 /** Preprocessor macro to generate error on an incorrect type */ 96 #define PS_CHECK_VECTOR_TYPE _RETURN_NULL(NAME, TYPE) \96 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE, RVAL) \ 97 97 if (NAME->type.type != TYPE) { \ 98 98 psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \ 99 return( NULL); \99 return(RVAL); \ 100 100 } 101 101 102 102 /** Preprocessor macro to generate error on a NULL vector */ 103 #define PS_CHECK_NULL_VECTOR _RETURN_NULL(NAME) \103 #define PS_CHECK_NULL_VECTOR(NAME, RVAL) \ 104 104 if (NAME == NULL || NAME->data.V == NULL) { \ 105 105 psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \ 106 return(NULL); \ 107 } \ 108 109 /** Preprocessor macro to generate error on a NULL vector */ 110 #define PS_CHECK_NULL_VECTOR_RETURN_F0(NAME) \ 111 if (NAME == NULL || NAME->data.V == NULL) { \ 112 psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \ 113 return(0.0); \ 106 return(RVAL); \ 114 107 } \ 115 108 116 109 /** Preprocessor macro to generate error on a NULL poniter */ 117 #define PS_CHECK_NULL_PTR _RETURN_NULL(NAME) \110 #define PS_CHECK_NULL_PTR(NAME, RVAL) \ 118 111 if (NAME == NULL) { \ 119 112 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 120 return(NULL); \ 121 } 122 123 /** Preprocessor macro to generate error on a NULL poniter */ 124 #define PS_CHECK_NULL_PTR_RETURN_F0(NAME) \ 125 if (NAME == NULL) { \ 126 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 127 return(0.0); \ 128 } 129 130 /** Preprocessor macro to generate error on a NULL poniter */ 131 #define PS_CHECK_NULL_PTR_RETURN_ZERO(NAME) \ 132 if (NAME == NULL) { \ 133 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 134 return(0); \ 135 } 113 return(RVAL); \ 114 } 115 116 136 117 137 118 /** Preprocessor macro to generate error for zero length vector */ -
trunk/psLib/src/dataManip/psMinimize.c
r2204 r2206 7 7 * fit a 1-D polynomial to a set of data points. 8 8 * 9 * @author GL F, MHPCC9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 252 252 static psVector *yErr32Static = NULL; 253 253 254 PS_CHECK_NULL_PTR _RETURN_NULL(mySpline);255 PS_CHECK_NULL_PTR _RETURN_NULL(y);254 PS_CHECK_NULL_PTR(mySpline, NULL); 255 PS_CHECK_NULL_PTR(y, NULL); 256 256 VECTOR_CHECK_TYPE_F32_OR_F64_RETURN_NULL(y); 257 257 CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static); … … 425 425 psMinimizeLMChi2Func func) 426 426 { 427 PS_CHECK_NULL_PTR _RETURN_NULL(min);428 PS_CHECK_NULL_VECTOR _RETURN_NULL(params);427 PS_CHECK_NULL_PTR(min, NULL); 428 PS_CHECK_NULL_VECTOR(params, NULL); 429 429 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params); 430 PS_CHECK_NULL_PTR _RETURN_NULL(x);431 PS_CHECK_NULL_VECTOR _RETURN_NULL(y);430 PS_CHECK_NULL_PTR(x, NULL); 431 PS_CHECK_NULL_VECTOR(y, NULL); 432 432 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y); 433 433 PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y); … … 856 856 psPolynomial1D *tmpPoly; 857 857 PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly); 858 PS_CHECK_NULL_VECTOR _RETURN_NULL(y);858 PS_CHECK_NULL_VECTOR(y, NULL); 859 859 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y); 860 860 psVector *x64 = NULL; … … 1319 1319 psMinimizePowellFunc func) 1320 1320 { 1321 PS_CHECK_NULL_VECTOR _RETURN_NULL(params);1321 PS_CHECK_NULL_VECTOR(params, NULL); 1322 1322 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params); 1323 PS_CHECK_NULL_PTR _RETURN_NULL(min);1324 PS_CHECK_NULL_PTR _RETURN_NULL(coords);1325 PS_CHECK_NULL_PTR _RETURN_NULL(func);1323 PS_CHECK_NULL_PTR(min, NULL); 1324 PS_CHECK_NULL_PTR(coords, NULL); 1325 PS_CHECK_NULL_PTR(func, NULL); 1326 1326 1327 1327 psS32 numDims = params->n; -
trunk/psLib/src/dataManip/psMinimize.h
r2204 r2206 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-27 0 0:57:31$10 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 01:15:47 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 const psArray *x); 89 89 90 /* 91 psVector *psMinimizeLMChi2Gauss1D(psImage *deriv, 92 const psVector *params, 93 const psArray *coords) 94 { 95 psVector *x = (psVector *) coords->data[0]; 96 psVector *y = (psVector *) coords->data[1]; 97 psVector *yErr = NULL; 98 int i; 99 int j; 100 float normalization = params->data.F32[0]; 101 float center = params->data.F32[1]; 102 float stdev = params->data.F32[2]; 103 psVector *out = psVectorAlloc(x->n, PS_TYPE_F32); 104 105 106 if (deriv == NULL) { 107 deriv = psImageAlloc(params->n, x->n, PS_TYPE_F32); 108 } 109 110 if (coords->n == 2) { 111 yErr = (psVector *) coords->data[2]; 112 } 113 114 for (i=0;i<x->n;i++) { 115 out->data.F32[i] = psGaussian(x->data.F32[i], center, stdev, 1); 116 } 117 118 for (i=0;i<x->n;i++) { 119 for (j=0;j<params->n;j++) { 120 deriv->data.F32[i][j] = the derivative of the gaussian w.r.t. the j-th parameter at the coord x[i] 121 } 122 } 123 return(out); 124 } 125 */ 126 90 127 psBool psMinimizeLMChi2(psMinimization *min, 91 128 psImage *covar, -
trunk/psLib/src/dataManip/psStats.c
r2204 r2206 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1. 69$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.70 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1733 1733 return(stats); 1734 1734 } 1735 PS_CHECK_NULL_PTR _RETURN_NULL(stats);1735 PS_CHECK_NULL_PTR(stats, NULL); 1736 1736 1737 1737 inF32 = p_psConvertToF32((psVector *) in); … … 1747 1747 if (mask != NULL) { 1748 1748 PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(mask, in); 1749 PS_CHECK_VECTOR_TYPE _RETURN_NULL(mask, PS_TYPE_U8);1749 PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8, NULL); 1750 1750 } 1751 1751 // ************************************************************************ -
trunk/psLib/src/image/psImageStats.c
r2204 r2206 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 101 101 NOTE: We assume that the psHistogram structure out has already been 102 102 allocated and initialized. 103 NOTE: verify that image/mask have the , correct types andsizes.103 NOTE: verify that image/mask have the correct types and sizes. 104 104 *****************************************************************************/ 105 105 psHistogram* psImageHistogram(psHistogram* out, … … 112 112 113 113 // NOTE: Verify this action. 114 PS_CHECK_NULL_PTR _RETURN_NULL(out);115 PS_CHECK_NULL_PTR _RETURN_NULL(in);114 PS_CHECK_NULL_PTR(out, NULL); 115 PS_CHECK_NULL_PTR(in, NULL); 116 116 117 117 junkData = psAlloc(sizeof(psVector)); … … 171 171 p_psCalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the 172 172 interval [-1.0 : 1.0]. Images typically have sizes of 512x512 or more. In 173 order to use Chebyshev polynomials, we must scale sthe coordinates from173 order to use Chebyshev polynomials, we must scale the coordinates from 174 174 0:512 to -1:1. This routine takes as input an integer N and produces as 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. -
trunk/psLib/src/imageops/psImageStats.c
r2204 r2206 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 101 101 NOTE: We assume that the psHistogram structure out has already been 102 102 allocated and initialized. 103 NOTE: verify that image/mask have the , correct types andsizes.103 NOTE: verify that image/mask have the correct types and sizes. 104 104 *****************************************************************************/ 105 105 psHistogram* psImageHistogram(psHistogram* out, … … 112 112 113 113 // NOTE: Verify this action. 114 PS_CHECK_NULL_PTR _RETURN_NULL(out);115 PS_CHECK_NULL_PTR _RETURN_NULL(in);114 PS_CHECK_NULL_PTR(out, NULL); 115 PS_CHECK_NULL_PTR(in, NULL); 116 116 117 117 junkData = psAlloc(sizeof(psVector)); … … 171 171 p_psCalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the 172 172 interval [-1.0 : 1.0]. Images typically have sizes of 512x512 or more. In 173 order to use Chebyshev polynomials, we must scale sthe coordinates from173 order to use Chebyshev polynomials, we must scale the coordinates from 174 174 0:512 to -1:1. This routine takes as input an integer N and produces as 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. -
trunk/psLib/src/math/psConstants.h
r2204 r2206 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-27 0 0:57:31$8 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 01:15:47 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 94 94 95 95 /** Preprocessor macro to generate error on an incorrect type */ 96 #define PS_CHECK_VECTOR_TYPE _RETURN_NULL(NAME, TYPE) \96 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE, RVAL) \ 97 97 if (NAME->type.type != TYPE) { \ 98 98 psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \ 99 return( NULL); \99 return(RVAL); \ 100 100 } 101 101 102 102 /** Preprocessor macro to generate error on a NULL vector */ 103 #define PS_CHECK_NULL_VECTOR _RETURN_NULL(NAME) \103 #define PS_CHECK_NULL_VECTOR(NAME, RVAL) \ 104 104 if (NAME == NULL || NAME->data.V == NULL) { \ 105 105 psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \ 106 return(NULL); \ 107 } \ 108 109 /** Preprocessor macro to generate error on a NULL vector */ 110 #define PS_CHECK_NULL_VECTOR_RETURN_F0(NAME) \ 111 if (NAME == NULL || NAME->data.V == NULL) { \ 112 psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \ 113 return(0.0); \ 106 return(RVAL); \ 114 107 } \ 115 108 116 109 /** Preprocessor macro to generate error on a NULL poniter */ 117 #define PS_CHECK_NULL_PTR _RETURN_NULL(NAME) \110 #define PS_CHECK_NULL_PTR(NAME, RVAL) \ 118 111 if (NAME == NULL) { \ 119 112 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 120 return(NULL); \ 121 } 122 123 /** Preprocessor macro to generate error on a NULL poniter */ 124 #define PS_CHECK_NULL_PTR_RETURN_F0(NAME) \ 125 if (NAME == NULL) { \ 126 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 127 return(0.0); \ 128 } 129 130 /** Preprocessor macro to generate error on a NULL poniter */ 131 #define PS_CHECK_NULL_PTR_RETURN_ZERO(NAME) \ 132 if (NAME == NULL) { \ 133 psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \ 134 return(0); \ 135 } 113 return(RVAL); \ 114 } 115 116 136 117 137 118 /** Preprocessor macro to generate error for zero length vector */ -
trunk/psLib/src/math/psMinimize.c
r2204 r2206 7 7 * fit a 1-D polynomial to a set of data points. 8 8 * 9 * @author GL F, MHPCC9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 252 252 static psVector *yErr32Static = NULL; 253 253 254 PS_CHECK_NULL_PTR _RETURN_NULL(mySpline);255 PS_CHECK_NULL_PTR _RETURN_NULL(y);254 PS_CHECK_NULL_PTR(mySpline, NULL); 255 PS_CHECK_NULL_PTR(y, NULL); 256 256 VECTOR_CHECK_TYPE_F32_OR_F64_RETURN_NULL(y); 257 257 CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static); … … 425 425 psMinimizeLMChi2Func func) 426 426 { 427 PS_CHECK_NULL_PTR _RETURN_NULL(min);428 PS_CHECK_NULL_VECTOR _RETURN_NULL(params);427 PS_CHECK_NULL_PTR(min, NULL); 428 PS_CHECK_NULL_VECTOR(params, NULL); 429 429 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params); 430 PS_CHECK_NULL_PTR _RETURN_NULL(x);431 PS_CHECK_NULL_VECTOR _RETURN_NULL(y);430 PS_CHECK_NULL_PTR(x, NULL); 431 PS_CHECK_NULL_VECTOR(y, NULL); 432 432 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y); 433 433 PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y); … … 856 856 psPolynomial1D *tmpPoly; 857 857 PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly); 858 PS_CHECK_NULL_VECTOR _RETURN_NULL(y);858 PS_CHECK_NULL_VECTOR(y, NULL); 859 859 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y); 860 860 psVector *x64 = NULL; … … 1319 1319 psMinimizePowellFunc func) 1320 1320 { 1321 PS_CHECK_NULL_VECTOR _RETURN_NULL(params);1321 PS_CHECK_NULL_VECTOR(params, NULL); 1322 1322 PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params); 1323 PS_CHECK_NULL_PTR _RETURN_NULL(min);1324 PS_CHECK_NULL_PTR _RETURN_NULL(coords);1325 PS_CHECK_NULL_PTR _RETURN_NULL(func);1323 PS_CHECK_NULL_PTR(min, NULL); 1324 PS_CHECK_NULL_PTR(coords, NULL); 1325 PS_CHECK_NULL_PTR(func, NULL); 1326 1326 1327 1327 psS32 numDims = params->n; -
trunk/psLib/src/math/psMinimize.h
r2204 r2206 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-27 0 0:57:31$10 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 01:15:47 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 const psArray *x); 89 89 90 /* 91 psVector *psMinimizeLMChi2Gauss1D(psImage *deriv, 92 const psVector *params, 93 const psArray *coords) 94 { 95 psVector *x = (psVector *) coords->data[0]; 96 psVector *y = (psVector *) coords->data[1]; 97 psVector *yErr = NULL; 98 int i; 99 int j; 100 float normalization = params->data.F32[0]; 101 float center = params->data.F32[1]; 102 float stdev = params->data.F32[2]; 103 psVector *out = psVectorAlloc(x->n, PS_TYPE_F32); 104 105 106 if (deriv == NULL) { 107 deriv = psImageAlloc(params->n, x->n, PS_TYPE_F32); 108 } 109 110 if (coords->n == 2) { 111 yErr = (psVector *) coords->data[2]; 112 } 113 114 for (i=0;i<x->n;i++) { 115 out->data.F32[i] = psGaussian(x->data.F32[i], center, stdev, 1); 116 } 117 118 for (i=0;i<x->n;i++) { 119 for (j=0;j<params->n;j++) { 120 deriv->data.F32[i][j] = the derivative of the gaussian w.r.t. the j-th parameter at the coord x[i] 121 } 122 } 123 return(out); 124 } 125 */ 126 90 127 psBool psMinimizeLMChi2(psMinimization *min, 91 128 psImage *covar, -
trunk/psLib/src/math/psStats.c
r2204 r2206 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1. 69$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-27 0 0:57:31$11 * @version $Revision: 1.70 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 01:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1733 1733 return(stats); 1734 1734 } 1735 PS_CHECK_NULL_PTR _RETURN_NULL(stats);1735 PS_CHECK_NULL_PTR(stats, NULL); 1736 1736 1737 1737 inF32 = p_psConvertToF32((psVector *) in); … … 1747 1747 if (mask != NULL) { 1748 1748 PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(mask, in); 1749 PS_CHECK_VECTOR_TYPE _RETURN_NULL(mask, PS_TYPE_U8);1749 PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8, NULL); 1750 1750 } 1751 1751 // ************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.
