Changeset 3087


Ignore:
Timestamp:
11/25/15 18:57:32 (8 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...


Bug fix on STFitter::computeEstimate. Introduced size check of func_ member variable to avoid segmentation fault. Uncommented lines that seems to be commented unintentionally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFitter.cpp

    r3083 r3087  
    8888    throw (AipsError("No x/y data specified."));
    8989
     90  if (funcs_.size() == 0) {
     91    throw AipsError("No fit function specified.");
     92  }
     93
    9094  if (dynamic_cast<Gaussian1D<Float>* >(funcs_[0]) == 0)
    9195    return false;
     
    115119  SpectralList listGauss = estimator.estimate(x_, y_);
    116120  parameters_.resize(n*3);
    117 //  Gaussian1D<Float>* g = 0;
    118 //  for (uInt i=0; i<n;i++) {
    119 //     g = dynamic_cast<Gaussian1D<Float>* >(funcs_[i]);
    120 //     if (g) {
    121 //       const GaussianSpectralElement *gauss =
    122 //      dynamic_cast<const GaussianSpectralElement *>(listGauss[i]) ;
    123 //       (*g)[0] = gauss->getAmpl();
    124 //       (*g)[1] = gauss->getCenter();
    125 //       (*g)[2] = gauss->getFWHM();     
    126 //       /*
    127 //       (*g)[0] = listGauss[i].getAmpl();
    128 //       (*g)[1] = listGauss[i].getCenter();
    129 //       (*g)[2] = listGauss[i].getFWHM();
    130 //       */
    131 //     }
    132 //  }
     121  Gaussian1D<Float>* g = 0;
     122  for (uInt i=0; i<n;i++) {
     123     g = dynamic_cast<Gaussian1D<Float>* >(funcs_[i]);
     124     if (g) {
     125       const GaussianSpectralElement *gauss =
     126           dynamic_cast<const GaussianSpectralElement *>(listGauss[i]) ;
     127       (*g)[0] = gauss->getAmpl();
     128       (*g)[1] = gauss->getCenter();
     129       (*g)[2] = gauss->getFWHM();
     130       /*
     131       (*g)[0] = listGauss[i].getAmpl();
     132       (*g)[1] = listGauss[i].getCenter();
     133       (*g)[2] = listGauss[i].getFWHM();
     134       */
     135     }
     136  }
    133137  estimate_.resize();
    134138  listGauss.evaluate(estimate_,x_);
Note: See TracChangeset for help on using the changeset viewer.