Changeset 902 for trunk/src/STSelector.cpp
- Timestamp:
- 03/17/06 10:10:59 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STSelector.cpp
r869 r902 16 16 #include <casa/iostream.h> 17 17 #include <casa/iomanip.h> 18 #include <casa/Exceptions/Error.h> 18 19 19 20 #include "MathUtils.h" 21 #include "STPol.h" 20 22 #include "STSelector.h" 21 23 … … 99 101 } 100 102 103 104 void asap::STSelector::setSortOrder( const std::vector< std::string > & order ) 105 { 106 order_.resize(order.size(), True); 107 for (int i=0;i<order.size();++i) { 108 order_[i] = order[i]; 109 } 110 } 111 101 112 Table STSelector::apply( const Table& tab ) 102 113 { 103 114 if ( empty() ) { 104 return tab;115 return sort(tab); 105 116 } 106 117 TableExprNode query; … … 132 143 tmpt = tableCommand(taql_, tab); 133 144 } 134 return tmpt;145 return sort(tmpt); 135 146 } else { 136 return tab(query); 147 if ( query.isNull() ) { 148 return sort(tab); 149 } else { 150 return sort(tab(query)); 151 } 137 152 } 138 153 } … … 207 222 return (intselections_.empty() && taql_.size() == 0 ); 208 223 } 224 225 casa::Table asap::STSelector::sort( const casa::Table & tab ) 226 { 227 if (order_.nelements() > 0) { 228 cout << "sorting" << endl; 229 Table t = tab.sort(order_); 230 return t; 231 } else { 232 return tab; 233 } 234 } 235 236 237 void asap::STSelector::setPolFromStrings( const std::vector< std::string >& pols ) 238 { 239 poltypes_.clear(); 240 std::vector<int> polints; 241 std::vector<std::string>::const_iterator strit = pols.begin(); 242 for (strit; strit != pols.end(); ++strit) { 243 std::pair<int, std::string> val; 244 try { 245 val = STPol::polFromString(*strit); 246 } catch (AipsError& e) { 247 poltypes_.clear(); 248 throw(e); 249 } 250 polints.push_back(val.first); 251 poltypes_.push_back(val.second); 252 } 253 setint("POLNO", polints); 254 } 255 256 std::vector< std::string > asap::STSelector::getPolTypes( ) 257 { 258 return poltypes_; 259 }
Note: See TracChangeset
for help on using the changeset viewer.