Changeset 2012 for trunk/src/Scantable.h


Ignore:
Timestamp:
02/25/11 16:51:50 (13 years ago)
Author:
WataruKawasaki
Message:

New Development: Yes

JIRA Issue: Yes (CAS-2373, CAS-2620)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: For Scantable::polyBaseline(), parameters and return value have been changed.

Test Programs:

Put in Release Notes: Yes

Module(s): sdbaseline, sd.linefinder

Description: (1) CAS-2373-related:

(1.1) Modified Scantable::polyBaseline() to have the row-based loop inside.

Now it fits and subtracts baseline for all rows and also output info
about the fitting result to logger and text file, while in the
previous version this method just did baseline fitting/subtraction
for one row only and had to be put inside a row-based loop at the
python side ("poly_baseline()" in scantable.py) and result output had
also to be controlled at the python side. Using a test data from NRO
45m telescope (348,000 rows, 512 channels), the processing time of
scantable.poly_baseline() has reduced from 130 minutes to 5-6 minutes.

(1.2) For accelerating the another polynomial fitting function, namely

scantable.auto_poly_baseline(), added a method
Scantable::autoPolyBaseline(). This basically does the same thing
with Scantable::polyBaseline(), but uses linefinfer also to
automatically flag the line regions.

(1.3) To make linefinder usable in Scantable class, added a method

linefinder.setdata(). This makes it possible to apply linefinder
for a float-list data given as a parameter, without setting scantable,
while it was indispensable to set scantable to use linefinger previously.

(2) CAS-2620-related:

Added Scantable::cubicSplineBaseline() and autoCubicSplineBaseline() for
fit baseline using the cubic spline function. Parameters include npiece
(number of polynomial pieces), clipthresh (clipping threshold), and
clipniter (maximum iteration number).



File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.h

    r2005 r2012  
    1616#include <string>
    1717#include <vector>
     18#include <iostream>
     19#include <fstream>
    1820// AIPS++
    1921#include <casa/aips.h>
     
    493495  bool getFlagtraFast(int whichrow);
    494496
    495   void polyBaselineBatch(const std::vector<bool>& mask, int order);
    496   STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno);
     497  void polyBaseline(const std::vector<bool>& mask,
     498                    int order,
     499                    bool outLogger=false,
     500                    const std::string& blfile="");
     501  void autoPolyBaseline(const std::vector<bool>& mask,
     502                        int order,
     503                        const std::vector<int>& edge,
     504                        float threshold=3.0,
     505                        int chanAvgLimit=1,
     506                        bool outLogger=false,
     507                        const std::string& blfile="");
     508  void cubicSplineBaseline(const std::vector<bool>& mask,
     509                           int nPiece,
     510                           float thresClip,
     511                           int nIterClip,
     512                           bool outLogger=false,
     513                           const std::string& blfile="");
     514  void autoCubicSplineBaseline(const std::vector<bool>& mask,
     515                               int nPiece,
     516                               float thresClip,
     517                               int nIterClip,
     518                               const std::vector<int>& edge,
     519                               float threshold=3.0,
     520                               int chanAvgLimit=1,
     521                               bool outLogger=false,
     522                               const std::string& blfile="");
     523  float getRms(const std::vector<bool>& mask, int whichrow);
     524  std::string formatBaselineParams(const std::vector<float>& params,
     525                                   const std::vector<bool>& fixed,
     526                                   float rms,
     527                                   const std::string& masklist,
     528                                   int whichrow,
     529                                   bool verbose=false) const;
     530  std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges,
     531                                            const std::vector<float>& params,
     532                                            const std::vector<bool>& fixed,
     533                                            float rms,
     534                                            const std::string& masklist,
     535                                            int whichrow,
     536                                            bool verbose=false) const;
     537
    497538
    498539private:
     
    608649                                                      const casa::Array<T2>&);
    609650
    610   void doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter);
     651  void fitBaseline(const std::vector<bool>& mask, int whichrow, Fitter& fitter);
     652  std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
     653                                          const std::vector<bool>& mask,
     654                                          std::vector<int>& sectionRanges,
     655                                          std::vector<float>& params,
     656                                          int nPiece=2,
     657                                          float thresClip=3.0,
     658                                          int nIterClip=1);
     659  bool hasSameNchanOverIFs();
     660  std::string getMaskRangeList(const std::vector<bool>& mask,
     661                                int whichrow,
     662                                const casa::String& coordInfo,
     663                                bool hasSameNchan,
     664                                int firstIF,
     665                                bool silent=false);
     666  std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask, bool getStartIndices=true);
     667  std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose) const;
     668  std::string formatBaselineParamsFooter(float rms, bool verbose) const;
     669  std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask);
     670  //std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask, const std::vector<int>& edge, const int minEdgeSize, STLineFinder& lineFinder);
    611671
    612672  void applyChanFlag( casa::uInt whichrow, const std::vector<bool>& msk, casa::uChar flagval);
Note: See TracChangeset for help on using the changeset viewer.