Changeset 2777 for trunk/external-alma/atnf/PKSIO/NRODataset.cc
- Timestamp:
- 03/07/13 13:28:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2766 r2777 262 262 LogIO os( LogOrigin( "NRODataset", "getRecord()", WHERE ) ) ; 263 263 //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 ; 265 265 dataid_ = -1 ; 266 266 return NULL ; … … 468 468 // 469 469 const NRODataRecord *record = getRecord( irow ) ; 470 470 471 const string str = record->ARRYT ; 471 472 // DEBUG 472 473 //cout << "NRODataset::getIndex() str = " << str << endl ; 473 474 // 474 string substr = str.substr( 1, 2 ) ; 475 unsigned int index = (unsigned int)(atoi( substr.c_str() ) - 1) ; 475 int index = (int)getArrayId(str); 476 476 // DEBUG 477 //cout << "NRODataset::getIndex() irow = " << irow << " index = " << index << endl ;477 //cout << "NRODataset::getIndex() irow = " << irow << "str = " << str << " index = " << index << endl ; 478 478 // 479 479 … … 489 489 //cout << "NRODataset::getPolarizationNum() start process" << endl ; 490 490 // 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; 524 510 525 511 // DEBUG … … 755 741 } 756 742 743 uInt NRODataset::getSortedArrayId( string type ) 744 { 745 uInt index = 0; 746 while (arrayNames_[index] != type && index < (uInt)ARYNM) 747 ++index; 748 return index; 749 } 750 757 751 void NRODataset::show() 758 752 { … … 866 860 return polno ; 867 861 } 862 863 void 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.