Ignore:
Timestamp:
03/17/06 10:10:59 (18 years ago)
Author:
mar637
Message:

More work on polarisation. STPol and labelling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STSelector.cpp

    r869 r902  
    1616#include <casa/iostream.h>
    1717#include <casa/iomanip.h>
     18#include <casa/Exceptions/Error.h>
    1819
    1920#include "MathUtils.h"
     21#include "STPol.h"
    2022#include "STSelector.h"
    2123
     
    99101}
    100102
     103
     104void 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
    101112Table STSelector::apply( const Table& tab )
    102113{
    103114  if ( empty() ) {
    104     return tab;
     115    return sort(tab);
    105116  }
    106117  TableExprNode query;
     
    132143      tmpt = tableCommand(taql_, tab);
    133144    }
    134     return tmpt;
     145    return sort(tmpt);
    135146  } else {
    136     return tab(query);
     147    if ( query.isNull() ) {
     148      return sort(tab);
     149    } else {
     150      return sort(tab(query));
     151    }
    137152  }
    138153}
     
    207222  return (intselections_.empty() && taql_.size() == 0 );
    208223}
     224
     225casa::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
     237void 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
     256std::vector< std::string > asap::STSelector::getPolTypes( )
     257{
     258  return poltypes_;
     259}
Note: See TracChangeset for help on using the changeset viewer.