Changeset 829 for trunk/src/MathUtils.cc
- Timestamp:
- 02/17/06 15:04:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MathUtils.cc
r465 r829 41 41 using namespace casa; 42 42 43 float mathutil::statistics(const String& which, 43 float mathutil::statistics(const String& which, 44 44 const MaskedArray<Float>& data) 45 45 { … … 47 47 str.upcase(); 48 48 if (str.contains(String("MIN"))) { 49 return min(data); 49 return min(data); 50 50 } else if (str.contains(String("MAX"))) { 51 51 return max(data); … … 57 57 return mean(data); 58 58 } else if (str.contains(String("VAR"))) { 59 return variance(data); 59 return variance(data); 60 60 } else if (str.contains(String("STDDEV"))) { 61 61 return stddev(data); … … 69 69 } 70 70 } 71 71 72 72 73 73 void mathutil::replaceMaskByZero(Vector<Float>& data, const Vector<Bool>& mask) … … 79 79 80 80 81 void mathutil::scanBoundaries(Vector<uInt>& startInt, 82 Vector<uInt>& endInt, 83 const Vector<Int>& scanIDs) 84 // Find integrations start and end for each Scan 85 { 86 uInt nInt = scanIDs.nelements(); 87 startInt.resize(nInt); 88 endInt.resize(nInt); 89 90 startInt(0) = 0; 91 uInt j = 0; 92 Int currScanID = scanIDs(0); 93 for (uInt i=0; i<nInt; i++) { 94 if (scanIDs(i) != currScanID) { 95 endInt(j) = i-1; 96 currScanID = scanIDs(i); 97 98 j += 1; 99 startInt(j) = i; 100 if (i==nInt-1) { 101 endInt(j) = i; 102 } 103 } else { 104 if (i==nInt-1) endInt(j) = i; 105 } 106 } 107 startInt.resize(j+1,True); 108 endInt.resize(j+1,True); 109 } 110 111 std::vector<std::string> mathutil::tovectorstring(const Vector<String>& in) 81 std::vector<std::string> mathutil::tovectorstring(const Vector<String>& in) 112 82 { 113 83 std::vector<std::string> out; … … 119 89 } 120 90 121 Vector<String> mathutil::toVectorString(const std::vector<std::string>& in) 91 Vector<String> mathutil::toVectorString(const std::vector<std::string>& in) 122 92 { 123 93 Vector<String> out(in.size());
Note: See TracChangeset
for help on using the changeset viewer.