Ignore:
Timestamp:
10/04/16 18:20:50 (8 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes/No?

Interface Changes: Yes/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...


Check-in asap modifications from Jim regarding casacore namespace conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/oldasdm2ASAP/OldASDMReader.cc

    r2355 r3106  
    5656}
    5757
    58 bool OldASDMReader::open( const string &filename, const casa::Record &rec )
    59 {
    60   casa::String funcName = "open" ;
     58bool OldASDMReader::open( const string &filename, const casacore::Record &rec )
     59{
     60  casacore::String funcName = "open" ;
    6161
    6262  // return value
     
    7171  // parsing ASDM options
    7272  if ( rec.isDefined( "asdm" ) ) {
    73     casa::Record asdmrec = rec.asRecord( "asdm" ) ;
     73    casacore::Record asdmrec = rec.asRecord( "asdm" ) ;
    7474
    7575    // antenna
    7676    if ( asdmrec.isDefined( "antenna" ) ) {
    77       if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casa::TpInt ) {
     77      if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casacore::TpInt ) {
    7878        antennaId_ = asdmrec.asInt( "antenna" ) ;
    7979      }
     
    182182    vector<AntennaRow *> rows = atab.get() ;
    183183    int idx = -1 ;
    184     for ( casa::uInt irow = 0 ; irow < rows.size() ; irow++ ) {
    185       if ( casa::String(rows[irow]->getName()) == antennaName_ ) {
     184    for ( casacore::uInt irow = 0 ; irow < rows.size() ; irow++ ) {
     185      if ( casacore::String(rows[irow]->getName()) == antennaName_ ) {
    186186        idx = rows[irow]->getAntennaId().getTagValue() ;
    187187        break ;
     
    190190    if ( idx == -1 ) {
    191191      close() ;
    192       throw (casa::AipsError( antennaName_ + " not found." )) ;
     192      throw (casacore::AipsError( antennaName_ + " not found." )) ;
    193193    }
    194194    else {
     
    203203    if ( antennaRow == 0 ) {
    204204      close() ;
    205       throw (casa::AipsError( "AntennaId " + casa::String::toString(antennaId_) + " is invalid." ) ) ;
     205      throw (casacore::AipsError( "AntennaId " + casacore::String::toString(antennaId_) + " is invalid." ) ) ;
    206206    }
    207207  }
     
    210210  // set antenna name
    211211  if ( antennaName_.size() == 0 ) {
    212     antennaName_ = casa::String( antennaRow->getName() ) ;
     212    antennaName_ = casacore::String( antennaRow->getName() ) ;
    213213  }
    214214
     
    217217
    218218  // station name
    219   stationName_ = casa::String( stationRow->getName() ) ;
     219  stationName_ = casacore::String( stationRow->getName() ) ;
    220220
    221221  // antenna position
    222222  antennaPosition_.resize( 3 ) ;
    223223  vector<Length> antpos = stationRow->getPosition() ;
    224   for ( casa::uInt i = 0 ; i < 3 ; i++ )
    225     antennaPosition_[i] = Quantity( casa::Double( antpos[i].get() ), Unit( "m" ) ) ;
     224  for ( casacore::uInt i = 0 ; i < 3 ; i++ )
     225    antennaPosition_[i] = Quantity( casacore::Double( antpos[i].get() ), Unit( "m" ) ) ;
    226226
    227227  // create SDMBinData object
     
    229229
    230230  // get Main rows
    231   //mainRow_ = casa::Vector<MainRow *>(asdm_->getMain().get()) ;
     231  //mainRow_ = casacore::Vector<MainRow *>(asdm_->getMain().get()) ;
    232232
    233233  // set up IFNO
     
    262262}
    263263
    264 void OldASDMReader::fillHeader( casa::Int &nchan,
    265                              casa::Int &npol,
    266                              casa::Int &nif,
    267                              casa::Int &nbeam,
    268                              casa::String &observer,
    269                              casa::String &project,
    270                              casa::String &obstype,
    271                              casa::String &antennaname,
    272                              casa::Vector<casa::Double> &antennaposition,
    273                              casa::Float &equinox,
    274                              casa::String &freqref,
    275                              casa::Double &reffreq,
    276                              casa::Double &bandwidth,
    277                              casa::Double &utc,
    278                              casa::String &fluxunit,
    279                              casa::String &epoch,
    280                              casa::String &poltype )
    281 {
    282   casa::String funcName = "fillHeader" ;
     264void OldASDMReader::fillHeader( casacore::Int &nchan,
     265                             casacore::Int &npol,
     266                             casacore::Int &nif,
     267                             casacore::Int &nbeam,
     268                             casacore::String &observer,
     269                             casacore::String &project,
     270                             casacore::String &obstype,
     271                             casacore::String &antennaname,
     272                             casacore::Vector<casacore::Double> &antennaposition,
     273                             casacore::Float &equinox,
     274                             casacore::String &freqref,
     275                             casacore::Double &reffreq,
     276                             casacore::Double &bandwidth,
     277                             casacore::Double &utc,
     278                             casacore::String &fluxunit,
     279                             casacore::String &epoch,
     280                             casacore::String &poltype )
     281{
     282  casacore::String funcName = "fillHeader" ;
    283283
    284284  ExecBlockTable &ebtab = asdm_->getExecBlock() ;
    285285  // at the moment take first row of ExecBlock table
    286286  ExecBlockRow *ebrow = ebtab.get()[0] ;
    287   casa::String telescopeName( ebrow->getTelescopeName() ) ;
    288   //casa::String stationName( stationRow_p->getName() ) ;
     287  casacore::String telescopeName( ebrow->getTelescopeName() ) ;
     288  //casacore::String stationName( stationRow_p->getName() ) ;
    289289
    290290  // antennaname
     
    295295  // antennaposition
    296296  antennaposition.resize( 3 ) ;
    297   for ( casa::uInt i = 0 ; i < 3 ; i++ )
     297  for ( casacore::uInt i = 0 ; i < 3 ; i++ )
    298298    antennaposition[i] = antennaPosition_[i].getValue( Unit("m") ) ;
    299299
     
    307307  // utc
    308308  // start time of the project
    309   utc = casa::Double( ebrow->getStartTime().getMJD() ) ;
     309  utc = casacore::Double( ebrow->getStartTime().getMJD() ) ;
    310310 
    311311
     
    326326      refidx = irow ;
    327327  }
    328   nchan = casa::Int( *max_element( nchans.begin(), nchans.end() ) ) ;
     328  nchan = casacore::Int( *max_element( nchans.begin(), nchans.end() ) ) ;
    329329
    330330  //logsink_->postLocally( LogMessage("refidx = "+String::toString(refidx),LogOrigin(className_,funcName,WHERE)) ) ;
     
    337337    }
    338338  }
    339   bandwidth = casa::Double( *max_element( bws.begin(), bws.end() ) ) ;
     339  bandwidth = casacore::Double( *max_element( bws.begin(), bws.end() ) ) ;
    340340
    341341  // reffreq
    342   reffreq = casa::Double( spwrows[refidx]->getRefFreq().get() ) ;
     342  reffreq = casacore::Double( spwrows[refidx]->getRefFreq().get() ) ;
    343343
    344344  // freqref
     
    382382
    383383  // npol
    384   npol = casa::Int( *max_element( npols.begin(), npols.end() ) ) ;
     384  npol = casacore::Int( *max_element( npols.begin(), npols.end() ) ) ;
    385385
    386386  // poltype
     
    421421
    422422  // nbeam
    423   nbeam = casa::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ;
     423  nbeam = casacore::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ;
    424424
    425425  // fluxunit
     
    441441  obstype = "" ;
    442442  for ( unsigned int imode = 0 ; imode < obsmode.size() ; imode++ ) {
    443     obstype += casa::String(obsmode[imode]) ;
     443    obstype += casacore::String(obsmode[imode]) ;
    444444    if ( imode != obsmode.size()-1 )
    445445      obstype += "#" ;
     
    449449void OldASDMReader::selectConfigDescription()
    450450{
    451   casa::String funcName = "selectConfigDescription" ;
     451  casacore::String funcName = "selectConfigDescription" ;
    452452
    453453  vector<ConfigDescriptionRow *> cdrows = asdm_->getConfigDescription().get() ;
     
    462462  configDescIdList_.resize( cdidTags.size() ) ;
    463463  for ( unsigned int i = 0 ; i < cdidTags.size() ; i++ ) {
    464     configDescIdList_[i] = casa::uInt( cdidTags[i].getTagValue() ) ;
     464    configDescIdList_[i] = casacore::uInt( cdidTags[i].getTagValue() ) ;
    465465  }
    466466}
     
    472472  Tag atag( antennaId_, TagType::Antenna ) ;
    473473  for ( unsigned int irow = 0 ; irow < frows.size() ; irow++ ) {
    474     casa::uInt feedId = (casa::uInt)(frows[irow]->getFeedId() ) ;
    475     if ( casa::anyEQ( feedIdList_, feedId ) )
     474    casacore::uInt feedId = (casacore::uInt)(frows[irow]->getFeedId() ) ;
     475    if ( casacore::anyEQ( feedIdList_, feedId ) )
    476476      continue ;
    477477    if ( frows[irow]->getAntennaId() == atag ) {
     
    483483}
    484484
    485 casa::Vector<casa::uInt> OldASDMReader::getFieldIdList()
    486 {
    487   casa::String funcName = "getFieldIdList" ;
     485casacore::Vector<casacore::uInt> OldASDMReader::getFieldIdList()
     486{
     487  casacore::String funcName = "getFieldIdList" ;
    488488
    489489  vector<FieldRow *> frows = asdm_->getField().get() ;
     
    497497}
    498498
    499 casa::uInt OldASDMReader::getNumMainRow()
    500 {
    501   casa::uInt nrow = casa::uInt( mainRow_.size() ) ;
     499casacore::uInt OldASDMReader::getNumMainRow()
     500{
     501  casacore::uInt nrow = casacore::uInt( mainRow_.size() ) ;
    502502
    503503  return nrow ;
     
    530530}
    531531
    532 casa::Bool OldASDMReader::setMainRow( casa::uInt irow )
    533 {
    534   casa::Bool status = true ;
     532casacore::Bool OldASDMReader::setMainRow( casacore::uInt irow )
     533{
     534  casacore::Bool status = true ;
    535535  row_ = irow ;
    536536  execBlockTag_ = mainRow_[row_]->getExecBlockId() ;
     
    540540    status = false ;
    541541  else {
    542     status = (casa::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ;
     542    status = (casacore::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ;
    543543  }
    544544  return status ;
    545545}
    546546
    547 casa::Bool OldASDMReader::setMainRow( casa::uInt configDescId, casa::uInt fieldId )
     547casacore::Bool OldASDMReader::setMainRow( casacore::uInt configDescId, casacore::uInt fieldId )
    548548{
    549549  clearMainRow() ;
     
    551551  Tag configDescTag( (unsigned int)configDescId, TagType::ConfigDescription ) ;
    552552  Tag fieldTag( (unsigned int)fieldId, TagType::Field ) ;
    553   mainRow_ = casa::Vector<MainRow *>( *(asdm_->getMain().getByContext( configDescTag, fieldTag ) ) ) ;
     553  mainRow_ = casacore::Vector<MainRow *>( *(asdm_->getMain().getByContext( configDescTag, fieldTag ) ) ) ;
    554554 
    555555  return true ;
     
    563563void OldASDMReader::setupIFNO()
    564564{
    565   casa::String funcName = "setupIFNO" ;
     565  casacore::String funcName = "setupIFNO" ;
    566566
    567567  vector<SpectralWindowRow *> spwrows = asdm_->getSpectralWindow().get() ;
    568568  unsigned int nrow = spwrows.size() ;
    569569  ifno_.clear() ;
    570   casa::uInt idx = 0 ;
    571   casa::uInt wvridx = 0 ;
     570  casacore::uInt idx = 0 ;
     571  casacore::uInt wvridx = 0 ;
    572572  for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) {
    573     casa::uInt index ;
     573    casacore::uInt index ;
    574574    if ( isWVR( spwrows[irow] ) ) {
    575575      //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+" is WVR",LogOrigin(className_,funcName,WHERE)) ) ;
     
    579579      index = ++idx ;
    580580    }
    581     ifno_.insert( pair<Tag,casa::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ;
     581    ifno_.insert( pair<Tag,casacore::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ;
    582582    //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+": IFNO="+String::toString(index),LogOrigin(className_,funcName,WHERE)) ) ;
    583583  }
     
    594594}
    595595
    596 casa::Bool OldASDMReader::setData()
    597 {
    598   casa::String funcName = "setData" ;
     596casacore::Bool OldASDMReader::setData()
     597{
     598  casacore::String funcName = "setData" ;
    599599
    600600  //logsink_->postLocally( LogMessage("try to retrieve binary data",LogOrigin(className_,funcName,WHERE)) ) ;
     
    671671}
    672672
    673 casa::uInt OldASDMReader::getIFNo( unsigned int idx )
     673casacore::uInt OldASDMReader::getIFNo( unsigned int idx )
    674674{
    675675  prepareData( idx ) ;
     
    677677}
    678678
    679 casa::uInt OldASDMReader::getIFNo()
    680 {
    681   map<Tag,casa::uInt>::iterator iter = ifno_.find( specWinTag_ ) ;
     679casacore::uInt OldASDMReader::getIFNo()
     680{
     681  map<Tag,casacore::uInt>::iterator iter = ifno_.find( specWinTag_ ) ;
    682682  if ( iter != ifno_.end() )
    683683    return iter->second ;
     
    713713                               string &freqref )
    714714{
    715   casa::String funcName = "getFrequency" ;
     715  casacore::String funcName = "getFrequency" ;
    716716
    717717  int nchan = specWinRow_p->getNumChan() ;
     
    730730    }
    731731    else {
    732       throw (casa::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
     732      throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
    733733    }     
    734734  }
     
    745745    }
    746746    else {
    747       throw (casa::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;
     747      throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;
    748748    }     
    749749    if ( specWinRow_p->isChanFreqStepExists() ) {
     
    757757    }
    758758    else {
    759       throw (casa::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;
     759      throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;
    760760    }         
    761761    if ( specWinRow_p->isChanFreqStartExists() ) {
     
    766766    }
    767767    else {
    768       throw (casa::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
     768      throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
    769769    }     
    770770  }
     
    781781    }
    782782    else {
    783       throw (casa::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;
     783      throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;
    784784    }
    785785    if ( specWinRow_p->isChanFreqStepExists() ) {
     
    793793    }
    794794    else {
    795       throw (casa::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;
     795      throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;
    796796    }         
    797797    if ( specWinRow_p->isChanFreqStartExists() ) {
     
    803803    }
    804804    else {
    805       throw (casa::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
     805      throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;
    806806    }     
    807807  }
     
    12371237    for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) {
    12381238      CalAtmosphereRow *atmrow = atmrows[irow] ;
    1239       if ( casa::String(atmrow->getAntennaName()) != antennaName_
     1239      if ( casacore::String(atmrow->getAntennaName()) != antennaName_
    12401240           //|| atmrow->getReceiverBand() != rb
    12411241           //|| atmrow->getBasebandName() != bbname
     
    12791279                                 float &windaz )
    12801280{
    1281   casa::String funcName = "getWeatherInfo" ;
     1281  casacore::String funcName = "getWeatherInfo" ;
    12821282
    12831283  temperature = 0.0 ;
     
    16681668                          double &el,
    16691669                          double &mjd,
    1670                           casa::Vector<casa::Quantity> &antpos )
    1671 //                          casa::Vector<casa::Double> antpos )
     1670                          casacore::Vector<casacore::Quantity> &antpos )
     1671//                          casacore::Vector<casacore::Double> antpos )
    16721672{
    16731673  String funcName = "toJ2000" ;
     
    16811681
    16821682vector<double> OldASDMReader::toJ2000( vector<double> &dir,
    1683                                     casa::String &dirref,
     1683                                    casacore::String &dirref,
    16841684                                    double &mjd,
    1685                                     casa::Vector<casa::Quantity> &antpos )
    1686 //                                    casa::Vector<casa::Double> antpos )
    1687 {
    1688   casa::String funcName = "toJ2000" ;
     1685                                    casacore::Vector<casacore::Quantity> &antpos )
     1686//                                    casacore::Vector<casacore::Double> antpos )
     1687{
     1688  casacore::String funcName = "toJ2000" ;
    16891689
    16901690  vector<double> newd( dir ) ;
    16911691  if ( dirref != "J2000" ) {
    1692     casa::MEpoch me( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
    1693     casa::MPosition mp( casa::MVPosition( antpos ),
    1694                         casa::MPosition::ITRF ) ;
     1692    casacore::MEpoch me( casacore::Quantity( (casacore::Double)mjd, "d" ), casacore::MEpoch::UTC ) ;
     1693    casacore::MPosition mp( casacore::MVPosition( antpos ),
     1694                        casacore::MPosition::ITRF ) ;
    16951695    //ostringstream oss ;
    16961696    //mp.print( oss ) ;
    16971697    //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
    16981698   
    1699     casa::MeasFrame mf( me, mp ) ;
    1700     casa::MDirection::Types dirtype ;
    1701     casa::Bool b = casa::MDirection::getType( dirtype, dirref ) ;
     1699    casacore::MeasFrame mf( me, mp ) ;
     1700    casacore::MDirection::Types dirtype ;
     1701    casacore::Bool b = casacore::MDirection::getType( dirtype, dirref ) ;
    17021702    if ( b ) {
    1703       casa::MDirection::Convert toj2000( dirtype,
    1704                                          casa::MDirection::Ref( casa::MDirection::J2000, mf ) ) ;
    1705       casa::Vector<casa::Double> cdir = toj2000( dir ).getAngle( "rad" ).getValue() ;
     1703      casacore::MDirection::Convert toj2000( dirtype,
     1704                                         casacore::MDirection::Ref( casacore::MDirection::J2000, mf ) ) ;
     1705      casacore::Vector<casacore::Double> cdir = toj2000( dir ).getAngle( "rad" ).getValue() ;
    17061706      //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ;
    17071707      newd[0] = (double)(cdir[0]) ;
     
    17191719string OldASDMReader::getFrame()
    17201720{
    1721   casa::String funcName = "getFrame" ;
     1721  casacore::String funcName = "getFrame" ;
    17221722 
    17231723  // default is TOPO
     
    17481748int OldASDMReader::getNumIFs()
    17491749{
    1750   casa::String funcName = "getNumIFs" ;
     1750  casacore::String funcName = "getNumIFs" ;
    17511751
    17521752  int nif = 0 ;
Note: See TracChangeset for help on using the changeset viewer.