Changeset 2777 for trunk/external-alma
- Timestamp:
- 03/07/13 13:28:44 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/ASTEDataset.h
r1757 r2777 83 83 // fill header information 84 84 virtual int fillHeader( int sameEndian ) ; 85 86 // return ARRAYMAX 87 virtual int arrayMax() { return ASTE_ARYMAX; } ; 85 88 } ; 86 89 -
trunk/external-alma/atnf/PKSIO/ASTEFXDataset.h
r1757 r2777 83 83 // fill header information 84 84 virtual int fillHeader( int sameEndian ) ; 85 86 // return ARRAYMAX 87 virtual int arrayMax() { return ASTE_ARYMAX_FX; } ; 85 88 } ; 86 89 -
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 } -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2766 r2777 199 199 virtual std::vector<double> getFrequencies( int i ) ; 200 200 virtual uInt getArrayId( std::string type ) ; 201 virtual uInt getSortedArrayId( std::string type ) ; 201 202 virtual uInt getPolNo( int irow ) ; 202 203 … … 242 243 uInt polNoFromRX( const std::string &rx ) ; 243 244 245 // initialize array information (only for OTF data) 246 void initArray(); 247 248 // return ARRYMAX 249 virtual int arrayMax() {return 0;} ; 250 244 251 // Type of file record 245 252 std::string LOFIL ; … … 517 524 // reference frequency for each array 518 525 std::vector<double> refFreq_ ; 526 527 // list of array names 528 std::vector<std::string> arrayNames_; 519 529 520 530 // record to store REFPIX, REFVAL, INCREMENT pair for each array -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc
r2436 r2777 829 829 830 830 scanNum_ = NSCAN + 1 ; // includes ZERO scan 831 //scanNum_ = NSCAN ; 831 832 rowNum_ = scanNum_ * ARYNM ; 832 833 scanLen_ = SCNLEN ; … … 835 836 record_->LDATA = new char[dataLen_] ; 836 837 838 initArray(); 839 837 840 show() ; 838 841 -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.h
r1757 r2777 83 83 // fill header information 84 84 virtual int fillHeader( int sameEndian ) ; 85 86 // return ARRAYMAX 87 virtual int arrayMax() { return NRO_ARYMAX; } ; 85 88 } ; 86 89 -
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2766 r2777 579 579 if ( rxname.find("MULT2") != string::npos ) { 580 580 string arryt = string( record->ARRYT ) ; 581 beamno = dataset_->get ArrayId( arryt ) ;581 beamno = dataset_->getSortedArrayId( arryt ) ; 582 582 ifno = 0 ; 583 583 } … … 585 585 beamno = 0 ; 586 586 string arryt = string( record->ARRYT ) ; 587 ifno = dataset_->get ArrayId( arryt ) ;587 ifno = dataset_->getSortedArrayId( arryt ) ; 588 588 } 589 589 //cout << "beamno = " << beamno << endl ;
Note:
See TracChangeset
for help on using the changeset viewer.