Changeset 3043 for trunk


Ignore:
Timestamp:
07/30/15 17:11:36 (9 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes/No?

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Optimize cubic spline fitting in Scantable::subBaseline.
I expect that the performance will improve about 30%.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r3042 r3043  
    27832783    res = doChebyshevFitting(spec, mask, fpar[0], params, rms, finalmask, clipth, clipn);
    27842784  } else if (ftype == STBaselineFunc::CSpline) {
     2785    int nclip = 0;
     2786    size_t numChan = spec.size();
     2787    if (cubicSplineModelPool_.find(numChan) == cubicSplineModelPool_.end()) {
     2788      cubicSplineModelPool_[numChan] = getPolynomialModel(3, numChan, &Scantable::getNormalPolynomial);
     2789    }
    27852790    if (fpar.size() > 1) { // reading from baseline table in which pieceEdges are already calculated and stored.
    2786       res = doCubicSplineFitting(spec, mask, fpar, params, rms, finalmask, clipth, clipn);
     2791      //res = doCubicSplineFitting(spec, mask, fpar, params, rms, finalmask, clipth, clipn);
     2792      res = doCubicSplineLeastSquareFitting(spec, mask,
     2793                                            cubicSplineModelPool_[numChan],
     2794                                            fpar.size()-1, true, fpar, params,
     2795                                            rms, finalmask, nclip, clipth,
     2796                                            clipn);
    27872797    } else {               // usual cspline fitting by giving nPiece only. fpar will be replaced with pieceEdges.
    2788       res = doCubicSplineFitting(spec, mask, fpar[0], fpar, params, rms, finalmask, clipth, clipn);
     2798      //res = doCubicSplineFitting(spec, mask, fpar[0], fpar, params, rms, finalmask, clipth, clipn);
     2799      res = doCubicSplineLeastSquareFitting(spec, mask,
     2800                                            cubicSplineModelPool_[numChan],
     2801                                            fpar[0], false, fpar, params,
     2802                                            rms, finalmask, nclip, clipth,
     2803                                            clipn);
    27892804    }
    27902805  } else if (ftype == STBaselineFunc::Sinusoid) {
  • trunk/src/Scantable.h

    r3023 r3043  
    1919#include <string>
    2020#include <vector>
     21#include <map>
    2122// AIPS++
    2223#include <casa/aips.h>
     
    993994 std::vector<float> doSubtractBaseline(std::vector<float>& spec, std::vector<bool>& mask, const STBaselineFunc::FuncName ftype, std::vector<int>& fpar, std::vector<float>& params, float&rms, std::vector<bool>& finalmask, float clipth, int clipn, bool uself, int irow, float lfth, std::vector<int>& lfedge, int lfavg);
    994995
     996 // storage of cubic spline model for various number of channels
     997 map<size_t, vector< vector<double> > > cubicSplineModelPool_;
     998
    995999};
    9961000} // namespace
Note: See TracChangeset for help on using the changeset viewer.