Changeset 170
- Timestamp:
- 01/06/05 13:52:30 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r169 r170 63 63 using namespace asap; 64 64 65 66 SDMath::SDMath() 67 {;} 68 69 SDMath::SDMath (const SDMath& other) 70 { 71 72 // No state 73 74 } 75 76 SDMath& SDMath::operator=(const SDMath& other) 77 { 78 if (this != &other) { 79 // No state 80 } 81 return *this; 82 } 83 84 65 85 CountedPtr<SDMemTable> SDMath::average (const Block<CountedPtr<SDMemTable> >& in, 66 86 const Vector<Bool>& mask, bool scanAv, -
trunk/src/SDMath.h
r169 r170 41 41 class SDMemTable; 42 42 43 namespace SDMath { 43 class SDMath { 44 45 public: 46 47 // Default constructor 48 SDMath(); 49 50 // Copy Constructor (copy semantics) 51 SDMath (const SDMath& other); 52 53 // Assignment (copy semantics) 54 SDMath &operator=(const SDMath& other); 44 55 45 56 // Quotient 46 57 47 casa::CountedPtr<SDMemTable> quotient(const casa::CountedPtr<SDMemTable>& on,58 casa::CountedPtr<SDMemTable> quotient(const casa::CountedPtr<SDMemTable>& on, 48 59 const casa::CountedPtr<SDMemTable>& off); 49 60 50 61 // Hanning 51 62 52 casa::CountedPtr<SDMemTable> hanning(const casa::CountedPtr<SDMemTable>& in);63 casa::CountedPtr<SDMemTable> hanning(const casa::CountedPtr<SDMemTable>& in); 53 64 54 65 // Average in time 55 66 56 casa::CountedPtr<SDMemTable> average (const casa::Block<casa::CountedPtr<SDMemTable> >& in,57 const casa::Vector<casa::Bool>& mask,58 bool scanAverage, const std::string& weightStr);67 casa::CountedPtr<SDMemTable> average (const casa::Block<casa::CountedPtr<SDMemTable> >& in, 68 const casa::Vector<casa::Bool>& mask, 69 bool scanAverage, const std::string& weightStr); 59 70 60 71 // Statistics 61 72 62 std::vector<float> statistic(const casa::CountedPtr<SDMemTable>& in,63 const std::vector<bool>& mask, const std::string& which);73 std::vector<float> statistic(const casa::CountedPtr<SDMemTable>& in, 74 const std::vector<bool>& mask, const std::string& which); 64 75 65 76 66 77 // Simple mathematical operations. what=0 (mul) or 1 (add) 67 78 68 SDMemTable* simpleOperate (const SDMemTable& in, casa::Float offset,69 casa::Bool doAll, casa::uInt what);79 SDMemTable* simpleOperate (const SDMemTable& in, casa::Float offset, 80 casa::Bool doAll, casa::uInt what); 70 81 71 82 // Average polarizations 72 83 73 SDMemTable* averagePol (const SDMemTable& in, const casa::Vector<casa::Bool>& mask);84 SDMemTable* averagePol (const SDMemTable& in, const casa::Vector<casa::Bool>& mask); 74 85 75 86 // Bin up spectra 76 87 77 SDMemTable* bin (const SDMemTable& in, casa::Int width);88 SDMemTable* bin (const SDMemTable& in, casa::Int width); 78 89 79 90 80 81 // private like functions (this is not a class so can't make them private) 91 private: 82 92 83 93 // Weighting type for time averaging -
trunk/src/SDMathWrapper.cc
r169 r170 32 32 33 33 #include "SDMathWrapper.h" 34 #include "SDMath.h" 35 34 36 35 37 using namespace asap; … … 39 41 const SDMemTableWrapper& off) 40 42 { 41 return SDMemTableWrapper(SDMath::quotient(on.getCP(),42 43 SDMath sdm; 44 return SDMemTableWrapper(sdm.quotient(on.getCP(), off.getCP())); 43 45 } 44 46 45 47 46 void SDMathWrapper::scaleInSitu(SDMemTableWrapper& in, casa::Float factor, casa::Bool doAll)48 void SDMathWrapper::scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll) 47 49 { 48 50 SDMemTable* pIn = in.getPtr(); 49 51 const uInt what = 0; 50 SDMemTable* pOut = SDMath::simpleOperate (*pIn, factor, doAll, what); 52 // 53 SDMath sdm; 54 SDMemTable* pOut = sdm.simpleOperate (*pIn, Float(factor), Bool(doAll), what); 51 55 *pIn = *pOut; 52 56 delete pOut; … … 54 58 55 59 SDMemTableWrapper SDMathWrapper::scale(const SDMemTableWrapper& in, 56 casa::Float factor, casa::Bool doAll)60 float factor, bool doAll) 57 61 { 58 62 const CountedPtr<SDMemTable>& pIn = in.getCP(); 59 63 const uInt what = 0; 60 return CountedPtr<SDMemTable>(SDMath::simpleOperate(*pIn, factor, doAll, what)); 64 SDMath sdm; 65 return CountedPtr<SDMemTable>(sdm.simpleOperate(*pIn, Float(factor), Bool(doAll), what)); 61 66 } 62 67 63 68 64 69 65 void SDMathWrapper::addInSitu(SDMemTableWrapper& in, casa::Float offset, casa::Bool doAll)70 void SDMathWrapper::addInSitu(SDMemTableWrapper& in, float offset, bool doAll) 66 71 { 67 72 SDMemTable* pIn = in.getPtr(); 68 73 const uInt what = 1; 69 SDMemTable* pOut = SDMath::simpleOperate (*pIn, offset, doAll, what); 74 // 75 SDMath sdm; 76 SDMemTable* pOut = sdm.simpleOperate (*pIn, Float(offset), Bool(doAll), what); 70 77 *pIn = *pOut; 71 78 delete pOut; … … 73 80 74 81 SDMemTableWrapper SDMathWrapper::add(const SDMemTableWrapper& in, 75 casa::Float offset, casa::Bool doAll)82 float offset, bool doAll) 76 83 { 77 84 const CountedPtr<SDMemTable>& pIn = in.getCP(); 78 85 const uInt what = 1; 79 return CountedPtr<SDMemTable>(SDMath::simpleOperate(*pIn, offset, doAll, what)); 86 SDMath sdm; 87 return CountedPtr<SDMemTable>(sdm.simpleOperate(*pIn, Float(offset), Bool(doAll), what)); 80 88 } 81 89 … … 83 91 SDMemTableWrapper SDMathWrapper::hanning(const SDMemTableWrapper& in) 84 92 { 85 return SDMemTableWrapper(SDMath::hanning(in.getCP())); 93 SDMath sdm; 94 return SDMemTableWrapper(sdm.hanning(in.getCP())); 86 95 } 87 96 … … 90 99 { 91 100 SDMemTable* pIn = in.getPtr(); 92 SDMemTable* pOut = SDMath::bin (*pIn, Int(width)); 101 SDMath sdm; 102 SDMemTable* pOut = sdm.bin (*pIn, Int(width)); 93 103 *pIn = *pOut; 94 104 delete pOut; … … 99 109 { 100 110 const CountedPtr<SDMemTable>& pIn = in.getCP(); 101 return CountedPtr<SDMemTable>(SDMath::bin(*pIn, Int(width))); 111 SDMath sdm; 112 return CountedPtr<SDMemTable>(sdm.bin(*pIn, Int(width))); 102 113 } 103 114 … … 106 117 { 107 118 SDMemTable* pIn = in.getPtr(); 108 SDMemTable* pOut = SDMath::averagePol (*pIn, mask); 119 SDMath sdm; 120 SDMemTable* pOut = sdm.averagePol (*pIn, mask); 109 121 *pIn = *pOut; 110 122 delete pOut; … … 115 127 { 116 128 const CountedPtr<SDMemTable>& pIn = in.getCP(); 117 return CountedPtr<SDMemTable>(SDMath::averagePol(*pIn, mask)); 129 SDMath sdm; 130 return CountedPtr<SDMemTable>(sdm.averagePol(*pIn, mask)); 118 131 } 119 132 … … 123 136 const std::string& which) 124 137 { 125 return SDMath::statistic(in.getCP(), mask, which); 138 SDMath sdm; 139 return sdm.statistic(in.getCP(), mask, which); 126 140 } -
trunk/src/SDMathWrapper.h
r169 r170 38 38 39 39 #include "SDMemTableWrapper.h" 40 #include "SDMath.h"41 40 42 41 namespace asap { … … 46 45 // Quotient 47 46 SDMemTableWrapper quotient(const SDMemTableWrapper& on, 48 const SDMemTableWrapper& off);47 const SDMemTableWrapper& off); 49 48 50 49 // Multiply 51 50 52 void scaleInSitu(SDMemTableWrapper& in, casa::Float factor, casa::Bool all);51 void scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll); 53 52 SDMemTableWrapper scale(const SDMemTableWrapper& in, 54 casa::Float factor, casa::Bool all);53 float factor, bool all); 55 54 56 55 // Add 57 56 58 void addInSitu(SDMemTableWrapper& in, casa::Float offset, casa::Bool all);59 SDMemTableWrapper add(const SDMemTableWrapper& in, casa::Float offset, casa::Bool all);57 void addInSitu(SDMemTableWrapper& in, float offset, bool all); 58 SDMemTableWrapper add(const SDMemTableWrapper& in, float offset, bool all); 60 59 61 60 // Hanning -
trunk/src/python_SDMath.cc
r167 r170 36 36 37 37 #include "SDMathWrapper.h" 38 #include "SDMath.h" 38 39 39 40 using namespace casa; … … 55 56 } 56 57 Vector<Bool> msk(mask); 57 return SDMemTableWrapper(SDMath::average(b,msk,scanAv,weightStr)); 58 // 59 SDMath sdm; 60 return SDMemTableWrapper(sdm.average(b, msk, Bool(scanAv), weightStr)); 58 61 }; 59 62 } // namespace SDMathWrapper
Note:
See TracChangeset
for help on using the changeset viewer.