Changeset 2664 for trunk/external-alma


Ignore:
Timestamp:
10/11/12 17:24:12 (12 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...

Fix for serious bug in NRO FITS reader, which sets BEAMNO to wrong value
when array number is larger than 9.


File:
1 edited

Legend:

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

    r2442 r2664  
    620620  }
    621621  // DEBUG
    622 //   nro_debug_output( "RX", ARYNM, RX ) ;
     622  //nro_debug_output( "RX", ARYNM, RX ) ;
    623623  //
    624624  if ( readColumn( HPBW, "HPBW", sameEndian ) != 0 ) {
     
    10221022  strcpy( record_->ARRYT, str4.c_str() ) ;
    10231023  status = readTable( record_->ARRYT, "ARRYT", strlen(record_->ARRYT), i ) ;
    1024   record_->ARRYT[3] = '\0' ;
     1024  for (int j = strlen(record_->ARRYT)-1 ; j >= 0 ; j--) {
     1025    if (record_->ARRYT[j] == ' ') record_->ARRYT[j] = '\0';
     1026    else break;
     1027  }
    10251028  if ( status ) {
    10261029    os << LogIO::WARN << "Error while reading ARRYT." << LogIO::POST ;
     
    15491552  string arry3 ;
    15501553  string arry4 ;
     1554  char arytp[4];
    15511555  if ( readHeader( arry, "ARRY1" ) == 0 )
    15521556    arry1 = arry ;
     
    15551559  for ( int i = 0 ; i < 20 ; i++ ) {
    15561560    if ( arry1[i] == '1' ) {
    1557       char arytp[4] ;
     1561      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
    15581562      sprintf( arytp, "H%d", i+1 ) ;
    15591563      ARYTP[count++] = string( arytp ) ;
    1560       //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    15611564    }
    15621565  }
     
    15651568  else
    15661569    arry2 = "00000000000000000000" ;
    1567   for ( int i = 0 ; i < 20 ; i++ ) {
     1570  for ( int i = 0 ; i < 10 ; i++ ) {
    15681571    if ( arry2[i] == '1' ) {
    1569       if ( i < 10 ) {
    1570         char arytp[4] ;
    1571         sprintf( arytp, "W%d", i+1 ) ;
    1572         ARYTP[count++] = string( arytp ) ;
    1573         //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    1574       }
    1575       else if ( i < 15 ) {
    1576         char arytp[4] ;
    1577         sprintf( arytp, "U%d", i-9 ) ;
    1578         ARYTP[count++] = string( arytp ) ;
    1579         //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    1580       }
    1581       else {
    1582         char arytp[4] ;
    1583         sprintf( arytp, "X%d", i-14 ) ;
    1584         ARYTP[count++] = string( arytp ) ;
    1585         //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    1586       }
     1572      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
     1573      sprintf( arytp, "W%d", i+1 ) ;
     1574      ARYTP[count++] = string( arytp ) ;
     1575    }
     1576  }
     1577  for ( int i = 10 ; i < 15 ; i++ ) {
     1578    if ( arry2[i] == '1' ) {
     1579      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
     1580      sprintf( arytp, "U%d", i-9 ) ;
     1581      ARYTP[count++] = string( arytp ) ;
     1582    }
     1583  }
     1584  for ( int i = 15 ; i < 20 ; i++ ) {
     1585    if ( arry2[i] == '1' ) {
     1586      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
     1587      sprintf( arytp, "X%d", i-14 ) ;
     1588      ARYTP[count++] = string( arytp ) ;
    15871589    }
    15881590  }
     
    15931595  for ( int i = 0 ; i < 20 ; i++ ) {
    15941596    if ( arry3[i] == '1' ) {
    1595       char arytp[4] ;
     1597      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
    15961598      sprintf( arytp, "A%d", i+1 ) ;
    15971599      ARYTP[count++] = string( arytp ) ;
    1598       //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    15991600    }
    16001601  }
     
    16051606  for ( int i = 0 ; i < 20 ; i++ ) {
    16061607    if ( arry4[i] == '1' ) {
    1607       char arytp[4] ;
     1608      for (int j = 0 ; j < 4 ; j++) arytp[j] = '\0';
    16081609      sprintf( arytp, "A%d", i+21 ) ;
    16091610      ARYTP[count++] = string( arytp ) ;
    1610       //cout << "ARYTP[" << count-1 << "] = " << ARYTP[count-1] << endl ;
    16111611    }
    16121612  }     
     1613  //nro_debug_output("ARYTP", ARYTP.size(), ARYTP);
    16131614}
    16141615
     
    22342235uInt NROFITSDataset::getArrayId( string type )
    22352236{
    2236   uInt ib = 99 ;
    2237   for ( uInt i = 0 ; i < arrayid_.size() ; i++ ) {
    2238     uInt len = ARYTP[i].size() ;
    2239     if ( type.compare( 0, len, ARYTP[i], 0, len ) == 0 ) {
     2237  uInt ib = 99;
     2238  uInt len0 = type.size();
     2239  for (uInt i = 0 ; i < arrayid_.size() ; i++) {
     2240    uInt len = ARYTP[i].size();
     2241    if ( len0 == len && type.compare( 0, len, ARYTP[i], 0, len ) == 0 ) {
    22402242      ib = i ;
    22412243      break ;
Note: See TracChangeset for help on using the changeset viewer.