Changeset 2273 for trunk/psLib/src/math/psStats.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r2269 r2273 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-0 3 03:30:30$11 * @version $Revision: 1.85 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-04 01:04:59 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include "psFunctions.h" 35 35 #include "psConstants.h" 36 37 #include "psDataManipErrors.h" 36 38 37 39 /*****************************************************************************/ … … 735 737 736 738 // Ensure that stats->clipIter is within the proper range. 737 if (!((PS_CLIPPED_NUM_ITER_LB <= stats->clipIter) && (stats->clipIter <= PS_CLIPPED_NUM_ITER_UB))) { 738 psError(__func__, "Unallowed value for clipIter (%d).\n", stats->clipIter); 739 return(-1); 740 } 739 PS_INT_CHECK_RANGE(stats->clipIter,PS_CLIPPED_NUM_ITER_LB,PS_CLIPPED_NUM_ITER_UB,-1); 740 741 741 // Ensure that stats->clipSigma is within the proper range. 742 if (!((PS_CLIPPED_SIGMA_LB <= stats->clipSigma) && (stats->clipSigma <= PS_CLIPPED_SIGMA_UB))) { 743 psError(__func__, "Unallowed value for clipSigma (%f).\n", stats->clipSigma); 744 return(-1); 745 } 742 PS_INT_CHECK_RANGE(stats->clipSigma,PS_CLIPPED_SIGMA_LB,PS_CLIPPED_SIGMA_UB,-1); 743 746 744 // We allocate a temporary mask vector since during the iterative 747 745 // steps that follow, we will be masking off additional data points. … … 869 867 p_psNormalizeVectorRangeF64(myData, low, high); 870 868 } else { 871 psError(__func__, "Unalowable data type.\n"); 869 char* strType; 870 PS_TYPE_NAME(strType,myData->type.type); 871 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 872 PS_ERRORTEXT_psStats_NOT_F32_F64, 873 strType); 872 874 } 873 875 } … … 954 956 // Ensure that yVal is within the range of the bins we are using. 955 957 if (!((y->data.F64[0] <= yVal) && (yVal <= y->data.F64[2]))) { 956 printf("((%f), %f, %f)\n", yVal, y->data.F64[0], y->data.F64[2]); 957 psError(__func__, "yVal not within y-range\n"); 958 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 959 PS_ERRORTEXT_psStats_YVAL_OUT_OF_RANGE, 960 (double)yVal,y->data.F64[2],y->data.F64[0]); 958 961 } 959 962 yErr->data.F64[0] = 1.0; … … 1113 1116 1114 1117 if ((LQBinNum < 0) || (UQBinNum < 0)) { 1115 psError(__func__, "Could not determine the robust lower/upper quartile bin numbers."); 1118 psError(PS_ERR_UNKNOWN, true, 1119 PS_ERRORTEXT_psStats_ROBUST_QUARTILE_BINS_FAILED); 1116 1120 return(1); 1117 1121 } 1118 1122 if (medianBinNum < 0) { 1119 psError(__func__, "Could not determine the robust lower/upper quartile bin numbers."); 1123 psError(PS_ERR_UNKNOWN, true, 1124 PS_ERRORTEXT_psStats_ROBUST_QUARTILE_BINS_FAILED); 1120 1125 return(1); 1121 1126 } … … 1174 1179 psVector *y = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32); 1175 1180 1176 p _psNormalizeVectorRange(robustHistogramVector, 0.0, 1.0);1181 psNormalizeVectorRange(robustHistogramVector, 0.0, 1.0); 1177 1182 for (i=0;i<robustHistogramVector->n;i++) { 1178 1183 myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32); … … 1536 1541 // do nothing 1537 1542 } else { 1538 psError(__func__, "unsupported vector type 0x%x\n", in->type.type); 1543 char* strType; 1544 PS_TYPE_NAME(strType,in->type.type); 1545 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 1546 PS_ERRORTEXT_psStats_VECTOR_TYPE_UNSUPPORTED, 1547 strType); 1539 1548 } 1540 1549 return (tmp); … … 1603 1612 (stats->options & PS_STAT_ROBUST_STDEV) || (stats->options & PS_STAT_ROBUST_QUARTILE)) { 1604 1613 if (0 != p_psVectorRobustStats(inF32, mask, maskVal, stats)) { 1605 psError(__func__, "p_psVectorRobustStats() failed.\n"); 1614 psError(PS_ERR_UNKNOWN, false, 1615 PS_ERRORTEXT_psStats_STATS_FAILED); 1606 1616 } 1607 1617 } … … 1609 1619 if ((stats->options & PS_STAT_CLIPPED_MEAN) || (stats->options & PS_STAT_CLIPPED_STDEV)) { 1610 1620 if (0 != p_psVectorClippedStats(inF32, mask, maskVal, stats)) { 1611 psError(__func__, "p_psVectorClippedStats() failed.\n"); 1621 psError(PS_ERR_UNKNOWN, false, 1622 "Failed to calculate statistics for input psVector."); 1612 1623 } 1613 1624 }
Note:
See TracChangeset
for help on using the changeset viewer.
