Changeset 171
- Timestamp:
- 01/06/05 14:05:54 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r170 r171 349 349 // Output Table cloned from input 350 350 351 SDMemTable* sdmt = new SDMemTable(*on, True);351 SDMemTable* pTabOut = new SDMemTable(*on, True); 352 352 353 353 // Loop over rows … … 383 383 // Put new row in output Table 384 384 385 sdmt->putSDContainer(sc); 386 } 387 // 388 return CountedPtr<SDMemTable>(sdmt); 389 } 390 391 392 393 CountedPtr<SDMemTable> 394 SDMath::hanning(const CountedPtr<SDMemTable>& in) 385 pTabOut->putSDContainer(sc); 386 } 387 // 388 return CountedPtr<SDMemTable>(pTabOut); 389 } 390 391 392 393 SDMemTable* SDMath::hanning(const SDMemTable& in) 395 394 // 396 395 // Hanning smooth each row … … 398 397 // 399 398 { 400 SDMemTable* sdmt = new SDMemTable(*in,True);399 SDMemTable* pTabOut = new SDMemTable(in,True); 401 400 402 401 // Loop over rows in Table 403 402 404 for (uInt ri=0; ri < in ->nRow(); ++ri) {403 for (uInt ri=0; ri < in.nRow(); ++ri) { 405 404 406 405 // Get data 407 406 408 const MaskedArray<Float>& marr(in ->rowAsMaskedArray(ri));407 const MaskedArray<Float>& marr(in.rowAsMaskedArray(ri)); 409 408 Array<Float> arr = marr.getArray(); 410 409 Array<Bool> barr = marr.getMask(); … … 428 427 // Create and put back 429 428 430 SDContainer sc = in ->getSDContainer(ri);429 SDContainer sc = in.getSDContainer(ri); 431 430 putDataInSDC (sc, arr, barr); 432 431 // 433 sdmt->putSDContainer(sc); 434 } 435 return CountedPtr<SDMemTable>(sdmt); 432 pTabOut->putSDContainer(sc); 433 } 434 // 435 return pTabOut; 436 436 } 437 437 -
trunk/src/SDMath.h
r170 r171 55 55 56 56 // Quotient 57 58 57 casa::CountedPtr<SDMemTable> quotient(const casa::CountedPtr<SDMemTable>& on, 59 58 const casa::CountedPtr<SDMemTable>& off); 60 59 61 // Hanning62 63 casa::CountedPtr<SDMemTable> hanning(const casa::CountedPtr<SDMemTable>& in);64 65 60 // Average in time 66 67 61 casa::CountedPtr<SDMemTable> average (const casa::Block<casa::CountedPtr<SDMemTable> >& in, 68 62 const casa::Vector<casa::Bool>& mask, … … 70 64 71 65 // Statistics 72 73 66 std::vector<float> statistic(const casa::CountedPtr<SDMemTable>& in, 74 67 const std::vector<bool>& mask, const std::string& which); 75 68 69 // Hanning 70 SDMemTable* hanning(const SDMemTable& in); 71 72 73 // Bin up spectra 74 SDMemTable* bin (const SDMemTable& in, casa::Int width); 76 75 77 76 // Simple mathematical operations. what=0 (mul) or 1 (add) 78 79 77 SDMemTable* simpleOperate (const SDMemTable& in, casa::Float offset, 80 78 casa::Bool doAll, casa::uInt what); 81 79 82 80 // Average polarizations 83 84 81 SDMemTable* averagePol (const SDMemTable& in, const casa::Vector<casa::Bool>& mask); 85 86 // Bin up spectra87 88 SDMemTable* bin (const SDMemTable& in, casa::Int width);89 90 82 91 83 private: -
trunk/src/SDMathWrapper.cc
r170 r171 88 88 } 89 89 90 void SDMathWrapper::hanningInSitu(SDMemTableWrapper& in) 91 { 92 SDMemTable* pIn = in.getPtr(); 93 SDMath sdm; 94 SDMemTable* pOut = sdm.hanning (*pIn); 95 *pIn = *pOut; 96 delete pOut; 97 } 90 98 91 SDMemTableWrapper SDMathWrapper::hanning (const SDMemTableWrapper& in)99 SDMemTableWrapper SDMathWrapper::hanning (const SDMemTableWrapper& in) 92 100 { 101 const CountedPtr<SDMemTable>& pIn = in.getCP(); 93 102 SDMath sdm; 94 return SDMemTableWrapper(sdm.hanning(in.getCP()));103 return CountedPtr<SDMemTable>(sdm.hanning(*pIn)); 95 104 } 105 96 106 97 107 -
trunk/src/SDMathWrapper.h
r170 r171 48 48 49 49 // Multiply 50 51 50 void scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll); 52 51 SDMemTableWrapper scale(const SDMemTableWrapper& in, … … 54 53 55 54 // Add 56 57 55 void addInSitu(SDMemTableWrapper& in, float offset, bool all); 58 56 SDMemTableWrapper add(const SDMemTableWrapper& in, float offset, bool all); 59 57 60 58 // Hanning 61 59 void hanningInSitu (SDMemTableWrapper& in); 62 60 SDMemTableWrapper hanning(const SDMemTableWrapper& in); 63 61 64 62 // Bin up 65 66 63 void binInSitu (SDMemTableWrapper& in, int width); 67 64 SDMemTableWrapper bin(const SDMemTableWrapper& in, int width); 68 65 69 66 // Average in time 70 71 67 SDMemTableWrapper average (boost::python::tuple tpl, 72 68 const std::vector<bool>& mask, … … 74 70 75 71 // Average polarizations 76 77 72 void averagePolInSitu (SDMemTableWrapper& in, const std::vector<bool>& mask); 78 73 SDMemTableWrapper averagePol (const SDMemTableWrapper& in, const std::vector<bool>& mask); 79 74 80 75 // Statistics 81 82 76 std::vector<float> statistic(const SDMemTableWrapper& in, 83 77 const std::vector<bool>& mask,
Note:
See TracChangeset
for help on using the changeset viewer.