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