Changeset 136
- Timestamp:
- 12/23/04 13:58:08 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MathUtils.cc
r125 r136 33 33 #include <casa/Arrays/Vector.h> 34 34 #include <casa/Arrays/VectorSTLIterator.h> 35 #include <casa/Arrays/MaskArrMath.h> 36 #include <casa/BasicSL/String.h> 35 37 36 38 #include "MathUtils.h" … … 90 92 } 91 93 } 94 95 96 float mathutil::statistics (const std::string& which, const MaskedArray<Float>& data) 97 { 98 String str(which); 99 str.upcase(); 100 if (str.contains(String("MIN"))) { 101 return min(data); 102 } else if (str.contains(String("MAX"))) { 103 return max(data); 104 } else if (str.contains(String("SUMSQ"))) { 105 return sumsquares(data); 106 } else if (str.contains(String("SUM"))) { 107 return sum(data); 108 } else if (str.contains(String("MEAN"))) { 109 return mean(data); 110 } else if (str.contains(String("VAR"))) { 111 return variance(data); 112 } else if (str.contains(String("STDDEV"))) { 113 return stddev(data); 114 } else if (str.contains(String("AVDEV"))) { 115 return avdev(data); 116 } else if (str.contains(String("RMS"))) { 117 uInt n = data.nelementsValid(); 118 return sqrt(sumsquares(data)/n); 119 } else if (str.contains(String("MED"))) { 120 return median(data); 121 } 122 } 123 -
trunk/src/MathUtils.h
r125 r136 42 42 casa::Bool relaxed=False, casa::Bool ignoreOther=False); 43 43 44 float statistics (const std::string& which, const casa::MaskedArray<casa::Float>& data); 44 45 }; 45 46
Note:
See TracChangeset
for help on using the changeset viewer.