Changes in trunk/src [1947:1848]


Ignore:
Location:
trunk/src
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/AsapLogSink.cpp

    r1947 r1848  
    2121
    2222  void AsapLogSink::postMessage(const std::string& msg,
    23                                 const std::string& priority,
    24                                 const std::string& origin)
     23                                const std::string& location,
     24                                const std::string& priority)
    2525  {
    2626    LogMessage::Priority p;
     
    3232      p = LogMessage::SEVERE;
    3333    }
    34     LogMessage message(msg, LogOrigin(origin), p);
     34    LogMessage message(msg, LogOrigin(location), p);
    3535
    3636    MemoryLogSink::postLocally(message);
  • trunk/src/AsapLogSink.h

    r1947 r1848  
    3737
    3838  virtual void postMessage(const std::string& msg,
    39                            const std::string& priority="INFO",
    40                            const std::string& origin="");
     39                           const std::string& location="",
     40                           const std::string& priority="INFO");
    4141
    4242  std::string popMessages();
  • trunk/src/FillerBase.cpp

    r1947 r1848  
    3838  RecordFieldPtr< Array<Float> > tsysCol(row_.record(), "TSYS");
    3939
    40   //*specCol = spectrum;
    41   //*flagCol = flags;
    42   //*tsysCol = tsys;
    43   specCol.define(spectrum);
    44   flagCol.define(flags);
    45   tsysCol.define(tsys);
     40  *specCol = spectrum;
     41  *flagCol = flags;
     42  *tsysCol = tsys;
    4643}
    4744
  • trunk/src/FillerBase.h

    r1947 r1848  
    4343    virtual ~FillerBase() {;}
    4444
    45     virtual bool open(const std::string& filename, const casa::Record& rec) = 0;
    46     //    virtual bool open(const std::string& filename) = 0;
     45//    virtual bool open(const std::string& filename, const Record& rec) = 0;
     46    virtual bool open(const std::string& filename) = 0;
    4747    virtual void fill() = 0;
    4848    virtual void close() = 0;
  • trunk/src/FillerWrapper.h

    r1947 r1848  
    1616#include <casa/Exceptions.h>
    1717#include <casa/Utilities/CountedPtr.h>
    18 #include <casa/Containers/Record.h>
    1918#include <casa/OS/File.h>
    2019
     
    3938
    4039
    41   void open(const std::string& filename, const casa::Record& rec) {
    42     //  void open(const std::string& filename) {
     40//  void open(const std::string& filename, casa::Record rec) {
     41  void open(const std::string& filename) {
    4342    casa::File file(filename);
    4443    if ( !file.exists() ) {
     
    4645    }
    4746    filler_ = new PKSFiller(stable_);
    48     if (filler_->open(filename, rec)) {
    49       //    if (filler_->open(filename)) {
     47//    if (filler_->open(filename, rec)) {
     48    if (filler_->open(filename)) {
    5049      attached_ = true;
    5150      return;
    5251    }
    5352    filler_ = new NROFiller(stable_);
    54     if (filler_->open(filename, rec)) {
    55       //    if (filler_->open(filename)) {
     53//    if (filler_->open(filename, rec)) {
     54    if (filler_->open(filename)) {
    5655      attached_ = true;
    5756      return;
  • trunk/src/Makefile

    r1947 r1848  
    77###    3. Replase library names in G2CARCH '-lcasa_*' with '-l*'.
    88###    4. Comment-IN the definition of 'CXXOPTS'.
    9 TARGET   := /tmp/_asap.so
    10 
    11 ifndef ASAPROOT
    12         ASAPROOT := $(abspath ..)
    13 endif
    14 ATNFD := external-alma
     9#TARGET   := /tmp/_asap.so
     10TARGET   := /home/nakazato/tmp/_asap.so
    1511
    1612# the casa environment AIPSPATH has to be defined
    1713CASAROOT  := $(word 1, $(CASAPATH))
    1814CASAARCH  := $(word 2, $(CASAPATH))
    19 
    20 CXXFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CXXFLAGS eval_vars) && echo $$CXXFLAGS)
    21 CXXOPTS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COPTFLAGS eval_vars) && echo $$COPTFLAGS)
    22 LDFLAGS := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=LD_FLAGS eval_vars) && echo $$LD_FLAGS)
    2315
    2416COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD)
     
    3022PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD)
    3123PYTHONLIB := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONLIB eval_vars) && echo $$PYTHONLIB)
     24#PYTHONVER := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONVER eval_vars) && echo $$PYTHONVER)
    3225BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT)
    3326RPFITSLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=RPFITSLIBD eval_vars) && echo $$RPFITSLIBD)
    34 CFITSIOLIBD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOLIBD eval_vars) && echo $$CFITSIOLIBD)
    35 CFITSIOINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=CFITSIOINCD eval_vars) && echo $$CFITSIOINCD)
    3627
    3728CASAINC   := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include
    3829CASALIB   := $(CASAROOT)/$(CASAARCH)/lib
     30#USELIB := lib64
     31USELIB := lib
    3932
    4033# the compiler
     
    4437
    4538# compiler flags
    46 CXXFLAGS += -fPIC -DHAVE_LIBPYRAP
    47 
    48 PYRAPD := $(ASAPROOT)/external/libpyrap
    49 PYRAPLIBD := $(PYRAPD)
    50 PYRAPINCD := $(PYRAPD)/pyrap-0.3.2
    51 PYRAPLIB := -L$(PYRAPLIBD) -lpyrap
    52 
    53 
     39CXXFLAGS := -fPIC -O3 -g
     40CXXFLAGS += -ansi -Wno-long-long -Wall
     41#CXXOPTS := -DAIPS_64B
     42
     43# darwin specific flags
     44ifeq "$(CASAARCH)" "darwin"
     45   #CXXFLAGS +=-DAIPS_DARWIN -arch i386 #For 10.6
     46   CXXFLAGS +=-DAIPS_DARWIN
     47   #CXXFLAGS += -Wno-long-double
     48endif
     49
     50# cfitsio
     51CFITSIOROOT := /usr
     52CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio
    5453CFITSIOLIB := -lcfitsio
    5554
    5655#rpfits
     56RPFITSROOT := /usr
    5757RPFITSLIB := -lrpfits
    5858
     
    6060G2CLIB := -lgfortran
    6161
    62 # links to external libraries
    63 CASAPPLIB := -L$(ASAPROOT)/$(ATNFD) -latnf $(CORELIB) $(PYRAPLIB)\
     62# This assumes all casa libs are static only (*.a)
     63# if not than there might by symbol resolution errors.
     64CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \
    6465             -L$(WCSLIBLIBD) $(WCSLIBLIB) \
    6566             -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++
    6667
    6768# darwin specific CASA flags
    68 ifeq ($(shell uname), Darwin)
     69ifeq "$(CASAARCH)" "darwin"
    6970   CASAPPLIB += -framework vecLib
    7071else
     
    7273endif
    7374
     75# python
     76PYTHONINC := $(addprefix -I,$(PYTHONINCD))
     77PYTHONLIB := -L$(PYTHONLIBD) $(PYTHONLIB)
     78
     79# use python universal build
     80#ifeq "$(CASAARCH)" "darwin"
     81#   PYVERSION := 2.5
     82#   PYTHONROOT := /Library/Frameworks/Python.framework/Versions/$(PYVERSION)
     83#   PYTHONINC := -I$(PYTHONROOT)/include/python$(PYVERSION)
     84#   PYTHONLIB := -L$(PYTHONROOT)/lib -framework Python
     85#endif
     86
     87# the linker
    7488LD        := $(CXX)
    7589
     
    7892BOOSTINC  := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include
    7993
    80 LDFLAGS   += -shared
     94LDFLAGS   := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB)
     95ifeq "$(CASAARCH)" "darwin"
     96   LDFLAGS   := -bundle
     97endif
    8198
    8299
    83100# DO NOT MODIFY AFTER THIS
    84 INCDIRS   := -I. $(CASAINC)  -I$(CFITSIOINCD) $(BOOSTINC) $(addprefix -I, $(PYTHONINCD)) -I$(ASAPROOT)/$(ATNFD) -I$(PYRAPINCD)
     101INCDIRS   := -I. $(CASAINC)  $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC)
    85102LIBS      := $(PYTHONLIB)  $(BOOSTLIB) $(CASAPPLIB)
    86103
  • trunk/src/NROFiller.cpp

    r1947 r1848  
    2020#include "NROFiller.h"
    2121#include "STHeader.h"
    22 #include <casa/Containers/Record.h>
    2322#include <atnf/PKSIO/SrcType.h>
    2423
     
    3736}
    3837
    39   bool NROFiller::open(const std::string& filename, const Record& rec)
     38bool NROFiller::open(const std::string& filename)
    4039{
    4140  bool status = true ;
  • trunk/src/NROFiller.h

    r1947 r1848  
    4545    virtual ~NROFiller();
    4646
    47     bool open(const std::string& filename, const casa::Record& rec) ;
     47    bool open(const std::string& filename) ;
    4848    void fill() ;
    4949    void close() ;
  • trunk/src/PKSFiller.cpp

    r1947 r1848  
    2020#include <casa/Arrays/ArrayLogical.h>
    2121#include <casa/Utilities/Regex.h>
    22 #include <casa/Utilities/DataType.h>
    2322#include <casa/Logging/LogIO.h>
    2423
    25 #include <casa/Containers/Record.h>
    2624#include <measures/Measures/MDirection.h>
    2725#include <measures/Measures/MeasConvert.h>
     
    3634
    3735#include <time.h>
    38 #include <sstream>
    3936
    4037#include "STDefs.h"
     
    6158}
    6259
    63 bool PKSFiller::open( const std::string& filename, const Record& rec)
     60bool PKSFiller::open( const std::string& filename)
    6461{
    6562  Bool haveBase, haveSpectra;
     
    7774  Vector<uInt> nchans,npols;
    7875
    79   String antenna("");
    80   Bool getPt = False;
    81 
    82   // parsing MS options
    83   if ( rec.isDefined( "ms" ) ) {
    84     Record msrec = rec.asRecord( "ms" ) ;
    85     //msrec.print( cout ) ;
    86     if ( msrec.isDefined( "getpt" ) ) {
    87       getPt = msrec.asBool( "getpt" ) ;
    88     }
    89     if ( msrec.isDefined( "antenna" ) ) {
    90       if ( msrec.type( msrec.fieldNumber( "antenna" ) ) == TpInt ) {
    91         Int antInt = msrec.asInt( "antenna" ) ;
    92         ostringstream oss ;
    93         oss << antInt ;
    94         antenna = String( oss ) ;
    95       }
    96       else {
    97         antenna = msrec.asString( "antenna" ) ;
    98       }
    99     }
    100   }
     76  String antenna("0");
    10177
    10278  reader_ = getPKSreader(inName, antenna, 0, 0, format, beams, ifs,
     
    170146  Vector<Int> start(nIF_, 1);
    171147  Vector<Int> end(nIF_, 0);
     148  Bool getPt = False;
    172149  reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, getPt);
    173150  setHeader(header);
     
    286263    Int match = pksrec.srcName.matches(rx);
    287264    std::string srcname;
    288     Int srctype = Int(SrcType::NOTYPE);
    289265    if (match) {
    290266      srcname = pksrec.srcName;
    291       srctype =  Int(SrcType::PSOFF);
    292267    } else {
    293268      srcname = pksrec.srcName.before(rx2);
    294       srctype =  Int(SrcType::PSON);
    295     }
    296     if ( pksrec.srcType != Int(SrcType::NOTYPE)) {
     269    }
     270    Int srctype = match;
     271    if ( pksrec.srcType != -1 ) {
    297272      srctype = pksrec.srcType ;
    298273    }
  • trunk/src/PKSFiller.h

    r1947 r1848  
    2020#include <casa/Arrays/Vector.h>
    2121
    22 
    2322#include "FillerBase.h"
    2423#include "Scantable.h"
    2524
    26 class casa::Record;
    2725class PKSreader;
    2826
     
    3634    virtual ~PKSFiller();
    3735
    38     bool open(const std::string& filename, const casa::Record& rec);
    39     //    bool open(const std::string& filename);
     36//    bool open(const std::string& filename, const Record& rec)=0;
     37    bool open(const std::string& filename);
    4038    void fill();
    4139    void close();
  • trunk/src/SConscript

    r1947 r1848  
    88cpps = env.SGlob("*.cpp")
    99pycpps = env.SGlob("python_*.cpp")
    10 for pf in pycpps:
    11     cpps.remove(pf)
     10for pf in pycpps: cpps.remove(pf)
    1211
    1312# location of libcasav.a
     
    1918myenv.Prepend( LIBS =  ['asap'] )
    2019
    21 shenv = myenv.Clone()
    22 pyrapdir = shenv.get("pyrapint", None)
    23 if pyrapdir:
    24     shenv.PrependUnique(CPPPATH=pyrapdir)   
    25     pycpps += shenv.Glob('%s/pyrap/*/*.cc' % pyrapdir)
    2620# Finally create the library for the module
    27 if not hasattr(shenv, "LoadableModule"):
    28     shenv.LoadableModule = shenv.SharedLibrary
    29 so = shenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" )
    30 #test = shenv.Program("test", cpps)
     21if not hasattr(myenv, "LoadableModule"):
     22    myenv.LoadableModule = myenv.SharedLibrary
     23so = myenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" )
     24#test = myenv.Program("test", cpps)
    3125Return("so")
    3226
  • trunk/src/STFit.cpp

    r1947 r1848  
    7070  table_.addColumn(ArrayColumnDesc<Int>("COMPONENTS"));
    7171  table_.addColumn(ArrayColumnDesc<Double>("PARAMETERS"));
    72   //  table_.addColumn(ArrayColumnDesc<Double>("ERRORS"));
    7372  table_.addColumn(ArrayColumnDesc<Bool>("PARMASKS"));
    7473  table_.addColumn(ArrayColumnDesc<String>("FRAMEINFO"));
     
    7877  compCol_.attach(table_,"COMPONENTS");
    7978  parCol_.attach(table_,"PARAMETERS");
    80   //  errCol_.attach(table_,"ERRORS");
    8179  maskCol_.attach(table_,"PARMASKS");
    8280  frameCol_.attach(table_,"FRAMEINFO");
     
    104102  // add new row if new id
    105103  if ( !foundentry ) table_.addRow();
    106 
    107104  funcCol_.put(rno, mathutil::toVectorString(fit.getFunctions()));
    108105  compCol_.put(rno, Vector<Int>(fit.getComponents()));
    109   const std::vector<float>& pvec = fit.getParameters();
    110   Vector<Double> dvec(pvec.size());
    111   for (size_t i=0; i < dvec.nelements(); ++i) {
    112     dvec[i] = Double(pvec[i]);
    113   }
    114   parCol_.put(rno, dvec);
    115   /*
    116   const std::vector<double>& evec = fit.getErrors();
    117   for (size_t i=0; i < dvec.nelements(); ++i) {
    118     dvec[i] = Double(evec[i]);
    119   }
    120   errCol_.put(rno, dvec);
    121   */
     106  parCol_.put(rno, Vector<Double>(fit.getParameters()));
    122107  maskCol_.put(rno, Vector<Bool>(fit.getParmasks()));
    123108  frameCol_.put(rno, mathutil::toVectorString(fit.getFrameinfo()));
    124109  idCol_.put(rno, resultid);
    125 
    126110  return resultid;
    127111}
     
    146130  fit.setComponents(istl);
    147131  Vector<Double> dvec;
     132  std::vector<double> dstl;
    148133  rec.get("PARAMETERS", dvec);
    149   std::vector<float> dstl(dvec.begin(), dvec.end());
    150   fit.setParameters(dstl);
    151   /*
    152134  dvec.tovector(dstl);
    153135  fit.setParameters(dstl);
    154   dvec.resize();
    155   rec.get("ERRORS", dvec);
    156   dvec.tovector(dstl);
    157   fit.setErrors(dstl);
    158   */
    159136  Vector<Bool> bvec;
    160137  std::vector<bool> bstl;
  • trunk/src/STFit.h

    r1947 r1848  
    4949  casa::ArrayColumn<casa::Int> compCol_;
    5050  casa::ArrayColumn<casa::Double> parCol_;
    51   //  casa::ArrayColumn<casa::Double> errCol_;
    5251  casa::ArrayColumn<casa::Bool> maskCol_;
    5352  casa::ArrayColumn<casa::String> frameCol_;
  • trunk/src/STFitEntry.cpp

    r1947 r1848  
    1111//
    1212#include "STFitEntry.h"
    13 #include <casa/iostream.h>
    1413
    15 using namespace casa;
    1614namespace asap {
    1715
    18   STFitEntry::STFitEntry()
    19   /* :
    20     functions_( std::vector<std::string>()),
    21     components_(std::vector<int>()),
    22     parameters_(std::vector<float>()),
    23     errors_(std::vector<float>()),
    24     parmasks_(std::vector<bool>()),
    25     frameinfo_(std::vector<std::string>())
    26   */
     16STFitEntry::STFitEntry()
    2717{
    2818}
     
    3020{
    3121  if ( this != &other ) {
    32     this->functions_ = std::vector<std::string>();
     22    this->functions_ = other.functions_;
    3323    this->components_ = other.components_;
    3424    this->parameters_ = other.parameters_;
    35     this->errors_ = other.errors_;
     25    this->parmasks_ = other.parmasks_;
    3626    this->frameinfo_ = other.frameinfo_;
    3727  }
    3828}
    3929
    40 STFitEntry& STFitEntry::operator=(const STFitEntry& other)
    41 {
    42   if ( this != &other ) {
    43     this->functions_ = other.functions_;
    44     this->components_ = other.components_;
    45     this->parameters_ = other.parameters_;
    46     this->errors_ = other.errors_;
    47     this->parmasks_ = other.parmasks_;
    48     this->frameinfo_ = other.frameinfo_;
    49   }
    50   return *this;
    51 }
    5230
    5331STFitEntry::~STFitEntry()
  • trunk/src/STFitEntry.h

    r1947 r1848  
    2828  STFitEntry(const STFitEntry& other);
    2929
    30   STFitEntry& operator=(const STFitEntry& other);
    31 
    3230  ~STFitEntry();
    3331
     
    3634  void setComponents(const std::vector<int>& c)
    3735    { components_ = c; }
    38   void setParameters(const std::vector<float>& p)
     36  void setParameters(const std::vector<double>& p)
    3937    { parameters_ = p; }
    40   void setErrors(const std::vector<float>& p)
    41     { errors_ = p; }
    4238  void setParmasks(const std::vector<bool>& m)
    4339    { parmasks_ = m; }
    4440  void setFrameinfo(const std::vector<std::string>& f)
    4541    { frameinfo_ = f; }
     42
    4643  std::vector<std::string> getFunctions() const { return functions_; }
    4744  std::vector<int> getComponents() const { return components_; }
    48   std::vector<float> getParameters() const { return parameters_; }
    49   std::vector<float> getErrors() const { return errors_; }
     45  std::vector<double> getParameters() const { return parameters_; }
    5046  std::vector<bool> getParmasks() const { return parmasks_; }
    5147  std::vector<std::string> getFrameinfo() const { return frameinfo_; }
    5248
    5349private:
    54 
    5550  std::vector<std::string> functions_;
    5651  std::vector<int> components_;
    57   std::vector<float> parameters_;
    58   std::vector<float> errors_;
     52  std::vector<double> parameters_;
    5953  std::vector<bool> parmasks_;
    6054  std::vector<std::string> frameinfo_;
  • trunk/src/STFitter.cpp

    r1947 r1848  
    142142    if (ncomp < 1) throw (AipsError("Need at least one gaussian to fit."));
    143143    funcs_.resize(ncomp);
    144     funcnames_.clear();
    145     funccomponents_.clear();
    146144    for (Int k=0; k<ncomp; ++k) {
    147145      funcs_[k] = new Gaussian1D<Float>();
    148       funcnames_.push_back(expr);
    149       funccomponents_.push_back(3);
    150146    }
    151147  } else if (expr == "poly") {
    152148    funcs_.resize(1);
    153     funcnames_.clear();
    154     funccomponents_.clear();
    155149    funcs_[0] = new Polynomial<Float>(ncomp);
    156       funcnames_.push_back(expr);
    157       funccomponents_.push_back(ncomp);
    158150  } else if (expr == "lorentz") {
    159151    if (ncomp < 1) throw (AipsError("Need at least one lorentzian to fit."));
    160152    funcs_.resize(ncomp);
    161     funcnames_.clear();
    162     funccomponents_.clear();
    163153    for (Int k=0; k<ncomp; ++k) {
    164154      funcs_[k] = new Lorentzian1D<Float>();
    165       funcnames_.push_back(expr);
    166       funccomponents_.push_back(3);
    167155    }
    168156  } else {
     
    421409}
    422410
    423 STFitEntry Fitter::getFitEntry() const
    424 {
    425   STFitEntry fit;
    426   fit.setParameters(getParameters());
    427   fit.setErrors(getErrors());
    428   fit.setComponents(funccomponents_);
    429   fit.setFunctions(funcnames_);
    430   fit.setParmasks(getFixedParameters());
    431   return fit;
    432 }
  • trunk/src/STFitter.h

    r1947 r1848  
    4040#include <scimath/Functionals/CompoundFunction.h>
    4141
    42 #include "STFitEntry.h"
    43 
    4442namespace asap {
    4543
     
    7169
    7270  std::vector<float> evaluate(int whichComp) const;
    73 
    74   STFitEntry getFitEntry() const;
    75 
    7671private:
    7772  void clear();
     
    8075  casa::Vector<casa::Bool> m_;
    8176  casa::PtrBlock<casa::Function<casa::Float>* > funcs_;
    82   std::vector<std::string> funcnames_;
    83   std::vector<int> funccomponents_;
    84  
    8577  //Bool estimateSet_;
    8678  casa::Float chisquared_;
  • trunk/src/STMath.cpp

    r1947 r1848  
    17961796    out.push_back(outstat);
    17971797  }
    1798   return out;
    1799 }
    1800 
    1801 std::vector< float > STMath::statisticRow( const CountedPtr< Scantable > & in,
    1802                                         const std::vector< bool > & mask,
    1803                                         const std::string& which,
    1804                                         int row )
    1805 {
    1806 
    1807   Vector<Bool> m(mask);
    1808   const Table& tab = in->table();
    1809   ROArrayColumn<Float> specCol(tab, "SPECTRA");
    1810   ROArrayColumn<uChar> flagCol(tab, "FLAGTRA");
    1811   std::vector<float> out;
    1812 
    1813   Vector<Float> spec; specCol.get(row, spec);
    1814   Vector<uChar> flag; flagCol.get(row, flag);
    1815   MaskedArray<Float> ma  = maskedArray(spec, flag);
    1816   float outstat = 0.0;
    1817   if ( spec.nelements() == m.nelements() ) {
    1818     outstat = mathutil::statistics(which, ma(m));
    1819   } else {
    1820     outstat = mathutil::statistics(which, ma);
    1821   }
    1822   out.push_back(outstat);
    1823 
    18241798  return out;
    18251799}
  • trunk/src/STMath.h

    r1947 r1848  
    262262                                      const casa::CountedPtr<Scantable> &ref,
    263263                                      casa::Double choffset,
    264                                       casa::Double choffset2 = 0.0 );
     264                                      casa::Double choffset = 0.0 );
    265265
    266266  /**
     
    277277                               const std::vector<bool>& mask,
    278278                               const std::string& which);
    279 
    280   std::vector<float> statisticRow(const casa::CountedPtr<Scantable>& in,
    281                                const std::vector<bool>& mask,
    282                                const std::string& which,
    283                                int row);
    284279
    285280  std::vector< int > minMaxChan(const casa::CountedPtr<Scantable>& in,
  • trunk/src/STMathWrapper.h

    r1947 r1848  
    132132  { return STMath::statistic(in.getCP(), mask, which); }
    133133
    134   std::vector<float> statisticRow(const ScantableWrapper& in,
    135                                const std::vector<bool>& mask,
    136                                const std::string& which,
    137                                int row)
    138   { return STMath::statisticRow(in.getCP(), mask, which, row); }
    139 
    140134  std::vector<int> minMaxChan(const ScantableWrapper& in,
    141135                               const std::vector<bool>& mask,
  • trunk/src/STSelector.cpp

    r1947 r1848  
    270270}
    271271
    272 std::vector< int > asap::STSelector::getRows( ) const
    273 {
    274   return rowselection_ ;
    275 }
    276 
    277272std::string asap::STSelector::print( )
    278273{
  • trunk/src/STSelector.h

    r1947 r1848  
    5757  std::vector<int> getCycles() const;
    5858  std::vector<int> getTypes() const;
    59   std::vector<int> getRows() const;
    6059  std::vector<std::string> getPolTypes() const;
    6160  std::string getTaQL() const { return taql_; }
  • trunk/src/Scantable.cpp

    r1947 r1848  
    101101  fitTable_ = STFit(*this);
    102102  table_.rwKeywordSet().defineTable("FIT", fitTable_.table());
    103   table_.tableInfo().setType( "Scantable" ) ;
    104103  originalTable_ = table_;
    105104  attach();
     
    121120    table_ = tab;
    122121  }
    123   table_.tableInfo().setType( "Scantable" ) ;
    124122
    125123  attachSubtables();
     
    167165      table_.markForDelete();
    168166  }
    169   table_.tableInfo().setType( "Scantable" ) ;
    170167  /// @todo reindex SCANNO, recompute nbeam, nif, npol
    171168  if ( clear ) copySubtables(other);
     
    684681std::string Scantable::formatTime(const MEpoch& me, bool showdate) const
    685682{
    686   return formatTime(me, showdate, 0);
    687 }
    688 
    689 std::string Scantable::formatTime(const MEpoch& me, bool showdate, uInt prec) const
    690 {
    691683  MVTime mvt(me.getValue());
    692684  if (showdate)
    693     //mvt.setFormat(MVTime::YMD);
    694     mvt.setFormat(MVTime::YMD, prec);
     685    mvt.setFormat(MVTime::YMD);
    695686  else
    696     //mvt.setFormat(MVTime::TIME);
    697     mvt.setFormat(MVTime::TIME, prec);
     687    mvt.setFormat(MVTime::TIME);
    698688  ostringstream oss;
    699689  oss << mvt;
     
    10421032}
    10431033
    1044 // std::string Scantable::getTime(int whichrow, bool showdate) const
    1045 // {
    1046 //   MEpoch::ROScalarColumn timeCol(table_, "TIME");
    1047 //   MEpoch me;
    1048 //   if (whichrow > -1) {
    1049 //     me = timeCol(uInt(whichrow));
    1050 //   } else {
    1051 //     Double tm;
    1052 //     table_.keywordSet().get("UTC",tm);
    1053 //     me = MEpoch(MVEpoch(tm));
    1054 //   }
    1055 //   return formatTime(me, showdate);
    1056 // }
    1057 
    1058 std::string Scantable::getTime(int whichrow, bool showdate, uInt prec) const
    1059 {
     1034std::string Scantable::getTime(int whichrow, bool showdate) const
     1035{
     1036  MEpoch::ROScalarColumn timeCol(table_, "TIME");
    10601037  MEpoch me;
    1061   me = getEpoch(whichrow);
    1062   return formatTime(me, showdate, prec);
     1038  if (whichrow > -1) {
     1039    me = timeCol(uInt(whichrow));
     1040  } else {
     1041    Double tm;
     1042    table_.keywordSet().get("UTC",tm);
     1043    me = MEpoch(MVEpoch(tm));
     1044  }
     1045  return formatTime(me, showdate);
    10631046}
    10641047
     
    17261709}
    17271710
    1728 bool Scantable::getFlagtraFast(int whichrow)
    1729 {
    1730   uChar flag;
    1731   Vector<uChar> flags;
    1732   flagsCol_.get(uInt(whichrow), flags);
    1733   for (int i = 0; i < flags.size(); i++) {
    1734     if (i==0) {
    1735       flag = flags[i];
    1736     }
    1737     else {
    1738       flag &= flags[i];
    1739     }
    1740     return ((flag >> 7) == 1);
    1741    }
    1742 }
    1743 
    1744 void Scantable::doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter)
    1745 {
    1746   fitter.setExpression("poly", order);
    1747 
    1748   std::vector<double> abcsd = getAbcissa(rowno);
    1749   std::vector<float> abcs;
    1750   for (int i = 0; i < abcsd.size(); i++) {
    1751     abcs.push_back((float)abcsd[i]);
    1752   }
    1753   std::vector<float> spec = getSpectrum(rowno);
    1754   std::vector<bool> fmask = getMask(rowno);
    1755   if (fmask.size() != mask.size()) {
    1756     throw(AipsError("different mask sizes"));
    1757   }
    1758   for (int i = 0; i < fmask.size(); i++) {
    1759     fmask[i] = fmask[i] && mask[i];
    1760   }
    1761   fitter.setData(abcs, spec, fmask);
    1762 
    1763   fitter.lfit();
    1764 }
    1765 
    1766 void Scantable::polyBaselineBatch(const std::vector<bool>& mask, int order)
    1767 {
    1768   Fitter fitter = Fitter();
    1769   for (uInt rowno=0; rowno < nrow(); ++rowno) {
    1770     doPolyBaseline(mask, order, rowno, fitter);
    1771     setSpectrum(fitter.getResidual(), rowno);
    1772   }
    1773 }
    1774 
    1775 STFitEntry Scantable::polyBaseline(const std::vector<bool>& mask, int order, int rowno)
    1776 {
    1777   Fitter fitter = Fitter();
    1778   doPolyBaseline(mask, order, rowno, fitter);
    1779   setSpectrum(fitter.getResidual(), rowno);
    1780   return fitter.getFitEntry();
    1781 }
    1782 
    17831711}
    17841712//namespace asap
  • trunk/src/Scantable.h

    r1947 r1848  
    1818// AIPS++
    1919#include <casa/aips.h>
    20 #include <casa/Containers/Record.h>
    2120#include <casa/Arrays/MaskedArray.h>
    2221#include <casa/BasicSL/String.h>
     
    4847#include "STFit.h"
    4948#include "STFitEntry.h"
    50 #include "STFitter.h"
    5149
    5250namespace asap {
     
    368366
    369367  std::string summary(bool verbose=false);
    370   //std::string getTime(int whichrow=-1, bool showdate=true) const;
    371   std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const;
     368  std::string getTime(int whichrow=-1, bool showdate=true) const;
    372369  double getIntTime(int whichrow) const { return integrCol_(whichrow); }
    373370
     
    489486  void regridChannel( int nchan, double dnu, int irow ) ;
    490487
    491   bool getFlagtraFast(int whichrow);
    492 
    493   void polyBaselineBatch(const std::vector<bool>& mask, int order);
    494   STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno);
    495488
    496489private:
     
    506499
    507500  std::string formatTime(const casa::MEpoch& me, bool showdate)const;
    508   std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
    509501
    510502  /**
     
    514506   */
    515507  std::string formatDirection(const casa::MDirection& md) const;
     508
    516509
    517510  /**
     
    605598                                                      const casa::String&,
    606599                                                      const casa::Array<T2>&);
    607 
    608   void doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter);
    609600};
    610601
  • trunk/src/ScantableWrapper.h

    r1947 r1848  
    1919#include "MathUtils.h"
    2020#include "STFit.h"
    21 #include "STFitEntry.h"
    2221#include "Scantable.h"
    2322#include "STCoordinate.h"
     
    8483    { return table_->getTsys(whichrow); }
    8584
    86   //std::string getTime(int whichrow=0) const
    87   //  { return table_->getTime(whichrow); }
    88   std::string getTime(int whichrow=0, int prec = 0) const
    89     { return table_->getTime(whichrow, true, casa::uInt(prec)); }
     85  std::string getTime(int whichrow=0) const
     86    { return table_->getTime(whichrow); }
    9087
    9188  double getIntTime(int whichrow=0) const
     
    253250  { table_->reshapeSpectrum( nmin, nmax ); }
    254251
    255   STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno)
    256   { return table_->polyBaseline(mask, order, rowno); }
    257 
    258   void polyBaselineBatch(const std::vector<bool>& mask, int order)
    259   { table_->polyBaselineBatch(mask, order); }
    260 
    261   bool getFlagtraFast(int whichrow=0) const
    262     { return table_->getFlagtraFast(whichrow); }
    263 
    264 
    265252private:
    266253  casa::CountedPtr<Scantable> table_;
  • trunk/src/python_LogSink.cpp

    r1947 r1848  
    4141        .def( init <> () )
    4242        .def("post", &AsapLogSink::postMessage,
    43          (boost::python::arg("priority")="INFO",
    44          boost::python::arg("origin")=""))
     43         (boost::python::arg("location")="",
     44         boost::python::arg("priority")="INFO"))
    4545        .def("pop", &AsapLogSink::popMessages)
    4646      ;
  • trunk/src/python_STFitEntry.cpp

    r1947 r1848  
    4444        .def("getfixedparameters", &STFitEntry::getParmasks)
    4545        .def("getparameters", &STFitEntry::getParameters)
    46         .def("geterrors", &STFitEntry::getErrors)
    4746        .def("getfunctions", &STFitEntry::getFunctions)
    4847        .def("getcomponents", &STFitEntry::getComponents)
     
    5049        .def("setfixedparameters", &STFitEntry::setParmasks)
    5150        .def("setparameters", &STFitEntry::setParameters)
    52         .def("seterrors", &STFitEntry::setErrors)
    5351        .def("setfunctions", &STFitEntry::setFunctions)
    5452        .def("setcomponents", &STFitEntry::setComponents)
  • trunk/src/python_STMath.cpp

    r1947 r1848  
    5959        .def("_dofs", &STMathWrapper::dofs)
    6060        .def("_stats", &STMathWrapper::statistic)
    61         .def("_statsrow", &STMathWrapper::statisticRow)
    6261        .def("_minmaxchan", &STMathWrapper::minMaxChan)
    6362        .def("_freqswitch", &STMathWrapper::freqSwitch)
  • trunk/src/python_STSelector.cpp

    r1947 r1848  
    3030        .def("_getcycles", &STSelector::getCycles)
    3131        .def("_gettypes", &STSelector::getTypes)
    32         .def("_getrows", &STSelector::getRows)
    3332        .def("_gettaql", &STSelector::getTaQL)
    3433        .def("_getorder", &STSelector::getSortOrder)
  • trunk/src/python_Scantable.cpp

    r1947 r1848  
    9999    .def("_getparangle", &ScantableWrapper::getParAngle,
    100100         (boost::python::arg("whichrow")=0) )
    101     //.def("_gettime", &ScantableWrapper::getTime,
    102     //     (boost::python::arg("whichrow")=0) )
    103101    .def("_gettime", &ScantableWrapper::getTime,
    104          (boost::python::arg("whichrow")=0,
    105           boost::python::arg("prec")=0) )
     102         (boost::python::arg("whichrow")=0) )
    106103    .def("_getinttime", &ScantableWrapper::getIntTime,
    107104         (boost::python::arg("whichrow")=0) )
     
    142139         (boost::python::arg("nmin")=-1,
    143140          boost::python::arg("nmax")=-1) )
    144     .def("_poly_baseline", &ScantableWrapper::polyBaseline)
    145     .def("_poly_baseline_batch", &ScantableWrapper::polyBaselineBatch)
    146     .def("_getflagtrafast", &ScantableWrapper::getFlagtraFast,
    147          (boost::python::arg("whichrow")=0) )
    148141  ;
    149142};
  • trunk/src/python_asap.cpp

    r1947 r1848  
    4444  #include <pyrap/Converters/PycExcp.h>
    4545  #include <pyrap/Converters/PycBasicData.h>
    46   #include <pyrap/Converters/PycValueHolder.h>
    47   #include <pyrap/Converters/PycRecord.h>
    4846#endif
    4947
     
    110108  casa::pyrap::register_convert_basicdata();
    111109  casa::pyrap::register_convert_std_vector<asap::ScantableWrapper>();
    112   casa::pyrap::register_convert_std_vector<int>();
    113   casa::pyrap::register_convert_std_vector<uint>();
    114   casa::pyrap::register_convert_std_vector<float>();
    115   casa::pyrap::register_convert_std_vector<double>();
    116   casa::pyrap::register_convert_std_vector<std::string>();
    117   casa::pyrap::register_convert_std_vector<bool>();
    118   casa::pyrap::register_convert_casa_valueholder();
    119   casa::pyrap::register_convert_casa_record();
    120110#endif
    121111}
Note: See TracChangeset for help on using the changeset viewer.