Ignore:
Timestamp:
04/01/11 21:43:18 (14 years ago)
Author:
WataruKawasaki
Message:

merged from bug fixes from trunk (r2093)

Location:
branches/casa-prerelease/pre-asap
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/casa-prerelease/pre-asap

    • Property svn:mergeinfo changed
      /trunkmerged: 2094
  • branches/casa-prerelease/pre-asap/src

  • branches/casa-prerelease/pre-asap/src/SConscript

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/src/Scantable.cpp

    r2082 r2095  
    17611761}
    17621762
    1763 void Scantable::polyBaseline(const std::vector<bool>& mask, int order, bool outLogger, const std::string& blfile)
     1763void Scantable::polyBaseline(const std::vector<bool>& mask, int order, bool getResidual, bool outLogger, const std::string& blfile)
    17641764{
    17651765  ofstream ofs;
     
    17891789    chanMask = getCompositeChanMask(whichrow, mask);
    17901790    fitBaseline(chanMask, whichrow, fitter);
    1791     setSpectrum(fitter.getResidual(), whichrow);
     1791    setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    17921792    outputFittingResult(outLogger, outTextFile, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "polyBaseline()", fitter);
    17931793  }
     
    17961796}
    17971797
    1798 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)
     1798void 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)
    17991799{
    18001800  ofstream ofs;
     
    18501850
    18511851    fitBaseline(chanMask, whichrow, fitter);
    1852     setSpectrum(fitter.getResidual(), whichrow);
     1852    setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    18531853
    18541854    outputFittingResult(outLogger, outTextFile, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoPolyBaseline()", fitter);
     
    18581858}
    18591859
    1860 void Scantable::cubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, bool outLogger, const std::string& blfile)
     1860void Scantable::cubicSplineBaseline(const std::vector<bool>& mask, int nPiece, float thresClip, int nIterClip, bool getResidual, bool outLogger, const std::string& blfile)
    18611861{
    18621862  ofstream ofs;
     
    18861886    chanMask = getCompositeChanMask(whichrow, mask);
    18871887    //fitBaseline(chanMask, whichrow, fitter);
    1888     //setSpectrum(fitter.getResidual(), whichrow);
     1888    //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    18891889    std::vector<int> pieceEdges;
    18901890    std::vector<float> params;
    1891     std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, true);
     1891    std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, getResidual);
    18921892    setSpectrum(res, whichrow);
    18931893    //
     
    18991899}
    19001900
    1901 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)
     1901void 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)
    19021902{
    19031903  ofstream ofs;
     
    19541954
    19551955    //fitBaseline(chanMask, whichrow, fitter);
    1956     //setSpectrum(fitter.getResidual(), whichrow);
     1956    //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    19571957    std::vector<int> pieceEdges;
    19581958    std::vector<float> params;
    1959     std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, true);
     1959    std::vector<float> res = doCubicSplineFitting(getSpectrum(whichrow), chanMask, nPiece, pieceEdges, params, thresClip, nIterClip, getResidual);
    19601960    setSpectrum(res, whichrow);
    19611961    //
     
    19731973  }
    19741974  if (nPiece < 1) {
    1975     throw(AipsError("wrong number of the sections for fitting"));
     1975    throw(AipsError("number of the sections must be one or more"));
    19761976  }
    19771977
     
    22152215    chanMask = getCompositeChanMask(whichrow, mask);
    22162216    //fitBaseline(chanMask, whichrow, fitter);
    2217     //setSpectrum(fitter.getResidual(), whichrow);
     2217    //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    22182218    std::vector<float> params;
    2219     //std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, params, thresClip, nIterClip, true);
    22202219    std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, maxWaveLength, params, thresClip, nIterClip, getResidual);
    22212220    setSpectrum(res, whichrow);
     
    22832282
    22842283    //fitBaseline(chanMask, whichrow, fitter);
    2285     //setSpectrum(fitter.getResidual(), whichrow);
     2284    //setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow);
    22862285    std::vector<float> params;
    22872286    std::vector<float> res = doSinusoidFitting(getSpectrum(whichrow), chanMask, nWaves, maxWaveLength, params, thresClip, nIterClip, getResidual);
     
    23352334
    23362335  const double PI = 6.0 * asin(0.5); // PI (= 3.141592653...)
    2337   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.
     2336  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)
    23382337
    23392338  // xArray : contains elemental values for computing the least-square matrix.
     
    26352634
    26362635  if (verbose) {
    2637     for (int i = 0; i < 60; ++i) {
    2638       oss << "-";
    2639     }
    2640     oss << endl;
    26412636    oss <<  " Scan[" << getScan(whichrow)  << "]";
    26422637    oss <<  " Beam[" << getBeam(whichrow)  << "]";
     
    26592654    oss << "Results of baseline fit" << endl;
    26602655    oss << "  rms = " << setprecision(6) << rms << endl;
     2656    for (int i = 0; i < 60; ++i) {
     2657      oss << "-";
     2658    }
     2659    oss << flush;
    26612660  }
    26622661
  • branches/casa-prerelease/pre-asap/src/Scantable.h

    r2082 r2095  
    497497  void polyBaseline(const std::vector<bool>& mask,
    498498                    int order,
     499                    bool getResidual=true,
    499500                    bool outLogger=false,
    500501                    const std::string& blfile="");
     
    504505                        float threshold=3.0,
    505506                        int chanAvgLimit=1,
     507                        bool getResidual=true,
    506508                        bool outLogger=false,
    507509                        const std::string& blfile="");
     
    510512                           float thresClip,
    511513                           int nIterClip,
     514                           bool getResidual=true,
    512515                           bool outLogger=false,
    513516                           const std::string& blfile="");
     
    519522                               float threshold=3.0,
    520523                               int chanAvgLimit=1,
     524                               bool getResidual=true,
    521525                               bool outLogger=false,
    522526                               const std::string& blfile="");
     
    679683                                          float thresClip=3.0,
    680684                                          int nIterClip=1,
    681                                           bool getResidual=false);
     685                                          bool getResidual=true);
    682686  std::vector<float> doSinusoidFitting(const std::vector<float>& data,
    683687                                       const std::vector<bool>& mask,
     
    687691                                       float thresClip=3.0,
    688692                                       int nIterClip=1,
    689                                        bool getResidual=false);
     693                                       bool getResidual=true);
    690694  bool hasSameNchanOverIFs();
    691695  std::string getMaskRangeList(const std::vector<bool>& mask,
  • branches/casa-prerelease/pre-asap/src/ScantableWrapper.h

    r2082 r2095  
    257257  { table_->reshapeSpectrum( nmin, nmax ); }
    258258
    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); }
    270270
    271271  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.