Changeset 3095 for trunk


Ignore:
Timestamp:
02/19/16 12:09:15 (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...


Bug fix on receiver name handling when determining polarization id.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/atnf/PKSIO/NRODataset.cc

    r3012 r3095  
    4545#include <math.h>
    4646#include <fstream>
     47#include <iostream>
    4748
    4849#define STRING2CHAR(s) const_cast<char *>((s).c_str())
     
    12211222  Bool match2 = false;
    12221223  for (int i = 0; i < arrayMax(); i++) {
    1223     //cout << "RX[" << i << "]=" << RX[i] << endl;
     1224    //cout << "RX[" << i << "]=\"" << RX[i] << "\"" << endl;
     1225
     1226    String rxString(RX[i]);
     1227    //cout << "rxString = \"" << rxString << "\" rxString.size() = " << rxString.size() << endl;
     1228
     1229    // RX may contain some null characters at the end
     1230    // Remove it for pattern matching
     1231    rxString.rtrim('\0');
     1232    //cout << "rxString (rtrim) = \"" << rxString << "\" rxString.size() = " << rxString.size() << endl;
     1233
     1234    // Also remove whitespaces
     1235    rxString.trim();
     1236    //cout << "rxString (trim) = \"" << rxString << "\" rxString.size() = " << rxString.size() << endl;
     1237
    12241238    if (!match1) {
    1225       match1 = (reRx1.match(RX[i].c_str(), RX[i].size()) != String::npos);
     1239      match1 = (reRx1.match(rxString.c_str(), rxString.size()) != String::npos);
    12261240    }
    12271241    if (!match2) {
    1228       match2 = (reRx2.match(RX[i].c_str(), RX[i].size()) != String::npos);
     1242      match2 = (reRx2.match(rxString.c_str(), rxString.size()) != String::npos);
    12291243    }
    12301244  }
     
    15771591  // For others, POLNO is always 0.
    15781592  String rxString(rx);
     1593  //cout << "rx='" << rxString << "' (size " << rxString.length() << ")" << endl;
     1594
     1595  // see getPolarizationNum for detail why we need to trim
     1596  rxString.rtrim('\0');
    15791597  rxString.trim();
    1580   //cout << "rx='" << rxString << "' (size " << rxString.size() << ")" << endl;
     1598
    15811599  Regex reRx("(.*V|H20ch2)$");
    1582   if (reRx.match(rxString.c_str(), rxString.size()) != String::npos) {
     1600  if (reRx.match(rxString.c_str(), rxString.length()) != String::npos) {
    15831601    //cout << "match!" << endl;
    15841602    polno = 1;
    15851603  }
     1604  //cout << "polno = " << polno << endl;
    15861605  return polno ;
    15871606}
Note: See TracChangeset for help on using the changeset viewer.