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/Scantable.cpp

    r901 r902  
    2828#include <casa/Quanta/MVAngle.h>
    2929#include <casa/Containers/RecordField.h>
     30#include <casa/Utilities/GenSort.h>
    3031
    3132#include <tables/Tables/TableParse.h>
     
    5657#include "STPolLinear.h"
    5758#include "STAttr.h"
     59#include "MathUtils.h"
    5860
    5961using namespace casa;
     
    126128                            Bool(clear));
    127129      table_ = Table(newname, Table::Update);
    128       copySubtables(other);
     130      if ( clear ) copySubtables(other);
    129131      table_.markForDelete();
    130132  }
     
    328330int Scantable::nscan() const {
    329331  int n = 0;
    330   int previous = -1; int current = 0;
    331   for (uInt i=0; i< scanCol_.nrow();i++) {
    332     scanCol_.getScalar(i,current);
    333     if (previous != current) {
    334       previous = current;
    335       n++;
    336     }
    337   }
    338   return n;
     332  Int previous = -1; Int current = 0;
     333  Vector<uInt> scannos(scanCol_.getColumn());
     334  uInt nout = GenSort<uInt>::sort( scannos, Sort::Ascending,
     335                       Sort::QuickSort|Sort::NoDuplicates );
     336  return int(nout);
    339337}
    340338
     
    482480    while ( !it.pastEnd() ) {
    483481      ++n;
     482      ++it;
    484483    }
    485484    return n;
     
    595594
    596595std::vector<float> Scantable::getSpectrum( int whichrow,
    597                                            const std::string& poltype) const
    598 {
     596                                           const std::string& poltype ) const
     597{
     598  if ( whichrow  < 0 || whichrow >= nrow() )
     599    throw(AipsError("Illegal row number."));
    599600  std::vector<float> out;
    600601  Vector<Float> arr;
     
    610611      stpol->setSpectra(getPolMatrix(row));
    611612      Float frot,fang,ftan;
    612       focusTable_.getEntry(frot, fang, ftan, row);
     613      focusTable_.getEntry(frot, fang, ftan, mfocusidCol_(row));
    613614      stpol->setPhaseCorrections(frot, fang, ftan);
    614615      arr = stpol->getSpectrum(requestedpol, poltype);
     
    619620    }
    620621  }
     622  if ( arr.nelements() == 0 )
     623    pushLog("Not enough polarisations present to do the conversion.");
    621624  arr.tovector(out);
    622625  return out;
     
    653656{
    654657  return table_.keywordSet().asString("POLTYPE");
    655 }
    656 
    657 
    658 std::string Scantable::getPolarizationLabel(bool linear, bool stokes,
    659                                             bool linpol, int polidx) const
    660 {
    661   uInt idx = 0;
    662   if (polidx >=0) idx = polidx;
    663   return "";
    664   //return SDPolUtil::polarizationLabel(idx, linear, stokes, linpol);
    665658}
    666659
     
    892885}
    893886
    894 
    895 }//namespace asap
     887std::vector< std::string > asap::Scantable::columnNames( ) const
     888{
     889  Vector<String> vec = table_.tableDesc().columnNames();
     890  return mathutil::tovectorstring(vec);
     891}
     892
     893} //namespace asap
Note: See TracChangeset for help on using the changeset viewer.