Changeset 3106 for trunk/external-alma/oldasdm2ASAP/OldASDMReader.cc
- Timestamp:
- 10/04/16 18:20:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/oldasdm2ASAP/OldASDMReader.cc
r2355 r3106 56 56 } 57 57 58 bool OldASDMReader::open( const string &filename, const casa ::Record &rec )59 { 60 casa ::String funcName = "open" ;58 bool OldASDMReader::open( const string &filename, const casacore::Record &rec ) 59 { 60 casacore::String funcName = "open" ; 61 61 62 62 // return value … … 71 71 // parsing ASDM options 72 72 if ( rec.isDefined( "asdm" ) ) { 73 casa ::Record asdmrec = rec.asRecord( "asdm" ) ;73 casacore::Record asdmrec = rec.asRecord( "asdm" ) ; 74 74 75 75 // antenna 76 76 if ( asdmrec.isDefined( "antenna" ) ) { 77 if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casa ::TpInt ) {77 if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casacore::TpInt ) { 78 78 antennaId_ = asdmrec.asInt( "antenna" ) ; 79 79 } … … 182 182 vector<AntennaRow *> rows = atab.get() ; 183 183 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_ ) { 186 186 idx = rows[irow]->getAntennaId().getTagValue() ; 187 187 break ; … … 190 190 if ( idx == -1 ) { 191 191 close() ; 192 throw (casa ::AipsError( antennaName_ + " not found." )) ;192 throw (casacore::AipsError( antennaName_ + " not found." )) ; 193 193 } 194 194 else { … … 203 203 if ( antennaRow == 0 ) { 204 204 close() ; 205 throw (casa ::AipsError( "AntennaId " + casa::String::toString(antennaId_) + " is invalid." ) ) ;205 throw (casacore::AipsError( "AntennaId " + casacore::String::toString(antennaId_) + " is invalid." ) ) ; 206 206 } 207 207 } … … 210 210 // set antenna name 211 211 if ( antennaName_.size() == 0 ) { 212 antennaName_ = casa ::String( antennaRow->getName() ) ;212 antennaName_ = casacore::String( antennaRow->getName() ) ; 213 213 } 214 214 … … 217 217 218 218 // station name 219 stationName_ = casa ::String( stationRow->getName() ) ;219 stationName_ = casacore::String( stationRow->getName() ) ; 220 220 221 221 // antenna position 222 222 antennaPosition_.resize( 3 ) ; 223 223 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" ) ) ; 226 226 227 227 // create SDMBinData object … … 229 229 230 230 // get Main rows 231 //mainRow_ = casa ::Vector<MainRow *>(asdm_->getMain().get()) ;231 //mainRow_ = casacore::Vector<MainRow *>(asdm_->getMain().get()) ; 232 232 233 233 // set up IFNO … … 262 262 } 263 263 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" ;264 void 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" ; 283 283 284 284 ExecBlockTable &ebtab = asdm_->getExecBlock() ; 285 285 // at the moment take first row of ExecBlock table 286 286 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() ) ; 289 289 290 290 // antennaname … … 295 295 // antennaposition 296 296 antennaposition.resize( 3 ) ; 297 for ( casa ::uInt i = 0 ; i < 3 ; i++ )297 for ( casacore::uInt i = 0 ; i < 3 ; i++ ) 298 298 antennaposition[i] = antennaPosition_[i].getValue( Unit("m") ) ; 299 299 … … 307 307 // utc 308 308 // start time of the project 309 utc = casa ::Double( ebrow->getStartTime().getMJD() ) ;309 utc = casacore::Double( ebrow->getStartTime().getMJD() ) ; 310 310 311 311 … … 326 326 refidx = irow ; 327 327 } 328 nchan = casa ::Int( *max_element( nchans.begin(), nchans.end() ) ) ;328 nchan = casacore::Int( *max_element( nchans.begin(), nchans.end() ) ) ; 329 329 330 330 //logsink_->postLocally( LogMessage("refidx = "+String::toString(refidx),LogOrigin(className_,funcName,WHERE)) ) ; … … 337 337 } 338 338 } 339 bandwidth = casa ::Double( *max_element( bws.begin(), bws.end() ) ) ;339 bandwidth = casacore::Double( *max_element( bws.begin(), bws.end() ) ) ; 340 340 341 341 // reffreq 342 reffreq = casa ::Double( spwrows[refidx]->getRefFreq().get() ) ;342 reffreq = casacore::Double( spwrows[refidx]->getRefFreq().get() ) ; 343 343 344 344 // freqref … … 382 382 383 383 // npol 384 npol = casa ::Int( *max_element( npols.begin(), npols.end() ) ) ;384 npol = casacore::Int( *max_element( npols.begin(), npols.end() ) ) ; 385 385 386 386 // poltype … … 421 421 422 422 // nbeam 423 nbeam = casa ::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ;423 nbeam = casacore::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ; 424 424 425 425 // fluxunit … … 441 441 obstype = "" ; 442 442 for ( unsigned int imode = 0 ; imode < obsmode.size() ; imode++ ) { 443 obstype += casa ::String(obsmode[imode]) ;443 obstype += casacore::String(obsmode[imode]) ; 444 444 if ( imode != obsmode.size()-1 ) 445 445 obstype += "#" ; … … 449 449 void OldASDMReader::selectConfigDescription() 450 450 { 451 casa ::String funcName = "selectConfigDescription" ;451 casacore::String funcName = "selectConfigDescription" ; 452 452 453 453 vector<ConfigDescriptionRow *> cdrows = asdm_->getConfigDescription().get() ; … … 462 462 configDescIdList_.resize( cdidTags.size() ) ; 463 463 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() ) ; 465 465 } 466 466 } … … 472 472 Tag atag( antennaId_, TagType::Antenna ) ; 473 473 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 ) ) 476 476 continue ; 477 477 if ( frows[irow]->getAntennaId() == atag ) { … … 483 483 } 484 484 485 casa ::Vector<casa::uInt> OldASDMReader::getFieldIdList()486 { 487 casa ::String funcName = "getFieldIdList" ;485 casacore::Vector<casacore::uInt> OldASDMReader::getFieldIdList() 486 { 487 casacore::String funcName = "getFieldIdList" ; 488 488 489 489 vector<FieldRow *> frows = asdm_->getField().get() ; … … 497 497 } 498 498 499 casa ::uInt OldASDMReader::getNumMainRow()500 { 501 casa ::uInt nrow = casa::uInt( mainRow_.size() ) ;499 casacore::uInt OldASDMReader::getNumMainRow() 500 { 501 casacore::uInt nrow = casacore::uInt( mainRow_.size() ) ; 502 502 503 503 return nrow ; … … 530 530 } 531 531 532 casa ::Bool OldASDMReader::setMainRow( casa::uInt irow )533 { 534 casa ::Bool status = true ;532 casacore::Bool OldASDMReader::setMainRow( casacore::uInt irow ) 533 { 534 casacore::Bool status = true ; 535 535 row_ = irow ; 536 536 execBlockTag_ = mainRow_[row_]->getExecBlockId() ; … … 540 540 status = false ; 541 541 else { 542 status = (casa ::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ;542 status = (casacore::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ; 543 543 } 544 544 return status ; 545 545 } 546 546 547 casa ::Bool OldASDMReader::setMainRow( casa::uInt configDescId, casa::uInt fieldId )547 casacore::Bool OldASDMReader::setMainRow( casacore::uInt configDescId, casacore::uInt fieldId ) 548 548 { 549 549 clearMainRow() ; … … 551 551 Tag configDescTag( (unsigned int)configDescId, TagType::ConfigDescription ) ; 552 552 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 ) ) ) ; 554 554 555 555 return true ; … … 563 563 void OldASDMReader::setupIFNO() 564 564 { 565 casa ::String funcName = "setupIFNO" ;565 casacore::String funcName = "setupIFNO" ; 566 566 567 567 vector<SpectralWindowRow *> spwrows = asdm_->getSpectralWindow().get() ; 568 568 unsigned int nrow = spwrows.size() ; 569 569 ifno_.clear() ; 570 casa ::uInt idx = 0 ;571 casa ::uInt wvridx = 0 ;570 casacore::uInt idx = 0 ; 571 casacore::uInt wvridx = 0 ; 572 572 for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) { 573 casa ::uInt index ;573 casacore::uInt index ; 574 574 if ( isWVR( spwrows[irow] ) ) { 575 575 //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+" is WVR",LogOrigin(className_,funcName,WHERE)) ) ; … … 579 579 index = ++idx ; 580 580 } 581 ifno_.insert( pair<Tag,casa ::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ;581 ifno_.insert( pair<Tag,casacore::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ; 582 582 //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+": IFNO="+String::toString(index),LogOrigin(className_,funcName,WHERE)) ) ; 583 583 } … … 594 594 } 595 595 596 casa ::Bool OldASDMReader::setData()597 { 598 casa ::String funcName = "setData" ;596 casacore::Bool OldASDMReader::setData() 597 { 598 casacore::String funcName = "setData" ; 599 599 600 600 //logsink_->postLocally( LogMessage("try to retrieve binary data",LogOrigin(className_,funcName,WHERE)) ) ; … … 671 671 } 672 672 673 casa ::uInt OldASDMReader::getIFNo( unsigned int idx )673 casacore::uInt OldASDMReader::getIFNo( unsigned int idx ) 674 674 { 675 675 prepareData( idx ) ; … … 677 677 } 678 678 679 casa ::uInt OldASDMReader::getIFNo()680 { 681 map<Tag,casa ::uInt>::iterator iter = ifno_.find( specWinTag_ ) ;679 casacore::uInt OldASDMReader::getIFNo() 680 { 681 map<Tag,casacore::uInt>::iterator iter = ifno_.find( specWinTag_ ) ; 682 682 if ( iter != ifno_.end() ) 683 683 return iter->second ; … … 713 713 string &freqref ) 714 714 { 715 casa ::String funcName = "getFrequency" ;715 casacore::String funcName = "getFrequency" ; 716 716 717 717 int nchan = specWinRow_p->getNumChan() ; … … 730 730 } 731 731 else { 732 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;732 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 733 733 } 734 734 } … … 745 745 } 746 746 else { 747 throw (casa ::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;747 throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ; 748 748 } 749 749 if ( specWinRow_p->isChanFreqStepExists() ) { … … 757 757 } 758 758 else { 759 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;759 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ; 760 760 } 761 761 if ( specWinRow_p->isChanFreqStartExists() ) { … … 766 766 } 767 767 else { 768 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;768 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 769 769 } 770 770 } … … 781 781 } 782 782 else { 783 throw (casa ::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;783 throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ; 784 784 } 785 785 if ( specWinRow_p->isChanFreqStepExists() ) { … … 793 793 } 794 794 else { 795 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;795 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ; 796 796 } 797 797 if ( specWinRow_p->isChanFreqStartExists() ) { … … 803 803 } 804 804 else { 805 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;805 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 806 806 } 807 807 } … … 1237 1237 for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) { 1238 1238 CalAtmosphereRow *atmrow = atmrows[irow] ; 1239 if ( casa ::String(atmrow->getAntennaName()) != antennaName_1239 if ( casacore::String(atmrow->getAntennaName()) != antennaName_ 1240 1240 //|| atmrow->getReceiverBand() != rb 1241 1241 //|| atmrow->getBasebandName() != bbname … … 1279 1279 float &windaz ) 1280 1280 { 1281 casa ::String funcName = "getWeatherInfo" ;1281 casacore::String funcName = "getWeatherInfo" ; 1282 1282 1283 1283 temperature = 0.0 ; … … 1668 1668 double &el, 1669 1669 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 ) 1672 1672 { 1673 1673 String funcName = "toJ2000" ; … … 1681 1681 1682 1682 vector<double> OldASDMReader::toJ2000( vector<double> &dir, 1683 casa ::String &dirref,1683 casacore::String &dirref, 1684 1684 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" ; 1689 1689 1690 1690 vector<double> newd( dir ) ; 1691 1691 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 ) ; 1695 1695 //ostringstream oss ; 1696 1696 //mp.print( oss ) ; 1697 1697 //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ; 1698 1698 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 ) ; 1702 1702 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() ; 1706 1706 //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ; 1707 1707 newd[0] = (double)(cdir[0]) ; … … 1719 1719 string OldASDMReader::getFrame() 1720 1720 { 1721 casa ::String funcName = "getFrame" ;1721 casacore::String funcName = "getFrame" ; 1722 1722 1723 1723 // default is TOPO … … 1748 1748 int OldASDMReader::getNumIFs() 1749 1749 { 1750 casa ::String funcName = "getNumIFs" ;1750 casacore::String funcName = "getNumIFs" ; 1751 1751 1752 1752 int nif = 0 ;
Note: See TracChangeset
for help on using the changeset viewer.