- Timestamp:
- 03/08/06 13:32:27 (19 years ago)
- Location:
- trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDFITSImageWriter.h
r717 r890 40 40 namespace asap { 41 41 42 class SDFITSImageWriter : public SDLog{42 class SDFITSImageWriter : public Logger { 43 43 public: 44 44 // Constructor -
trunk/src/SDFitter.cc
r612 r890 1 1 //#--------------------------------------------------------------------------- 2 //# SDFitter.cc: A Fitter class for spectra2 //# Fitter.cc: A Fitter class for spectra 3 3 //#-------------------------------------------------------------------------- 4 4 //# Copyright (C) 2004 … … 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id: 29 //# $Id:$ 30 30 //#--------------------------------------------------------------------------- 31 31 #include <casa/aips.h> … … 47 47 using namespace casa; 48 48 49 SDFitter::SDFitter()50 { 51 } 52 53 SDFitter::~SDFitter()49 Fitter::Fitter() 50 { 51 } 52 53 Fitter::~Fitter() 54 54 { 55 55 reset(); 56 56 } 57 57 58 void SDFitter::clear()58 void Fitter::clear() 59 59 { 60 60 for (uInt i=0;i< funcs_.nelements();++i) { … … 69 69 } 70 70 71 void SDFitter::reset()71 void Fitter::reset() 72 72 { 73 73 clear(); … … 78 78 79 79 80 bool SDFitter::computeEstimate() {80 bool Fitter::computeEstimate() { 81 81 if (x_.nelements() == 0 || y_.nelements() == 0) 82 82 throw (AipsError("No x/y data specified.")); … … 122 122 } 123 123 124 std::vector<float> SDFitter::getEstimate() const124 std::vector<float> Fitter::getEstimate() const 125 125 { 126 126 if (estimate_.nelements() == 0) … … 132 132 133 133 134 bool SDFitter::setExpression(const std::string& expr, int ncomp)134 bool Fitter::setExpression(const std::string& expr, int ncomp) 135 135 { 136 136 clear(); … … 154 154 } 155 155 156 bool SDFitter::setData(std::vector<float> absc, std::vector<float> spec,156 bool Fitter::setData(std::vector<float> absc, std::vector<float> spec, 157 157 std::vector<bool> mask) 158 158 { … … 171 171 } 172 172 173 std::vector<float> SDFitter::getResidual() const173 std::vector<float> Fitter::getResidual() const 174 174 { 175 175 if (residual_.nelements() == 0) … … 180 180 } 181 181 182 std::vector<float> SDFitter::getFit() const182 std::vector<float> Fitter::getFit() const 183 183 { 184 184 Vector<Float> out = thefit_; … … 189 189 } 190 190 191 std::vector<float> SDFitter::getErrors() const191 std::vector<float> Fitter::getErrors() const 192 192 { 193 193 Vector<Float> out = error_; … … 197 197 } 198 198 199 bool SDFitter::setParameters(std::vector<float> params)199 bool Fitter::setParameters(std::vector<float> params) 200 200 { 201 201 Vector<Float> tmppar(params); … … 226 226 } 227 227 228 bool SDFitter::setFixedParameters(std::vector<bool> fixed)228 bool Fitter::setFixedParameters(std::vector<bool> fixed) 229 229 { 230 230 Vector<Bool> tmp(fixed); … … 252 252 } 253 253 254 std::vector<float> SDFitter::getParameters() const {254 std::vector<float> Fitter::getParameters() const { 255 255 Vector<Float> out = parameters_; 256 256 std::vector<float> stlout; … … 259 259 } 260 260 261 std::vector<bool> SDFitter::getFixedParameters() const {261 std::vector<bool> Fitter::getFixedParameters() const { 262 262 Vector<Bool> out(parameters_.nelements()); 263 263 if (fixedpar_.nelements() == 0) { … … 272 272 } 273 273 274 float SDFitter::getChisquared() const {274 float Fitter::getChisquared() const { 275 275 return chisquared_; 276 276 } 277 277 278 bool SDFitter::fit() {278 bool Fitter::fit() { 279 279 NonLinearFitLM<Float> fitter; 280 280 CompoundFunction<Float> func; … … 293 293 Vector<Float> sigma(x_.nelements()); 294 294 sigma = 1.0; 295 295 296 296 parameters_.resize(); 297 297 parameters_ = fitter.fit(x_, y_, sigma, &m_); … … 304 304 305 305 chisquared_ = fitter.getChi2(); 306 306 307 307 residual_.resize(); 308 308 residual_ = y_; … … 316 316 317 317 318 std::vector<float> SDFitter::evaluate(int whichComp) const319 { 318 std::vector<float> Fitter::evaluate(int whichComp) const 319 { 320 320 std::vector<float> stlout; 321 uInt idx = uInt(whichComp); 321 uInt idx = uInt(whichComp); 322 322 Float y; 323 323 if ( idx < funcs_.nelements() ) { -
trunk/src/SDFitter.h
r517 r890 1 1 //#--------------------------------------------------------------------------- 2 //# SDFitter.h: A Fitter class for spectra2 //# Fitter.h: A Fitter class for spectra 3 3 //#--------------------------------------------------------------------------- 4 4 //# Copyright (C) 2004 … … 42 42 namespace asap { 43 43 44 class SDFitter {44 class Fitter { 45 45 public: 46 SDFitter();47 virtual ~ SDFitter();46 Fitter(); 47 virtual ~Fitter(); 48 48 // allowed "gauss" and "poly". ncomp is either numvber of gaussions 49 49 // or order of the polynomial -
trunk/src/SDLineFinder.cc
r881 r890 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id :$29 //# $Id$ 30 30 //#--------------------------------------------------------------------------- 31 31 … … 766 766 767 767 // auxiliary function to fit and subtract a polynomial from the current 768 // spectrum. It uses the SDFitter class. This action is required before768 // spectrum. It uses the Fitter class. This action is required before 769 769 // reducing the spectral resolution if the baseline shape is bad 770 770 void STLineFinder::subtractBaseline(const casa::Vector<casa::Bool> &temp_mask, … … 773 773 AlwaysAssert(spectrum.nelements(),AipsError); 774 774 // use the fact that temp_mask excludes channels rejected at the edge 775 SDFitter sdf;775 Fitter sdf; 776 776 std::vector<float> absc(spectrum.nelements()); 777 777 for (Int i=0;i<absc.size();++i) -
trunk/src/SDLineFinder.h
r881 r890 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id :$29 //# $Id$ 30 30 //#--------------------------------------------------------------------------- 31 31 #ifndef STLINEFINDER_H … … 199 199 200 200 // auxiliary function to fit and subtract a polynomial from the current 201 // spectrum. It uses the SDFitter class. This action is required before201 // spectrum. It uses the Fitter class. This action is required before 202 202 // reducing the spectral resolution if the baseline shape is bad 203 203 void subtractBaseline(const casa::Vector<casa::Bool> &temp_mask, -
trunk/src/SDLog.cc
r883 r890 3 3 using namespace asap; 4 4 5 std::string SDLog::log_ = std::string("");5 std::string Logger::log_ = std::string(""); 6 6 7 SDLog::SDLog()7 Logger::Logger() 8 8 { 9 9 enableLog(); 10 10 } 11 11 12 SDLog::SDLog(bool enabled)12 Logger::Logger(bool enabled) 13 13 { 14 14 enabled_ = enabled; 15 15 } 16 16 17 void SDLog::pushLog(const std::string& s, bool newline ) const17 void Logger::pushLog(const std::string& s, bool newline ) const 18 18 { 19 19 if (enabled_) { … … 22 22 }; 23 23 } 24 std::string SDLog::popLog() const24 std::string Logger::popLog() const 25 25 { 26 26 std::string out; … … 28 28 return out; 29 29 } 30 void SDLog::enableLog()30 void Logger::enableLog() 31 31 { 32 32 enabled_ = true; 33 33 } 34 void SDLog::disableLog()34 void Logger::disableLog() 35 35 { 36 36 enabled_ = false; -
trunk/src/SDLog.h
r883 r890 7 7 namespace asap { 8 8 9 class SDLog{9 class Logger { 10 10 public: 11 SDLog();12 SDLog(bool enabled);11 Logger(); 12 Logger(bool enabled); 13 13 void pushLog(const std::string& s, bool newline=true) const; 14 14 //void pushLog(const char* cs); -
trunk/src/STAttr.h
r885 r890 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id :$29 //# $Id$ 30 30 //#--------------------------------------------------------------------------- 31 31 #ifndef STATTR_H … … 44 44 namespace asap { 45 45 46 class STAttr : public SDLog{46 class STAttr : public Logger { 47 47 48 48 public: … … 50 50 // Constructor 51 51 STAttr(); 52 52 53 53 // Destructor 54 54 ~STAttr(); 55 55 56 56 // Copy Constructor (copy semantics) 57 57 STAttr(const STAttr& other); 58 58 59 59 // Assignment (copy semantics) 60 60 STAttr &operator=(const STAttr& other); 61 61 62 62 // Telescope diameter(m). Throws exception if unknown. 63 63 casa::Float diameter(Instrument inst) const; 64 64 65 65 // Beam efficiency. Frequency in Hz. Returns 1 if unknown. 66 casa::Vector<casa::Float> 67 beamEfficiency(Instrument instr, const casa::MEpoch& dateObs, 66 casa::Vector<casa::Float> 67 beamEfficiency(Instrument instr, const casa::MEpoch& dateObs, 68 68 const casa::Vector<casa::Float>& freqs) const; 69 69 70 70 // Aperture efficiency. Frequency in Hz. Returns 1 if unknown. 71 casa::Vector<casa::Float> 72 apertureEfficiency(Instrument instr, 73 const casa::MEpoch& dateObs, 71 casa::Vector<casa::Float> 72 apertureEfficiency(Instrument instr, 73 const casa::MEpoch& dateObs, 74 74 const casa::Vector<casa::Float>& freqs) const; 75 75 76 76 // Find factor to convert Jy -> K for this telescope, date of 77 77 // observation and frequency (Hz) 78 casa::Vector<casa::Float> JyPerK(Instrument instr, 79 const casa::MEpoch& dateObs, 80 const casa::Vector<casa::Float>& freqs) 78 casa::Vector<casa::Float> JyPerK(Instrument instr, 79 const casa::MEpoch& dateObs, 80 const casa::Vector<casa::Float>& freqs) 81 81 const; 82 82 … … 88 88 // from the data themselves 89 89 FeedPolType feedPolType(Instrument) const; 90 90 91 91 // Helper function to check instrument (antenna) name and give enum 92 static Instrument convertInstrument(const casa::String& instrument, 92 static Instrument convertInstrument(const casa::String& instrument, 93 93 casa::Bool throwIt); 94 94 95 95 // Helper function. Finds factor to convert K -> Jy. Provide 96 96 // aperture efficiency and dish geometric diameter (m) 97 97 static casa::Float findJyPerK(casa::Float etaAp, casa::Float D); 98 98 99 99 private: 100 101 // Static data 100 101 // Static data 102 102 casa::Vector<casa::Float> MopEtaBeamX_; // Beam efficiency 103 103 casa::Vector<casa::Float> MopEtaBeam2003Y_; … … 111 111 112 112 casa::Vector<casa::Float> TidGainElPoly_; // Gain-el correction poly coeffs 113 113 114 114 // Init private data 115 115 void initData(); 116 116 117 117 // Linear interpolation 118 casa::Vector<casa::Float> interp(const casa::Vector<casa::Float>& xOut, 118 casa::Vector<casa::Float> interp(const casa::Vector<casa::Float>& xOut, 119 119 const casa::Vector<casa::Float>& xIn, 120 120 const casa::Vector<casa::Float>& yIn) const; -
trunk/src/STFiller.h
r846 r890 38 38 @version 2.0a 39 39 */ 40 class STFiller : public SDLog{40 class STFiller : public Logger { 41 41 public: 42 42 -
trunk/src/STMath.h
r867 r890 33 33 @author Malte Marquarding 34 34 */ 35 class STMath : private SDLog{35 class STMath : private Logger { 36 36 public: 37 37 -
trunk/src/STSubTable.h
r857 r890 28 28 @version $Revision:$ 29 29 */ 30 class STSubTable : public SDLog{30 class STSubTable : public Logger { 31 31 public: 32 32 STSubTable() {;} -
trunk/src/STTemplates.cpp
r851 r890 1 1 //#--------------------------------------------------------------------------- 2 //# SDTemplates.cc: explicit templates for aips++2 //# Templates.cc: explicit templates for aips++ 3 3 //#--------------------------------------------------------------------------- 4 4 //# Copyright (C) 2004 -
trunk/src/STWriter.h
r848 r890 50 50 * @brief Export of ASAP data container into forign formats 51 51 * @author Malte Marquarding 52 * @date $Date :$52 * @date $Date$ 53 53 * @version 2.0a 54 54 */ 55 class STWriter : public SDLog{55 class STWriter : public Logger { 56 56 public: 57 57 STWriter(const string &format = "SDFITS"); -
trunk/src/Scantable.h
r884 r890 62 62 * @version 63 63 */ 64 class Scantable : private SDLog64 class Scantable : private Logger 65 65 { 66 66 public: -
trunk/src/python_SDFitter.cc
r517 r890 1 1 //#--------------------------------------------------------------------------- 2 //# python_ SDFitter.cc: python exposure of c++ SDFitter class2 //# python_Fitter.cc: python exposure of c++ Fitter class 3 3 //#--------------------------------------------------------------------------- 4 4 //# Copyright (C) 2004 … … 27 27 //# AUSTRALIA 28 28 //# 29 //# $Id: 29 //# $Id:$ 30 30 //#--------------------------------------------------------------------------- 31 31 #include <boost/python.hpp> … … 38 38 namespace python { 39 39 40 void python_ SDFitter() {41 class_< SDFitter>("fitter")40 void python_Fitter() { 41 class_<Fitter>("fitter") 42 42 .def( init <> () ) 43 .def("setexpression", & SDFitter::setExpression)44 .def("setdata", & SDFitter::setData)45 .def("getresidual", & SDFitter::getResidual)46 .def("getfit", & SDFitter::getFit)47 .def("getfixedparameters", & SDFitter::getFixedParameters)48 .def("setfixedparameters", & SDFitter::setFixedParameters)49 .def("getparameters", & SDFitter::getParameters)50 .def("setparameters", & SDFitter::setParameters)51 .def("getestimate", & SDFitter::getEstimate)52 .def("estimate", & SDFitter::computeEstimate)53 .def("geterrors", & SDFitter::getErrors)54 .def("getchi2", & SDFitter::getChisquared)55 .def("reset", & SDFitter::reset)56 .def("fit", & SDFitter::fit)57 .def("evaluate", & SDFitter::evaluate)43 .def("setexpression", &Fitter::setExpression) 44 .def("setdata", &Fitter::setData) 45 .def("getresidual", &Fitter::getResidual) 46 .def("getfit", &Fitter::getFit) 47 .def("getfixedparameters", &Fitter::getFixedParameters) 48 .def("setfixedparameters", &Fitter::setFixedParameters) 49 .def("getparameters", &Fitter::getParameters) 50 .def("setparameters", &Fitter::setParameters) 51 .def("getestimate", &Fitter::getEstimate) 52 .def("estimate", &Fitter::computeEstimate) 53 .def("geterrors", &Fitter::getErrors) 54 .def("getchi2", &Fitter::getChisquared) 55 .def("reset", &Fitter::reset) 56 .def("fit", &Fitter::fit) 57 .def("evaluate", &Fitter::evaluate) 58 58 ; 59 59 }; -
trunk/src/python_SDLog.cc
r886 r890 1 1 //#--------------------------------------------------------------------------- 2 //# python_ SDLog.cc: python exposure of c++ SDLogclass2 //# python_Logger.cc: python exposure of c++ Logger class 3 3 //#--------------------------------------------------------------------------- 4 4 //# Copyright (C) 2004 … … 37 37 namespace asap { 38 38 namespace python { 39 void python_ SDLog() {40 class_< SDLog>("Log")39 void python_Logger() { 40 class_<Logger>("Log") 41 41 .def( init <> () ) 42 42 //.def( init <bool> () ) 43 .def("push", & SDLog::pushLog,43 .def("push", &Logger::pushLog, 44 44 (boost::python::arg("newline")=1)) 45 .def("pop", & SDLog::popLog)46 .def("disable", & SDLog::disableLog)47 .def("enable", & SDLog::enableLog)45 .def("pop", &Logger::popLog) 46 .def("disable", &Logger::disableLog) 47 .def("enable", &Logger::enableLog) 48 48 ; 49 49 };
Note:
See TracChangeset
for help on using the changeset viewer.