Changeset 2411 for trunk/src


Ignore:
Timestamp:
02/17/12 16:30:24 (13 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes CAS-3759

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description: (1) in sinusoidal baselining procedures and their relevants, quit getting nchan info in Python side but in C++ side.

(2) changed the defaults value of addwn from [] to [0] in sd.*_sinusoid_baseline(). (i.e., toolkit level)


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r2410 r2411  
    26972697  }
    26982698
    2699   addAuxWaveNumbers(addNWaves, rejectNWaves, nWaves);
     2699  addAuxWaveNumbers(whichrow, addNWaves, rejectNWaves, nWaves);
    27002700}
    27012701
     
    27792779}
    27802780
    2781 void Scantable::addAuxWaveNumbers(const std::vector<int>& addNWaves, const std::vector<int>& rejectNWaves, std::vector<int>& nWaves)
    2782 {
     2781void Scantable::addAuxWaveNumbers(const int whichrow, const std::vector<int>& addNWaves, const std::vector<int>& rejectNWaves, std::vector<int>& nWaves)
     2782{
     2783  std::vector<int> tempAddNWaves, tempRejectNWaves;
    27832784  for (uInt i = 0; i < addNWaves.size(); ++i) {
     2785    tempAddNWaves.push_back(addNWaves[i]);
     2786  }
     2787  if ((tempAddNWaves.size() == 2) && (tempAddNWaves[1] == -999)) {
     2788    setWaveNumberListUptoNyquistFreq(whichrow, tempAddNWaves);
     2789  }
     2790
     2791  for (uInt i = 0; i < rejectNWaves.size(); ++i) {
     2792    tempRejectNWaves.push_back(rejectNWaves[i]);
     2793  }
     2794  if ((tempRejectNWaves.size() == 2) && (tempRejectNWaves[1] == -999)) {
     2795    setWaveNumberListUptoNyquistFreq(whichrow, tempRejectNWaves);
     2796  }
     2797
     2798  for (uInt i = 0; i < tempAddNWaves.size(); ++i) {
    27842799    bool found = false;
    27852800    for (uInt j = 0; j < nWaves.size(); ++j) {
    2786       if (nWaves[j] == addNWaves[i]) {
     2801      if (nWaves[j] == tempAddNWaves[i]) {
    27872802        found = true;
    27882803        break;
    27892804      }
    27902805    }
    2791     if (!found) nWaves.push_back(addNWaves[i]);
    2792   }
    2793 
    2794   for (uInt i = 0; i < rejectNWaves.size(); ++i) {
     2806    if (!found) nWaves.push_back(tempAddNWaves[i]);
     2807  }
     2808
     2809  for (uInt i = 0; i < tempRejectNWaves.size(); ++i) {
    27952810    for (std::vector<int>::iterator j = nWaves.begin(); j != nWaves.end(); ) {
    2796       if (*j == rejectNWaves[i]) {
     2811      if (*j == tempRejectNWaves[i]) {
    27972812        j = nWaves.erase(j);
    27982813      } else {
     
    28052820    sort(nWaves.begin(), nWaves.end());
    28062821    unique(nWaves.begin(), nWaves.end());
     2822  }
     2823}
     2824
     2825void Scantable::setWaveNumberListUptoNyquistFreq(const int whichrow, std::vector<int>& nWaves)
     2826{
     2827  if ((nWaves.size() == 2)&&(nWaves[1] == -999)) {
     2828    int val = nWaves[0];
     2829    int nyquistFreq = nchan(getIF(whichrow))/2+1;
     2830    nWaves.clear();
     2831    if (val > nyquistFreq) {  // for safety, at least nWaves contains a constant; CAS-3759
     2832      nWaves.push_back(0);
     2833    }
     2834    while (val <= nyquistFreq) {
     2835      nWaves.push_back(val);
     2836      val++;
     2837    }
    28072838  }
    28082839}
     
    28442875
    28452876      //FOR DEBUGGING------------
     2877      /*
    28462878      if (whichrow < 0) {// == nRow -1) {
    28472879        cout << "+++ i=" << setw(3) << whichrow << ", IF=" << setw(2) << getIF(whichrow);
     
    28552887        cout << flush;
    28562888      }
     2889      */
    28572890      //-------------------------
    28582891
  • trunk/src/Scantable.h

    r2357 r2411  
    739739                           const std::string& fftThAttr,
    740740                           std::vector<int>& nWaves);
    741   void addAuxWaveNumbers(const std::vector<int>& addNWaves,
     741  void addAuxWaveNumbers(const int whichrow,
     742                         const std::vector<int>& addNWaves,
    742743                         const std::vector<int>& rejectNWaves,
    743744                         std::vector<int>& nWaves);
     745  void setWaveNumberListUptoNyquistFreq(const int whichrow,
     746                                        std::vector<int>& nWaves);
    744747  bool hasSameNchanOverIFs();
    745748  std::string getMaskRangeList(const std::vector<bool>& mask,
Note: See TracChangeset for help on using the changeset viewer.