Changeset 977
- Timestamp:
- 04/04/06 10:40:29 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STMath.cpp
r961 r977 60 60 61 61 CountedPtr<Scantable> 62 STMath::average( const std::vector<CountedPtr<Scantable> >& scantbls,62 STMath::average( const std::vector<CountedPtr<Scantable> >& in, 63 63 const std::vector<bool>& mask, 64 64 const std::string& weight, 65 const std::string& avmode, 66 bool alignfreq) 67 { 68 if ( avmode == "SCAN" && scantbls.size() != 1 ) 65 const std::string& avmode) 66 { 67 if ( avmode == "SCAN" && in.size() != 1 ) 69 68 throw(AipsError("Can't perform 'SCAN' averaging on multiple tables")); 70 69 WeightType wtype = stringToWeight(weight); 71 72 std::vector<CountedPtr<Scantable> >* in =73 const_cast<std::vector<CountedPtr<Scantable> >*>(&scantbls);74 std::vector<CountedPtr<Scantable> > inaligned;75 if ( alignfreq ) {76 // take first row of first scantable as reference epoch77 String epoch = scantbls[0]->getTime(0);78 for (int i=0; i< scantbls.size(); ++i ) {79 80 inaligned.push_back(frequencyAlign(scantbls[i], epoch));81 }82 in = &inaligned;83 }84 70 85 71 // output … … 87 73 bool insitu = insitu_; 88 74 setInsitu(false); 89 CountedPtr< Scantable > out = getScantable( (*in)[0], true);75 CountedPtr< Scantable > out = getScantable(in[0], true); 90 76 setInsitu(insitu); 91 std::vector<CountedPtr<Scantable> >::const_iterator stit = in ->begin();77 std::vector<CountedPtr<Scantable> >::const_iterator stit = in.begin(); 92 78 ++stit; 93 while ( stit != in ->end() ) {79 while ( stit != in.end() ) { 94 80 out->appendToHistoryTable((*stit)->history()); 95 81 ++stit; … … 108 94 // set up the output table rows. These are based on the structure of the 109 95 // FIRST scantable in the vector 110 const Table& baset = (*in)[0]->table();96 const Table& baset = in[0]->table(); 111 97 112 98 Block<String> cols(3); … … 118 104 cols[3] = String("SRCNAME"); 119 105 } 120 if ( avmode == "SCAN" && in ->size() == 1) {106 if ( avmode == "SCAN" && in.size() == 1) { 121 107 cols.resize(4); 122 108 cols[3] = String("SCANNO"); … … 142 128 143 129 for (uInt i=0; i < tout.nrow(); ++i) { 144 for ( int j=0; j < in ->size(); ++j ) {145 const Table& tin = (*in)[j]->table();130 for ( int j=0; j < in.size(); ++j ) { 131 const Table& tin = in[j]->table(); 146 132 const TableRecord& rec = row.get(i); 147 133 ROScalarColumn<Double> tmp(tin, "TIME"); … … 1002 988 pols.push_back(pol0); 1003 989 pols.push_back(pol1); 1004 CountedPtr< Scantable > out = average(pols, mask, weight, "NONE" , false);990 CountedPtr< Scantable > out = average(pols, mask, weight, "NONE"); 1005 991 out->table_.rwKeywordSet().define("nPol",Int(1)); 1006 992 return out; -
trunk/src/STMath.h
r940 r977 57 57 const std::vector<bool>& mask = std::vector<bool>(), 58 58 const std::string& weight = "NONE", 59 const std::string& avmode = "SCAN", 60 bool alignfreq = false ); 59 const std::string& avmode = "SCAN"); 61 60 casa::CountedPtr< Scantable > 62 61 averagePolarisations( const casa::CountedPtr< Scantable > & in, -
trunk/src/STMathWrapper.h
r940 r977 40 40 const std::vector<bool>& mask, 41 41 const std::string& weight, 42 const std::string& avmode, 43 bool alignfreq) 42 const std::string& avmode ) 44 43 { 45 44 std::vector<casa::CountedPtr<Scantable> > sts;
Note:
See TracChangeset
for help on using the changeset viewer.