Changeset 2777 for trunk/external-alma


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.


Location:
trunk/external-alma/atnf/PKSIO
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/atnf/PKSIO/ASTEDataset.h

    r1757 r2777  
    8383  // fill header information
    8484  virtual int fillHeader( int sameEndian ) ;
     85
     86  // return ARRAYMAX
     87  virtual int arrayMax() { return ASTE_ARYMAX; } ;
    8588} ;
    8689
  • trunk/external-alma/atnf/PKSIO/ASTEFXDataset.h

    r1757 r2777  
    8383  // fill header information
    8484  virtual int fillHeader( int sameEndian ) ;
     85
     86  // return ARRAYMAX
     87  virtual int arrayMax() { return ASTE_ARYMAX_FX; } ;
    8588} ;
    8689
  • 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}
  • trunk/external-alma/atnf/PKSIO/NRODataset.h

    r2766 r2777  
    199199  virtual std::vector<double> getFrequencies( int i ) ;
    200200  virtual uInt getArrayId( std::string type ) ;
     201  virtual uInt getSortedArrayId( std::string type ) ;
    201202  virtual uInt getPolNo( int irow ) ;
    202203
     
    242243  uInt polNoFromRX( const std::string &rx ) ;
    243244
     245  // initialize array information (only for OTF data)
     246  void initArray();
     247
     248  // return ARRYMAX
     249  virtual int arrayMax() {return 0;} ;
     250
    244251  // Type of file record
    245252  std::string LOFIL ;
     
    517524  // reference frequency for each array
    518525  std::vector<double> refFreq_ ;
     526
     527  // list of array names
     528  std::vector<std::string> arrayNames_;
    519529
    520530  // record to store REFPIX, REFVAL, INCREMENT pair for each array
  • trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc

    r2436 r2777  
    829829
    830830  scanNum_ = NSCAN + 1 ; // includes ZERO scan
     831  //scanNum_ = NSCAN ;
    831832  rowNum_ = scanNum_ * ARYNM ;
    832833  scanLen_ = SCNLEN ;
     
    835836  record_->LDATA = new char[dataLen_] ;
    836837
     838  initArray();
     839
    837840  show() ;
    838841
  • trunk/external-alma/atnf/PKSIO/NROOTFDataset.h

    r1757 r2777  
    8383  // fill header information
    8484  virtual int fillHeader( int sameEndian ) ;
     85
     86  // return ARRAYMAX
     87  virtual int arrayMax() { return NRO_ARYMAX; } ;
    8588} ;
    8689
  • trunk/external-alma/atnf/PKSIO/NROReader.cc

    r2766 r2777  
    579579  if ( rxname.find("MULT2") != string::npos ) {
    580580    string arryt = string( record->ARRYT ) ;
    581     beamno = dataset_->getArrayId( arryt ) ;
     581    beamno = dataset_->getSortedArrayId( arryt ) ;
    582582    ifno = 0 ;
    583583  }
     
    585585    beamno = 0 ;
    586586    string arryt = string( record->ARRYT ) ;
    587     ifno = dataset_->getArrayId( arryt ) ;
     587    ifno = dataset_->getSortedArrayId( arryt ) ;
    588588  }
    589589  //cout << "beamno = " << beamno << endl ;
Note: See TracChangeset for help on using the changeset viewer.