Ignore:
Timestamp:
03/07/13 13:28:44 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: 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 numbering of IFNO/BEAMNO based on Arrays.


File:
1 edited

Legend:

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

    r2766 r2777  
    262262    LogIO os( LogOrigin( "NRODataset", "getRecord()", WHERE ) ) ;
    263263    //cerr << "NRODataset::getRecord()  error while reading data " << i << endl ;
    264     os << LogIO::SEVERE << "error while reading data " << i << ". return NULL." << LogIO::POST ;
     264    os << LogIO::SEVERE << "error while reading data " << i << ". return NULL." << LogIO::EXCEPTION ;
    265265    dataid_ = -1 ;
    266266    return NULL ;
     
    468468  //
    469469  const NRODataRecord *record = getRecord( irow ) ;
     470
    470471  const string str = record->ARRYT ;
    471472  // DEBUG
    472473  //cout << "NRODataset::getIndex()  str = " << str << endl ;
    473474  //
    474   string substr = str.substr( 1, 2 ) ;
    475   unsigned int index = (unsigned int)(atoi( substr.c_str() ) - 1) ;
     475  int index = (int)getArrayId(str);
    476476  // DEBUG
    477   //cout << "NRODataset::getIndex()  irow = " << irow << " index = " << index << endl ;
     477  //cout << "NRODataset::getIndex()  irow = " << irow << "str = " << str << " index = " << index << endl ;
    478478  //
    479479
     
    489489  //cout << "NRODataset::getPolarizationNum()  start process" << endl ;
    490490  //
    491   int npol = 0 ;
    492 
    493   vector<string> type( 2 ) ;
    494   type[0] = "CIRC" ;
    495   type[1] = "LINR" ;
    496   vector<double> crot ;
    497   vector<double> lagl ;
    498   //vector<int> ntype( 2, 0 ) ;
    499 
    500   unsigned int imax = rowNum_ ;
    501   for ( unsigned int i = 0 ; i < imax ; i++ ) {
    502     int index = getIndex( i ) ;
    503     // DEBUG
    504     //cout <<"NRODataset::getPolarizationNum()  index = " << index << endl ;
    505     //
    506     if ( POLTP[index] == type[0] ) {
    507       if( count( crot.begin(), crot.end(), POLDR[index] ) != 0 ) {
    508         crot.push_back( POLDR[index] ) ;
    509         npol++ ;
    510       }
    511       //ntype[0] = 1 ;
    512     }
    513     else if ( POLTP[index] == type[1] ) {
    514       if ( count( lagl.begin(), lagl.end(), POLAN[index] ) != 0 ) {
    515         lagl.push_back( POLAN[index] ) ;
    516         npol++ ;
    517       }
    518       //ntype[1] = 1 ;
    519     }
    520   }
    521 
    522   if ( npol == 0 )
    523     npol = 1 ;
     491  int npol = 1;
     492  Regex reRx2("(.*V|H20ch2)$");
     493  Regex reRx1("(.*H|H20ch1)$");
     494  Bool match1 = false;
     495  Bool match2 = false;
     496  for (int i = 0; i < arrayMax(); i++) {
     497    cout << "RX[" << i << "]=" << RX[i] << endl;
     498    if (!match1) {
     499      match1 = (reRx1.match(RX[i].c_str(), RX[i].size()) != String::npos);
     500    }
     501    if (!match2) {
     502      match2 = (reRx2.match(RX[i].c_str(), RX[i].size()) != String::npos);
     503    }
     504  }
     505
     506  if (match1 && match2)
     507    npol = 2; 
     508
     509  //cout << "npol = " << npol << endl;
    524510
    525511  // DEBUG
     
    755741}
    756742
     743uInt NRODataset::getSortedArrayId( string type )
     744{
     745  uInt index = 0;
     746  while (arrayNames_[index] != type && index < (uInt)ARYNM)
     747    ++index;
     748  return index;
     749}
     750
    757751void NRODataset::show()
    758752{
     
    866860  return polno ;
    867861}
     862
     863void NRODataset::initArray()
     864{
     865  if (ARYNM <= 0)
     866    throw AipsError("ARYNM must be greater than zero.");
     867
     868  int numArray = 0;
     869  arrayNames_.resize(ARYNM);
     870  for (int irow = 0; numArray < ARYNM && irow < rowNum_; irow++) {
     871    cout << "irow " << irow << endl;
     872    const NRODataRecord *record = getRecord( irow ) ;
     873    const string str = record->ARRYT ;
     874    if (find(arrayNames_.begin(), arrayNames_.end(), str) == arrayNames_.end()) {
     875      arrayNames_[numArray] = str;
     876      cout << "arrayNames_[" << numArray << "]=" << str << endl;
     877      ++numArray;
     878    }
     879  }
     880  cout << "numArray=" << numArray << endl;
     881}
Note: See TracChangeset for help on using the changeset viewer.