- Timestamp:
- 04/01/11 21:36:20 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r2084 r2094 1775 1775 } 1776 1776 1777 void Scantable::polyBaseline(const std::vector<bool>& mask, int order, bool outLogger, const std::string& blfile)1777 void Scantable::polyBaseline(const std::vector<bool>& mask, int order, bool getResidual, bool outLogger, const std::string& blfile) 1778 1778 { 1779 1779 ofstream ofs; … … 1803 1803 chanMask = getCompositeChanMask(whichrow, mask); 1804 1804 fitBaseline(chanMask, whichrow, fitter); 1805 setSpectrum( fitter.getResidual(), whichrow);1805 setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 1806 1806 outputFittingResult(outLogger, outTextFile, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "polyBaseline()", fitter); 1807 1807 } … … 1810 1810 } 1811 1811 1812 void Scantable::autoPolyBaseline(const std::vector<bool>& mask, int order, const std::vector<int>& edge, float threshold, int chanAvgLimit, bool outLogger, const std::string& blfile)1812 void Scantable::autoPolyBaseline(const std::vector<bool>& mask, int order, const std::vector<int>& edge, float threshold, int chanAvgLimit, bool getResidual, bool outLogger, const std::string& blfile) 1813 1813 { 1814 1814 ofstream ofs; … … 1864 1864 1865 1865 fitBaseline(chanMask, whichrow, fitter); 1866 setSpectrum( fitter.getResidual(), whichrow);1866 setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 1867 1867 1868 1868 outputFittingResult(outLogger, outTextFile, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoPolyBaseline()", fitter); … … 1872 1872 } 1873 1873 1874 void Scantable::cubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, bool outLogger, const std::string& blfile)1874 void Scantable::cubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, bool getResidual, bool outLogger, const std::string& blfile) 1875 1875 { 1876 1876 ofstream ofs; … … 1900 1900 chanMask = getCompositeChanMask(whichrow, mask); 1901 1901 //fitBaseline(chanMask, whichrow, fitter); 1902 //setSpectrum( fitter.getResidual(), whichrow);1902 //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 1903 1903 std::vector<int> pieceEdges; 1904 1904 std::vector<float> params; 1905 std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, true);1905 std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, getResidual); 1906 1906 setSpectrum(res, whichrow); 1907 1907 // … … 1913 1913 } 1914 1914 1915 void Scantable::autoCubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, const std::vector<int>& edge, float threshold, int chanAvgLimit, bool outLogger, const std::string& blfile)1915 void Scantable::autoCubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, const std::vector<int>& edge, float threshold, int chanAvgLimit, bool getResidual, bool outLogger, const std::string& blfile) 1916 1916 { 1917 1917 ofstream ofs; … … 1968 1968 1969 1969 //fitBaseline(chanMask, whichrow, fitter); 1970 //setSpectrum( fitter.getResidual(), whichrow);1970 //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 1971 1971 std::vector<int> pieceEdges; 1972 1972 std::vector<float> params; 1973 std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, true);1973 std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, getResidual); 1974 1974 setSpectrum(res, whichrow); 1975 1975 // … … 1987 1987 } 1988 1988 if (nPiece < 1) { 1989 throw(AipsError(" wrong number of the sections for fitting"));1989 throw(AipsError("number of the sections must be one or more")); 1990 1990 } 1991 1991 … … 2229 2229 chanMask = getCompositeChanMask(whichrow, mask); 2230 2230 //fitBaseline(chanMask, whichrow, fitter); 2231 //setSpectrum( fitter.getResidual(), whichrow);2231 //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 2232 2232 std::vector<float> params; 2233 //std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, params, thresClip, nIterClip, true);2234 2233 std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, maxWaveLength, params, thresClip, nIterClip, getResidual); 2235 2234 setSpectrum(res, whichrow); … … 2297 2296 2298 2297 //fitBaseline(chanMask, whichrow, fitter); 2299 //setSpectrum( fitter.getResidual(), whichrow);2298 //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 2300 2299 std::vector<float> params; 2301 2300 std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, maxWaveLength, params, thresClip, nIterClip, getResidual); … … 2349 2348 2350 2349 const double PI = 6.0 * asin(0.5); // PI (= 3.141592653...) 2351 double baseXFactor = 2.0*PI/(double)maxWaveLength/(double)(nChan-1); //the denominator (nChan-1) should be changed to (xdata[nChan-1]-xdata[0]) for accepting x-values given in velocity or frequency when this function is moved to fitter. 2350 double baseXFactor = 2.0*PI/(double)maxWaveLength/(double)(nChan-1); //the denominator (nChan-1) should be changed to (xdata[nChan-1]-xdata[0]) for accepting x-values given in velocity or frequency when this function is moved to fitter. (2011/03/30 WK) 2352 2351 2353 2352 // xArray : contains elemental values for computing the least-square matrix. … … 2649 2648 2650 2649 if (verbose) { 2651 for (int i = 0; i < 60; ++i) {2652 oss << "-";2653 }2654 oss << endl;2655 2650 oss << " Scan[" << getScan(whichrow) << "]"; 2656 2651 oss << " Beam[" << getBeam(whichrow) << "]"; … … 2673 2668 oss << "Results of baseline fit" << endl; 2674 2669 oss << " rms = " << setprecision(6) << rms << endl; 2670 for (int i = 0; i < 60; ++i) { 2671 oss << "-"; 2672 } 2673 oss << flush; 2675 2674 } 2676 2675 -
trunk/src/Scantable.h
r2081 r2094 497 497 void polyBaseline(const std::vector<bool>& mask, 498 498 int order, 499 bool getResidual=true, 499 500 bool outLogger=false, 500 501 const std::string& blfile=""); … … 504 505 float threshold=3.0, 505 506 int chanAvgLimit=1, 507 bool getResidual=true, 506 508 bool outLogger=false, 507 509 const std::string& blfile=""); … … 510 512 float thresClip, 511 513 int nIterClip, 514 bool getResidual=true, 512 515 bool outLogger=false, 513 516 const std::string& blfile=""); … … 519 522 float threshold=3.0, 520 523 int chanAvgLimit=1, 524 bool getResidual=true, 521 525 bool outLogger=false, 522 526 const std::string& blfile=""); … … 679 683 float thresClip=3.0, 680 684 int nIterClip=1, 681 bool getResidual= false);685 bool getResidual=true); 682 686 std::vector<float> doSinusoidFitting(const std::vector<float>& data, 683 687 const std::vector<bool>& mask, … … 687 691 float thresClip=3.0, 688 692 int nIterClip=1, 689 bool getResidual= false);693 bool getResidual=true); 690 694 bool hasSameNchanOverIFs(); 691 695 std::string getMaskRangeList(const std::vector<bool>& mask, -
trunk/src/ScantableWrapper.h
r2081 r2094 257 257 { table_->reshapeSpectrum( nmin, nmax ); } 258 258 259 void polyBaseline(const std::vector<bool>& mask, int order, bool outlog=false, const std::string& blfile="")260 { table_->polyBaseline(mask, order, outlog, blfile); }261 262 void autoPolyBaseline(const std::vector<bool>& mask, int order, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool outlog=false, const std::string& blfile="")263 { table_->autoPolyBaseline(mask, order, edge, threshold, chan_avg_limit, outlog, blfile); }264 265 void cubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, bool outlog=false, const std::string& blfile="")266 { table_->cubicSplineBaseline(mask, npiece, clipthresh, clipniter, outlog, blfile); }267 268 void autoCubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool outlog=false, const std::string& blfile="")269 { table_->autoCubicSplineBaseline(mask, npiece, clipthresh, clipniter, edge, threshold, chan_avg_limit, outlog, blfile); }259 void polyBaseline(const std::vector<bool>& mask, int order, bool getresidual=true, bool outlog=false, const std::string& blfile="") 260 { table_->polyBaseline(mask, order, getresidual, outlog, blfile); } 261 262 void autoPolyBaseline(const std::vector<bool>& mask, int order, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, bool outlog=false, const std::string& blfile="") 263 { table_->autoPolyBaseline(mask, order, edge, threshold, chan_avg_limit, getresidual, outlog, blfile); } 264 265 void cubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, bool getresidual=true, bool outlog=false, const std::string& blfile="") 266 { table_->cubicSplineBaseline(mask, npiece, clipthresh, clipniter, getresidual, outlog, blfile); } 267 268 void autoCubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, bool outlog=false, const std::string& blfile="") 269 { table_->autoCubicSplineBaseline(mask, npiece, clipthresh, clipniter, edge, threshold, chan_avg_limit, getresidual, outlog, blfile); } 270 270 271 271 void sinusoidBaseline(const std::vector<bool>& mask, const std::vector<int>& nwave, float maxwavelength, float clipthresh, int clipniter, bool getresidual=true, bool outlog=false, const std::string& blfile="")
Note:
See TracChangeset
for help on using the changeset viewer.