Changes in trunk/src [1947:1848]
- Location:
- trunk/src
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/AsapLogSink.cpp
r1947 r1848 21 21 22 22 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) 25 25 { 26 26 LogMessage::Priority p; … … 32 32 p = LogMessage::SEVERE; 33 33 } 34 LogMessage message(msg, LogOrigin( origin), p);34 LogMessage message(msg, LogOrigin(location), p); 35 35 36 36 MemoryLogSink::postLocally(message); -
trunk/src/AsapLogSink.h
r1947 r1848 37 37 38 38 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"); 41 41 42 42 std::string popMessages(); -
trunk/src/FillerBase.cpp
r1947 r1848 38 38 RecordFieldPtr< Array<Float> > tsysCol(row_.record(), "TSYS"); 39 39 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; 46 43 } 47 44 -
trunk/src/FillerBase.h
r1947 r1848 43 43 virtual ~FillerBase() {;} 44 44 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; 47 47 virtual void fill() = 0; 48 48 virtual void close() = 0; -
trunk/src/FillerWrapper.h
r1947 r1848 16 16 #include <casa/Exceptions.h> 17 17 #include <casa/Utilities/CountedPtr.h> 18 #include <casa/Containers/Record.h>19 18 #include <casa/OS/File.h> 20 19 … … 39 38 40 39 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) { 43 42 casa::File file(filename); 44 43 if ( !file.exists() ) { … … 46 45 } 47 46 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)) { 50 49 attached_ = true; 51 50 return; 52 51 } 53 52 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)) { 56 55 attached_ = true; 57 56 return; -
trunk/src/Makefile
r1947 r1848 7 7 ### 3. Replase library names in G2CARCH '-lcasa_*' with '-l*'. 8 8 ### 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 10 TARGET := /home/nakazato/tmp/_asap.so 15 11 16 12 # the casa environment AIPSPATH has to be defined 17 13 CASAROOT := $(word 1, $(CASAPATH)) 18 14 CASAARCH := $(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)23 15 24 16 COREINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=COREINCD eval_vars) && echo $$COREINCD) … … 30 22 PYTHONINCD := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=PYTHONINCD eval_vars) && echo $$PYTHONINCD) 31 23 PYTHONLIB := $(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) 32 25 BOOSTROOT := $(shell $(shell make -s -f $(CASAROOT)/$(CASAARCH)/makedefs VARS=BOOSTROOT eval_vars) && echo $$BOOSTROOT) 33 26 RPFITSLIBD := $(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)36 27 37 28 CASAINC := -I$(CASAROOT)/code/include -I$(COREINCD) -I$(CASAROOT)/$(CASAARCH)/include 38 29 CASALIB := $(CASAROOT)/$(CASAARCH)/lib 30 #USELIB := lib64 31 USELIB := lib 39 32 40 33 # the compiler … … 44 37 45 38 # 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 39 CXXFLAGS := -fPIC -O3 -g 40 CXXFLAGS += -ansi -Wno-long-long -Wall 41 #CXXOPTS := -DAIPS_64B 42 43 # darwin specific flags 44 ifeq "$(CASAARCH)" "darwin" 45 #CXXFLAGS +=-DAIPS_DARWIN -arch i386 #For 10.6 46 CXXFLAGS +=-DAIPS_DARWIN 47 #CXXFLAGS += -Wno-long-double 48 endif 49 50 # cfitsio 51 CFITSIOROOT := /usr 52 CFITSIOINC := -I$(CFITSIOROOT)/include/cfitsio 54 53 CFITSIOLIB := -lcfitsio 55 54 56 55 #rpfits 56 RPFITSROOT := /usr 57 57 RPFITSLIB := -lrpfits 58 58 … … 60 60 G2CLIB := -lgfortran 61 61 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. 64 CASAPPLIB := -L$(CASALIB) -latnf $(CORELIB) \ 64 65 -L$(WCSLIBLIBD) $(WCSLIBLIB) \ 65 66 -L$(RPFITSLIBD) $(RPFITSLIB) $(CFITSIOLIB) $(G2CLIB) -lstdc++ 66 67 67 68 # darwin specific CASA flags 68 ifeq ($(shell uname), Darwin)69 ifeq "$(CASAARCH)" "darwin" 69 70 CASAPPLIB += -framework vecLib 70 71 else … … 72 73 endif 73 74 75 # python 76 PYTHONINC := $(addprefix -I,$(PYTHONINCD)) 77 PYTHONLIB := -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 74 88 LD := $(CXX) 75 89 … … 78 92 BOOSTINC := -I$(BOOSTROOT)/include/boost -I$(BOOSTROOT)/include 79 93 80 LDFLAGS += -shared 94 LDFLAGS := -shared -Wl$(TARGET) -s -Xlinker -rpath -Xlinker $(BOOSTROOT)/lib:$(PYTHONROOT)/lib:$(CASALIB) 95 ifeq "$(CASAARCH)" "darwin" 96 LDFLAGS := -bundle 97 endif 81 98 82 99 83 100 # DO NOT MODIFY AFTER THIS 84 INCDIRS := -I. $(CASAINC) -I$(CFITSIOINCD) $(BOOSTINC) $(addprefix -I, $(PYTHONINCD)) -I$(ASAPROOT)/$(ATNFD) -I$(PYRAPINCD)101 INCDIRS := -I. $(CASAINC) $(CFITSIOINC) $(BOOSTINC) $(PYTHONINC) 85 102 LIBS := $(PYTHONLIB) $(BOOSTLIB) $(CASAPPLIB) 86 103 -
trunk/src/NROFiller.cpp
r1947 r1848 20 20 #include "NROFiller.h" 21 21 #include "STHeader.h" 22 #include <casa/Containers/Record.h>23 22 #include <atnf/PKSIO/SrcType.h> 24 23 … … 37 36 } 38 37 39 bool NROFiller::open(const std::string& filename, const Record& rec)38 bool NROFiller::open(const std::string& filename) 40 39 { 41 40 bool status = true ; -
trunk/src/NROFiller.h
r1947 r1848 45 45 virtual ~NROFiller(); 46 46 47 bool open(const std::string& filename , const casa::Record& rec) ;47 bool open(const std::string& filename) ; 48 48 void fill() ; 49 49 void close() ; -
trunk/src/PKSFiller.cpp
r1947 r1848 20 20 #include <casa/Arrays/ArrayLogical.h> 21 21 #include <casa/Utilities/Regex.h> 22 #include <casa/Utilities/DataType.h>23 22 #include <casa/Logging/LogIO.h> 24 23 25 #include <casa/Containers/Record.h>26 24 #include <measures/Measures/MDirection.h> 27 25 #include <measures/Measures/MeasConvert.h> … … 36 34 37 35 #include <time.h> 38 #include <sstream>39 36 40 37 #include "STDefs.h" … … 61 58 } 62 59 63 bool PKSFiller::open( const std::string& filename , const Record& rec)60 bool PKSFiller::open( const std::string& filename) 64 61 { 65 62 Bool haveBase, haveSpectra; … … 77 74 Vector<uInt> nchans,npols; 78 75 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"); 101 77 102 78 reader_ = getPKSreader(inName, antenna, 0, 0, format, beams, ifs, … … 170 146 Vector<Int> start(nIF_, 1); 171 147 Vector<Int> end(nIF_, 0); 148 Bool getPt = False; 172 149 reader_->select(beams, ifs, start, end, ref, True, haveXPol_[0], False, getPt); 173 150 setHeader(header); … … 286 263 Int match = pksrec.srcName.matches(rx); 287 264 std::string srcname; 288 Int srctype = Int(SrcType::NOTYPE);289 265 if (match) { 290 266 srcname = pksrec.srcName; 291 srctype = Int(SrcType::PSOFF);292 267 } else { 293 268 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 ) { 297 272 srctype = pksrec.srcType ; 298 273 } -
trunk/src/PKSFiller.h
r1947 r1848 20 20 #include <casa/Arrays/Vector.h> 21 21 22 23 22 #include "FillerBase.h" 24 23 #include "Scantable.h" 25 24 26 class casa::Record;27 25 class PKSreader; 28 26 … … 36 34 virtual ~PKSFiller(); 37 35 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); 40 38 void fill(); 41 39 void close(); -
trunk/src/SConscript
- Property svn:mergeinfo changed
/branches/asap4casa3.1.0/src/SConscript removed
r1947 r1848 8 8 cpps = env.SGlob("*.cpp") 9 9 pycpps = env.SGlob("python_*.cpp") 10 for pf in pycpps: 11 cpps.remove(pf) 10 for pf in pycpps: cpps.remove(pf) 12 11 13 12 # location of libcasav.a … … 19 18 myenv.Prepend( LIBS = ['asap'] ) 20 19 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)26 20 # Finally create the library for the module 27 if not hasattr( shenv, "LoadableModule"):28 shenv.LoadableModule = shenv.SharedLibrary29 so = shenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" )30 #test = shenv.Program("test", cpps)21 if not hasattr(myenv, "LoadableModule"): 22 myenv.LoadableModule = myenv.SharedLibrary 23 so = myenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" ) 24 #test = myenv.Program("test", cpps) 31 25 Return("so") 32 26 - Property svn:mergeinfo changed
-
trunk/src/STFit.cpp
r1947 r1848 70 70 table_.addColumn(ArrayColumnDesc<Int>("COMPONENTS")); 71 71 table_.addColumn(ArrayColumnDesc<Double>("PARAMETERS")); 72 // table_.addColumn(ArrayColumnDesc<Double>("ERRORS"));73 72 table_.addColumn(ArrayColumnDesc<Bool>("PARMASKS")); 74 73 table_.addColumn(ArrayColumnDesc<String>("FRAMEINFO")); … … 78 77 compCol_.attach(table_,"COMPONENTS"); 79 78 parCol_.attach(table_,"PARAMETERS"); 80 // errCol_.attach(table_,"ERRORS");81 79 maskCol_.attach(table_,"PARMASKS"); 82 80 frameCol_.attach(table_,"FRAMEINFO"); … … 104 102 // add new row if new id 105 103 if ( !foundentry ) table_.addRow(); 106 107 104 funcCol_.put(rno, mathutil::toVectorString(fit.getFunctions())); 108 105 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())); 122 107 maskCol_.put(rno, Vector<Bool>(fit.getParmasks())); 123 108 frameCol_.put(rno, mathutil::toVectorString(fit.getFrameinfo())); 124 109 idCol_.put(rno, resultid); 125 126 110 return resultid; 127 111 } … … 146 130 fit.setComponents(istl); 147 131 Vector<Double> dvec; 132 std::vector<double> dstl; 148 133 rec.get("PARAMETERS", dvec); 149 std::vector<float> dstl(dvec.begin(), dvec.end());150 fit.setParameters(dstl);151 /*152 134 dvec.tovector(dstl); 153 135 fit.setParameters(dstl); 154 dvec.resize();155 rec.get("ERRORS", dvec);156 dvec.tovector(dstl);157 fit.setErrors(dstl);158 */159 136 Vector<Bool> bvec; 160 137 std::vector<bool> bstl; -
trunk/src/STFit.h
r1947 r1848 49 49 casa::ArrayColumn<casa::Int> compCol_; 50 50 casa::ArrayColumn<casa::Double> parCol_; 51 // casa::ArrayColumn<casa::Double> errCol_;52 51 casa::ArrayColumn<casa::Bool> maskCol_; 53 52 casa::ArrayColumn<casa::String> frameCol_; -
trunk/src/STFitEntry.cpp
r1947 r1848 11 11 // 12 12 #include "STFitEntry.h" 13 #include <casa/iostream.h>14 13 15 using namespace casa;16 14 namespace asap { 17 15 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 */ 16 STFitEntry::STFitEntry() 27 17 { 28 18 } … … 30 20 { 31 21 if ( this != &other ) { 32 this->functions_ = std::vector<std::string>();22 this->functions_ = other.functions_; 33 23 this->components_ = other.components_; 34 24 this->parameters_ = other.parameters_; 35 this-> errors_ = other.errors_;25 this->parmasks_ = other.parmasks_; 36 26 this->frameinfo_ = other.frameinfo_; 37 27 } 38 28 } 39 29 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 }52 30 53 31 STFitEntry::~STFitEntry() -
trunk/src/STFitEntry.h
r1947 r1848 28 28 STFitEntry(const STFitEntry& other); 29 29 30 STFitEntry& operator=(const STFitEntry& other);31 32 30 ~STFitEntry(); 33 31 … … 36 34 void setComponents(const std::vector<int>& c) 37 35 { components_ = c; } 38 void setParameters(const std::vector< float>& p)36 void setParameters(const std::vector<double>& p) 39 37 { parameters_ = p; } 40 void setErrors(const std::vector<float>& p)41 { errors_ = p; }42 38 void setParmasks(const std::vector<bool>& m) 43 39 { parmasks_ = m; } 44 40 void setFrameinfo(const std::vector<std::string>& f) 45 41 { frameinfo_ = f; } 42 46 43 std::vector<std::string> getFunctions() const { return functions_; } 47 44 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_; } 50 46 std::vector<bool> getParmasks() const { return parmasks_; } 51 47 std::vector<std::string> getFrameinfo() const { return frameinfo_; } 52 48 53 49 private: 54 55 50 std::vector<std::string> functions_; 56 51 std::vector<int> components_; 57 std::vector<float> parameters_; 58 std::vector<float> errors_; 52 std::vector<double> parameters_; 59 53 std::vector<bool> parmasks_; 60 54 std::vector<std::string> frameinfo_; -
trunk/src/STFitter.cpp
r1947 r1848 142 142 if (ncomp < 1) throw (AipsError("Need at least one gaussian to fit.")); 143 143 funcs_.resize(ncomp); 144 funcnames_.clear();145 funccomponents_.clear();146 144 for (Int k=0; k<ncomp; ++k) { 147 145 funcs_[k] = new Gaussian1D<Float>(); 148 funcnames_.push_back(expr);149 funccomponents_.push_back(3);150 146 } 151 147 } else if (expr == "poly") { 152 148 funcs_.resize(1); 153 funcnames_.clear();154 funccomponents_.clear();155 149 funcs_[0] = new Polynomial<Float>(ncomp); 156 funcnames_.push_back(expr);157 funccomponents_.push_back(ncomp);158 150 } else if (expr == "lorentz") { 159 151 if (ncomp < 1) throw (AipsError("Need at least one lorentzian to fit.")); 160 152 funcs_.resize(ncomp); 161 funcnames_.clear();162 funccomponents_.clear();163 153 for (Int k=0; k<ncomp; ++k) { 164 154 funcs_[k] = new Lorentzian1D<Float>(); 165 funcnames_.push_back(expr);166 funccomponents_.push_back(3);167 155 } 168 156 } else { … … 421 409 } 422 410 423 STFitEntry Fitter::getFitEntry() const424 {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 40 40 #include <scimath/Functionals/CompoundFunction.h> 41 41 42 #include "STFitEntry.h"43 44 42 namespace asap { 45 43 … … 71 69 72 70 std::vector<float> evaluate(int whichComp) const; 73 74 STFitEntry getFitEntry() const;75 76 71 private: 77 72 void clear(); … … 80 75 casa::Vector<casa::Bool> m_; 81 76 casa::PtrBlock<casa::Function<casa::Float>* > funcs_; 82 std::vector<std::string> funcnames_;83 std::vector<int> funccomponents_;84 85 77 //Bool estimateSet_; 86 78 casa::Float chisquared_; -
trunk/src/STMath.cpp
r1947 r1848 1796 1796 out.push_back(outstat); 1797 1797 } 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 1824 1798 return out; 1825 1799 } -
trunk/src/STMath.h
r1947 r1848 262 262 const casa::CountedPtr<Scantable> &ref, 263 263 casa::Double choffset, 264 casa::Double choffset 2= 0.0 );264 casa::Double choffset = 0.0 ); 265 265 266 266 /** … … 277 277 const std::vector<bool>& mask, 278 278 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);284 279 285 280 std::vector< int > minMaxChan(const casa::CountedPtr<Scantable>& in, -
trunk/src/STMathWrapper.h
r1947 r1848 132 132 { return STMath::statistic(in.getCP(), mask, which); } 133 133 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 140 134 std::vector<int> minMaxChan(const ScantableWrapper& in, 141 135 const std::vector<bool>& mask, -
trunk/src/STSelector.cpp
r1947 r1848 270 270 } 271 271 272 std::vector< int > asap::STSelector::getRows( ) const273 {274 return rowselection_ ;275 }276 277 272 std::string asap::STSelector::print( ) 278 273 { -
trunk/src/STSelector.h
r1947 r1848 57 57 std::vector<int> getCycles() const; 58 58 std::vector<int> getTypes() const; 59 std::vector<int> getRows() const;60 59 std::vector<std::string> getPolTypes() const; 61 60 std::string getTaQL() const { return taql_; } -
trunk/src/Scantable.cpp
r1947 r1848 101 101 fitTable_ = STFit(*this); 102 102 table_.rwKeywordSet().defineTable("FIT", fitTable_.table()); 103 table_.tableInfo().setType( "Scantable" ) ;104 103 originalTable_ = table_; 105 104 attach(); … … 121 120 table_ = tab; 122 121 } 123 table_.tableInfo().setType( "Scantable" ) ;124 122 125 123 attachSubtables(); … … 167 165 table_.markForDelete(); 168 166 } 169 table_.tableInfo().setType( "Scantable" ) ;170 167 /// @todo reindex SCANNO, recompute nbeam, nif, npol 171 168 if ( clear ) copySubtables(other); … … 684 681 std::string Scantable::formatTime(const MEpoch& me, bool showdate) const 685 682 { 686 return formatTime(me, showdate, 0);687 }688 689 std::string Scantable::formatTime(const MEpoch& me, bool showdate, uInt prec) const690 {691 683 MVTime mvt(me.getValue()); 692 684 if (showdate) 693 //mvt.setFormat(MVTime::YMD); 694 mvt.setFormat(MVTime::YMD, prec); 685 mvt.setFormat(MVTime::YMD); 695 686 else 696 //mvt.setFormat(MVTime::TIME); 697 mvt.setFormat(MVTime::TIME, prec); 687 mvt.setFormat(MVTime::TIME); 698 688 ostringstream oss; 699 689 oss << mvt; … … 1042 1032 } 1043 1033 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 { 1034 std::string Scantable::getTime(int whichrow, bool showdate) const 1035 { 1036 MEpoch::ROScalarColumn timeCol(table_, "TIME"); 1060 1037 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); 1063 1046 } 1064 1047 … … 1726 1709 } 1727 1710 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 1783 1711 } 1784 1712 //namespace asap -
trunk/src/Scantable.h
r1947 r1848 18 18 // AIPS++ 19 19 #include <casa/aips.h> 20 #include <casa/Containers/Record.h>21 20 #include <casa/Arrays/MaskedArray.h> 22 21 #include <casa/BasicSL/String.h> … … 48 47 #include "STFit.h" 49 48 #include "STFitEntry.h" 50 #include "STFitter.h"51 49 52 50 namespace asap { … … 368 366 369 367 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; 372 369 double getIntTime(int whichrow) const { return integrCol_(whichrow); } 373 370 … … 489 486 void regridChannel( int nchan, double dnu, int irow ) ; 490 487 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);495 488 496 489 private: … … 506 499 507 500 std::string formatTime(const casa::MEpoch& me, bool showdate)const; 508 std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;509 501 510 502 /** … … 514 506 */ 515 507 std::string formatDirection(const casa::MDirection& md) const; 508 516 509 517 510 /** … … 605 598 const casa::String&, 606 599 const casa::Array<T2>&); 607 608 void doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter);609 600 }; 610 601 -
trunk/src/ScantableWrapper.h
r1947 r1848 19 19 #include "MathUtils.h" 20 20 #include "STFit.h" 21 #include "STFitEntry.h"22 21 #include "Scantable.h" 23 22 #include "STCoordinate.h" … … 84 83 { return table_->getTsys(whichrow); } 85 84 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); } 90 87 91 88 double getIntTime(int whichrow=0) const … … 253 250 { table_->reshapeSpectrum( nmin, nmax ); } 254 251 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) const262 { return table_->getFlagtraFast(whichrow); }263 264 265 252 private: 266 253 casa::CountedPtr<Scantable> table_; -
trunk/src/python_LogSink.cpp
r1947 r1848 41 41 .def( init <> () ) 42 42 .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")) 45 45 .def("pop", &AsapLogSink::popMessages) 46 46 ; -
trunk/src/python_STFitEntry.cpp
r1947 r1848 44 44 .def("getfixedparameters", &STFitEntry::getParmasks) 45 45 .def("getparameters", &STFitEntry::getParameters) 46 .def("geterrors", &STFitEntry::getErrors)47 46 .def("getfunctions", &STFitEntry::getFunctions) 48 47 .def("getcomponents", &STFitEntry::getComponents) … … 50 49 .def("setfixedparameters", &STFitEntry::setParmasks) 51 50 .def("setparameters", &STFitEntry::setParameters) 52 .def("seterrors", &STFitEntry::setErrors)53 51 .def("setfunctions", &STFitEntry::setFunctions) 54 52 .def("setcomponents", &STFitEntry::setComponents) -
trunk/src/python_STMath.cpp
r1947 r1848 59 59 .def("_dofs", &STMathWrapper::dofs) 60 60 .def("_stats", &STMathWrapper::statistic) 61 .def("_statsrow", &STMathWrapper::statisticRow)62 61 .def("_minmaxchan", &STMathWrapper::minMaxChan) 63 62 .def("_freqswitch", &STMathWrapper::freqSwitch) -
trunk/src/python_STSelector.cpp
r1947 r1848 30 30 .def("_getcycles", &STSelector::getCycles) 31 31 .def("_gettypes", &STSelector::getTypes) 32 .def("_getrows", &STSelector::getRows)33 32 .def("_gettaql", &STSelector::getTaQL) 34 33 .def("_getorder", &STSelector::getSortOrder) -
trunk/src/python_Scantable.cpp
r1947 r1848 99 99 .def("_getparangle", &ScantableWrapper::getParAngle, 100 100 (boost::python::arg("whichrow")=0) ) 101 //.def("_gettime", &ScantableWrapper::getTime,102 // (boost::python::arg("whichrow")=0) )103 101 .def("_gettime", &ScantableWrapper::getTime, 104 (boost::python::arg("whichrow")=0, 105 boost::python::arg("prec")=0) ) 102 (boost::python::arg("whichrow")=0) ) 106 103 .def("_getinttime", &ScantableWrapper::getIntTime, 107 104 (boost::python::arg("whichrow")=0) ) … … 142 139 (boost::python::arg("nmin")=-1, 143 140 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) )148 141 ; 149 142 }; -
trunk/src/python_asap.cpp
r1947 r1848 44 44 #include <pyrap/Converters/PycExcp.h> 45 45 #include <pyrap/Converters/PycBasicData.h> 46 #include <pyrap/Converters/PycValueHolder.h>47 #include <pyrap/Converters/PycRecord.h>48 46 #endif 49 47 … … 110 108 casa::pyrap::register_convert_basicdata(); 111 109 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();120 110 #endif 121 111 }
Note:
See TracChangeset
for help on using the changeset viewer.