Changeset 796 for trunk/psLib/src/dataManip/psStats.h
- Timestamp:
- May 27, 2004, 2:17:33 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataManip/psStats.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psStats.h
r729 r796 1 1 #if !defined(PS_STATS_H) 2 2 #define PS_STATS_H 3 3 /****************************************************************************** 4 This file will histogram/statistical functions and data structures. 5 *****************************************************************************/ 4 6 /** \file psStats.h 5 7 * \brief basic statistical operations … … 7 9 */ 8 10 #include "psVector.h" 9 10 /** statistics which may be calculated */ 11 /****************************************************************************** 12 Statistical functions and data structures. 13 *****************************************************************************/ 11 14 typedef enum { 12 15 PS_STAT_SAMPLE_MEAN = 0x000001, 13 16 PS_STAT_SAMPLE_MEDIAN = 0x000002, 14 17 PS_STAT_SAMPLE_STDEV = 0x000004, 15 PS_STAT_SAMPLE_UQ = 0x000008, 16 PS_STAT_SAMPLE_LQ = 0x000010, 17 PS_STAT_ROBUST_MEAN = 0x000020, 18 PS_STAT_ROBUST_MEAN_NVALUES = 0x000040, 19 PS_STAT_ROBUST_MEDIAN = 0x000080, 20 PS_STAT_ROBUST_MEDIAN_NVALUES = 0x000100, 21 PS_STAT_ROBUST_MODE = 0x000200, 22 PS_STAT_ROBUST_MODE_NVALUES = 0x000400, 23 PS_STAT_ROBUST_STDEV = 0x000800, 24 PS_STAT_ROBUST_UQ = 0x001000, 25 PS_STAT_ROBUST_LQ = 0x002000, 26 PS_STAT_CLIPPED_MEAN = 0x004000, 27 PS_STAT_CLIPPED_MEAN_NVALUES = 0x008000, 28 PS_STAT_CLIPPED_MEAN_NSIGMA = 0x010000, 29 PS_STAT_CLIPPED_STDEV = 0x020000, 30 PS_STAT_MAX = 0x040000, 31 PS_STAT_MIN = 0x080000, 32 PS_STAT_NVALUES = 0x100000 18 PS_STAT_SAMPLE_QUARTILE = 0x000008, 19 PS_STAT_ROBUST_MEAN = 0x000010, 20 PS_STAT_ROBUST_MEDIAN = 0x000020, 21 PS_STAT_ROBUST_MODE = 0x000040, 22 PS_STAT_ROBUST_STDEV = 0x000080, 23 PS_STAT_ROBUST_QUARTILE = 0x000100, 24 PS_STAT_CLIPPED_MEAN = 0x000200, 25 PS_STAT_CLIPPED_STDEV = 0x000400, 26 PS_STAT_MAX = 0x000800, 27 PS_STAT_MIN = 0x001000, 28 PS_STAT_USE_RANGE = 0x002000, 29 PS_STAT_USE_BINSIZE = 0x004000, 30 PS_STAT_ROBUST_FOR_SAMPLE = 0x008000 33 31 } psStatsOptions; 34 32 … … 42 40 double sampleUQ; ///< upper quartile of sample 43 41 double sampleLQ; ///< lower quartile of sample 42 double sampleLimit; ///< 44 43 double robustMean; ///< robust mean of array 45 44 int robustMeanNvalues; ///< number of measurements used for robust mean 46 45 double robustMedian; ///< robust median of array 47 int robustMedianNvalues; ///< number of measurements used for robust median48 46 double robustMode; ///< Robust mode of array 49 int robustModeNvalues; ///< Number of measurements used for robust mode50 47 double robustStdev; ///< robust standard deviation of array 51 48 double robustUQ; ///< robust upper quartile 52 49 double robustLQ; ///< robust lower quartile 50 double robustN50; ///< 51 double robustNfit; ///< 53 52 double clippedMean; ///< Nsigma clipped mean 54 int clippedMeanNvalues; ///< number of data points used for clipped mean55 53 double clippedStdev; ///< standard deviation after clipping 56 54 double clipSigma; ///< Nsigma used for clipping; user input … … 58 56 double min; ///< minimum data value in array 59 57 double max; ///< maximum data value in array 60 int nValues; ///< number of data values in array58 double binsize; ///< 61 59 psStatsOptions options; ///< bitmask of calculated values 62 60 } … … 66 64 /** Do Statistics on an array. Returns a status value. \ingroup MathGroup */ 67 65 psStats * 68 ps ArrayStats(const psVector *restrict myVector, ///< Vector to be analysed: must be FLOAT69 const psVector *restrict maskVector, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL70 unsigned int maskVal, ///< Only mask elements with one of these bits set in maskVector71 psStats *stats ///< stats structure defines stats to be calculated and how72 );66 psVectorStats(psStats *stats, ///< stats structure defines stats to be calculated and how 67 psVector *in, ///< Vector to be analysed: must be F32 68 psVector *mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 69 unsigned int maskVal ///< Only mask elements with one of these bits set in maskVector 70 ); 73 71 74 72 /** Constructor */ 75 psStats * 76 psStatsAlloc(psStatsOptions options ///< Statistics to measure 77 ); 73 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure 78 74 79 75 /** Destructor */ 80 void 81 psStatsFree(psStats *restrict stats ///< Stats structure to destroy 82 ); 76 void psStatsFree(psStats *restrict stats); ///< Stats structure to destroy 83 77 84 /** Histograms */ 85 // NOTE: I added the numBins member. Must consult with IfA on this. 78 /****************************************************************************** 79 Histogram functions and data structures. 80 *****************************************************************************/ 86 81 typedef struct 87 82 { 88 const psVector *restrict lower; ///< Lower bounds for the bins (FLOAT) 89 const psVector *restrict upper; ///< Upper bounds for the bins (FLOAT) 90 psVector *nums; ///< Number in each of the bins (INT) 91 float minVal; 92 float maxVal; ///< Minimum and maximum values 93 int minNum; 94 int maxNum; ///< Number below the minimum and above the maximum 95 int numBins; ///< Number of bins in this histogram. 83 const psVector *restrict bounds; ///< Bounds for the bins (type F32) 84 psVector *nums; ///< Number in each of the bins (INT) 85 int minNum; ///< Number below the minimum 86 int maxNum; ///< Number above the maximum 87 int uniform; ///< Is it a uniform distribution? 96 88 } 97 89 psHistogram; 90 98 91 99 92 /** Constructor \ingroup MathGroup */ … … 101 94 psHistogramAlloc(float lower, ///< Lower limit for the bins 102 95 float upper, ///< Upper limit for the bins 103 float size ///< Size of thebins104 ); 96 int n); ///< Number of bins 97 105 98 106 99 /** Generic constructor \ingroup MathGroup */ 107 psHistogram * 108 psHistogramAllocGeneric(const psVector *restrict lower, ///< Lower bounds for the bins 109 const psVector *restrict upper, ///< Upper bounds for the bins 110 float minVal, ///< Minimum value 111 float maxVal ///< Maximum value 112 ); 100 psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins 101 113 102 114 103 /** Destructor \ingroup MathGroup **/ 115 void 116 psHistogramFree(psHistogram *restrict myHist ///< Histogram to destroy 117 ); 104 void psHistogramFree(psHistogram *restrict myHist); ///< Histogram to destroy 118 105 119 106 120 107 /** Calculate a histogram \ingroup MathGroup **/ 121 psHistogram * 122 psGetArrayHistogram(psHistogram *restrict myHist, ///< Histogram data 123 const psVector *restrict myVector ///< Vector to analyse 124 ); 108 psHistogram *psHistogramVector (psHistogram *out, ///< Histogram data 109 psVector *in, ///< Vector to analyse 110 psVector *mask, ///< Mask dat for input vector 111 int maskVal); ///< Mask value 112 125 113 126 114 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
