Changeset 1010


Ignore:
Timestamp:
04/11/06 13:15:46 (19 years ago)
Author:
mar637
Message:

Fix to Ticket #17 - average_pol not working.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1006 r1010  
    979979        if mask is None:
    980980            mask = ()
    981         s = scantable(self._math._averagepol(self, mask, weight))
     981        s = scantable(self._math._averagepol(self, mask, weight.upper()))
    982982        s._add_history("average_pol",varlist)
    983983        print_log()
  • trunk/src/STMath.cpp

    r1008 r1010  
    153153      Vector<uChar> flag;
    154154      Double inter,time;
     155      cout << rec.asuInt("POLNO") << endl;
    155156      for (uInt k = 0; k < subt.nrow(); ++k ) {
    156157        flagCol.get(k, flag);
     
    979980  if (in->getPolType() != "linear"  || in->npol() != 2 )
    980981    throw(AipsError("averagePolarisations can only be applied to two linear polarisations."));
    981   CountedPtr<Scantable> pol0( new Scantable(*in), false);
    982   CountedPtr<Scantable> pol1( new Scantable(*in), false);
    983   Table& tpol0 = pol0->table();
    984   Table& tpol1 = pol1->table();
    985   Vector<uInt> pol0rows = tpol0(tpol0.col("POLNO") == 0).rowNumbers();
    986   Vector<uInt> pol1rows = tpol1(tpol1.col("POLNO") == 1).rowNumbers();
    987   tpol0.removeRow(pol1rows);
    988   tpol1.removeRow(pol0rows);
    989   // give both tables the same POLNO
    990   TableVector<uInt> vec(tpol1,"POLNO");
     982  bool insitu = insitu_;
     983  setInsitu(false);
     984  CountedPtr< Scantable > pols = getScantable(in, false);
     985  setInsitu(insitu);
     986  Table& tout = pols->table();
     987  // give all rows the same POLNO
     988  TableVector<uInt> vec(tout,"POLNO");
    991989  vec = 0;
    992   std::vector<CountedPtr<Scantable> > pols;
    993   pols.push_back(pol0);
    994   pols.push_back(pol1);
    995   CountedPtr< Scantable > out = average(pols, mask, weight, "NONE");
    996   out->table_.rwKeywordSet().define("nPol",Int(1));
     990  pols->table_.rwKeywordSet().define("nPol",Int(1));
     991  std::vector<CountedPtr<Scantable> > vpols;
     992  vpols.push_back(pols);
     993  CountedPtr< Scantable > out = average(vpols, mask, weight, "NONE");
    997994  return out;
    998995}
Note: See TracChangeset for help on using the changeset viewer.