Changeset 977 for trunk


Ignore:
Timestamp:
04/04/06 10:40:29 (19 years ago)
Author:
mar637
Message:

Removed align option from average as it is buggy. The user has to provide a vector of aligned scantables.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r961 r977  
    6060
    6161CountedPtr<Scantable>
    62 STMath::average( const std::vector<CountedPtr<Scantable> >& scantbls,
     62STMath::average( const std::vector<CountedPtr<Scantable> >& in,
    6363                 const std::vector<bool>& mask,
    6464                 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 )
    6968    throw(AipsError("Can't perform 'SCAN' averaging on multiple tables"));
    7069  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 epoch
    77     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   }
    8470
    8571  // output
     
    8773  bool insitu = insitu_;
    8874  setInsitu(false);
    89   CountedPtr< Scantable > out = getScantable((*in)[0], true);
     75  CountedPtr< Scantable > out = getScantable(in[0], true);
    9076  setInsitu(insitu);
    91   std::vector<CountedPtr<Scantable> >::const_iterator stit = in->begin();
     77  std::vector<CountedPtr<Scantable> >::const_iterator stit = in.begin();
    9278  ++stit;
    93   while ( stit != in->end() ) {
     79  while ( stit != in.end() ) {
    9480    out->appendToHistoryTable((*stit)->history());
    9581    ++stit;
     
    10894  // set up the output table rows. These are based on the structure of the
    10995  // FIRST scantable in the vector
    110   const Table& baset = (*in)[0]->table();
     96  const Table& baset = in[0]->table();
    11197
    11298  Block<String> cols(3);
     
    118104    cols[3] = String("SRCNAME");
    119105  }
    120   if ( avmode == "SCAN"  && in->size() == 1) {
     106  if ( avmode == "SCAN"  && in.size() == 1) {
    121107    cols.resize(4);
    122108    cols[3] = String("SCANNO");
     
    142128
    143129  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();
    146132      const TableRecord& rec = row.get(i);
    147133      ROScalarColumn<Double> tmp(tin, "TIME");
     
    1002988  pols.push_back(pol0);
    1003989  pols.push_back(pol1);
    1004   CountedPtr< Scantable > out = average(pols, mask, weight, "NONE", false);
     990  CountedPtr< Scantable > out = average(pols, mask, weight, "NONE");
    1005991  out->table_.rwKeywordSet().define("nPol",Int(1));
    1006992  return out;
  • trunk/src/STMath.h

    r940 r977  
    5757             const std::vector<bool>& mask = std::vector<bool>(),
    5858             const std::string& weight = "NONE",
    59              const std::string& avmode = "SCAN",
    60              bool alignfreq = false );
     59             const std::string& avmode = "SCAN");
    6160  casa::CountedPtr< Scantable >
    6261    averagePolarisations( const casa::CountedPtr< Scantable > & in,
  • trunk/src/STMathWrapper.h

    r940 r977  
    4040             const std::vector<bool>& mask,
    4141             const std::string& weight,
    42              const std::string& avmode,
    43              bool alignfreq)
     42             const std::string& avmode )
    4443  {
    4544    std::vector<casa::CountedPtr<Scantable> > sts;
Note: See TracChangeset for help on using the changeset viewer.