Changeset 3044


Ignore:
Timestamp:
08/07/15 16:42:16 (9 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No (a bug fix)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): scantable.sinusoid_baseline and scantable.auto_sinusoid_baseline methods

Description: Fix to seg fault when wave numbers of sinusoidal fitting is empty.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r3043 r3044  
    47654765    if (!applyFFT) {
    47664766      nWaves = selectWaveNumbers(addNWaves, rejectNWaves);
     4767      if (nWaves.size()==0) //no wave numbers to fit
     4768        throw(AipsError("No valid wave numbers to fit"));
    47674769      modelReservoir = getSinusoidModelReservoir(nWaves, nChanNos);
    47684770    }
     
    47714773      std::vector<float> sp = getSpectrum(whichrow);
    47724774      chanMask = getCompositeChanMask(whichrow, mask);
    4773       std::vector<std::vector<double> > model;
     4775      std::vector<std::vector<double> > model;
     4776      bool canfit = true;
    47744777      if (applyFFT) {
    47754778        nWaves = selectWaveNumbers(whichrow, chanMask, true, fftMethod, fftThresh,
    47764779                                   addNWaves, rejectNWaves);
     4780        if (nWaves.size()==0) {// no wave numbers to fit.
     4781          canfit = false;
     4782          break;
     4783        }
    47774784        model = getSinusoidModel(nWaves, sp.size());
    47784785      } else {
     
    47844791
    47854792      //if (flagrowCol_(whichrow) == 0) {
    4786       if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) {
     4793      if (canfit && flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) {
    47874794        int nClipped = 0;
    47884795        std::vector<float> res;
     
    48824889    if (!applyFFT) {
    48834890      nWaves = selectWaveNumbers(addNWaves, rejectNWaves);
     4891      if (nWaves.size()==0) //no wave numbers to fit
     4892        throw(AipsError("No valid wave numbers to fit"));
    48844893      modelReservoir = getSinusoidModelReservoir(nWaves, nChanNos);
    48854894    }
     
    48904899      chanMask = getCompositeChanMask(whichrow, mask, edge, currentEdge, lineFinder);
    48914900      std::vector<std::vector<double> > model;
     4901      bool canfit=true;
    48924902      if (applyFFT) {
    48934903        nWaves = selectWaveNumbers(whichrow, chanMask, true, fftMethod, fftThresh,
    48944904                                   addNWaves, rejectNWaves);
     4905        if (nWaves.size()==0) { // no wave numbers to fit.
     4906          canfit = false;
     4907          break;
     4908        }
    48954909        model = getSinusoidModel(nWaves, sp.size());
    48964910      } else {
     
    49024916
    49034917      //if (flagrowCol_(whichrow) == 0) {
    4904       if (flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) {
     4918      if (canfit && flagrowCol_(whichrow)==0 && nValidMask(chanMask)>0) {
    49054919        int nClipped = 0;
    49064920        std::vector<float> res;
Note: See TracChangeset for help on using the changeset viewer.