Changeset 1145 for trunk/src


Ignore:
Timestamp:
08/16/06 11:11:45 (18 years ago)
Author:
mar637
Message:

added average_beam which is part of Ticket #45

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r1143 r1145  
    9696  ScalarColumn<Double> intColOut(tout,"INTERVAL");
    9797  ScalarColumn<uInt> cycColOut(tout,"CYCLENO");
     98  ScalarColumn<uInt> scanColOut(tout,"SCANNO");
    9899
    99100  // set up the output table rows. These are based on the structure of the
     
    120121    tout.addRow();
    121122    TableCopy::copyRows(tout, subt, outrowCount, 0, 1);
     123    // re-index to 0
     124    if ( avmode != "SCAN" && avmode != "SOURCE" ) {
     125      scanColOut.put(outrowCount, uInt(0));
     126    }
    122127    ++outrowCount;
    123128    ++iter;
     
    419424                          && t.col("IFNO") == Int(rec.asuInt("IFNO"))
    420425                          && t.col("POLNO") == Int(rec.asuInt("POLNO")) );
     426      if ( offsel.nrow() == 0 )
     427        throw AipsError("STMath::quotient: no matching off");
    421428      TableRow offrow(offsel);
    422429      const TableRecord& offrec = offrow.get(0);//should be ncycles - take first
     
    11261133  Table& tout = pols->table();
    11271134  // give all rows the same POLNO
    1128   TableVector<uInt> vec(tout,"POLNO");
     1135  TableVector<uInt> vec(tout, "POLNO");
    11291136  vec = 0;
    1130   pols->table_.rwKeywordSet().define("nPol",Int(1));
     1137  pols->table_.rwKeywordSet().define("nPol", Int(1));
    11311138  std::vector<CountedPtr<Scantable> > vpols;
    11321139  vpols.push_back(pols);
    11331140  CountedPtr< Scantable > out = average(vpols, mask, weight, "NONE");
     1141  return out;
     1142}
     1143
     1144CountedPtr< Scantable >
     1145  STMath::averageBeams( const CountedPtr< Scantable > & in,
     1146                        const std::vector<bool>& mask,
     1147                        const std::string& weight )
     1148{
     1149  bool insitu = insitu_;
     1150  setInsitu(false);
     1151  CountedPtr< Scantable > beams = getScantable(in, false);
     1152  setInsitu(insitu);
     1153  Table& tout = beams->table();
     1154  // give all rows the same BEAMNO
     1155  TableVector<uInt> vec(tout, "BEAMNO");
     1156  vec = 0;
     1157  beams->table_.rwKeywordSet().define("nBeam", Int(1));
     1158  std::vector<CountedPtr<Scantable> > vbeams;
     1159  vbeams.push_back(beams);
     1160  CountedPtr< Scantable > out = average(vbeams, mask, weight, "NONE");
    11341161  return out;
    11351162}
  • trunk/src/STMath.h

    r1143 r1145  
    9191
    9292  /**
    93     * average polarisations together. really only useful if only linears are
    94     *  available.
     93    * Average polarisations together. really only useful if only linears are
     94    * available.
    9595    * @param in the input Scantable
    9696    * @param mask an optional mask if weight allows one
     
    102102                          const std::vector<bool>& mask,
    103103                          const std::string& weight );
     104
     105  /**
     106    * Average beams together.
     107    * @param in the input Scantable
     108    * @param mask an optional mask if weight allows one
     109    * @param weight weighting scheme
     110    * @return
     111    */
     112  casa::CountedPtr< Scantable >
     113    averageBeams( const casa::CountedPtr< Scantable > & in,
     114                   const std::vector<bool>& mask,
     115                   const std::string& weight );
    104116
    105117  casa::CountedPtr<Scantable>
  • trunk/src/STMathWrapper.h

    r1140 r1145  
    6060                          const std::string& weight)
    6161  { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));}
     62
     63  ScantableWrapper
     64    averageBeams( const ScantableWrapper& in,
     65                  const std::vector<bool>& mask,
     66                  const std::string& weight)
     67
     68  { return ScantableWrapper(STMath::averageBeams(in.getCP(),mask, weight));}
    6269
    6370  ScantableWrapper
     
    144151                                        const std::string& newtype )
    145152  { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
    146  
     153
    147154  ScantableWrapper mxExtract( const ScantableWrapper& in,
    148155                              const std::string& scantype="on" )
  • trunk/src/python_STMath.cpp

    r1140 r1145  
    4747        .def("_averagechannel", &STMathWrapper::averageChannel)
    4848        .def("_averagepol", &STMathWrapper::averagePolarisations)
     49        .def("_averagebeams", &STMathWrapper::averageBeams)
    4950        .def("_unaryop", &STMathWrapper::unaryOperate)
    5051        .def("_auto_quotient", &STMathWrapper::autoQuotient)
Note: See TracChangeset for help on using the changeset viewer.