Changeset 3106 for trunk/external-alma/asdm2ASAP/ASDMReader.cc
- Timestamp:
- 10/04/16 18:20:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/asdm2ASAP/ASDMReader.cc
r2755 r3106 57 57 } 58 58 59 bool ASDMReader::open( const string &filename, const casa ::Record &rec )60 { 61 casa ::String funcName = "open" ;59 bool ASDMReader::open( const string &filename, const casacore::Record &rec ) 60 { 61 casacore::String funcName = "open" ; 62 62 63 63 // return value … … 72 72 // parsing ASDM options 73 73 if ( rec.isDefined( "asdm" ) ) { 74 casa ::Record asdmrec = rec.asRecord( "asdm" ) ;74 casacore::Record asdmrec = rec.asRecord( "asdm" ) ; 75 75 76 76 // antenna 77 77 if ( asdmrec.isDefined( "antenna" ) ) { 78 if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casa ::TpInt ) {78 if ( asdmrec.type( asdmrec.fieldNumber( "antenna" ) ) == casacore::TpInt ) { 79 79 antennaId_ = asdmrec.asInt( "antenna" ) ; 80 80 } … … 183 183 vector<AntennaRow *> rows = atab.get() ; 184 184 int idx = -1 ; 185 for ( casa ::uInt irow = 0 ; irow < rows.size() ; irow++ ) {186 if ( casa ::String(rows[irow]->getName()) == antennaName_ ) {185 for ( casacore::uInt irow = 0 ; irow < rows.size() ; irow++ ) { 186 if ( casacore::String(rows[irow]->getName()) == antennaName_ ) { 187 187 idx = rows[irow]->getAntennaId().getTagValue() ; 188 188 break ; … … 191 191 if ( idx == -1 ) { 192 192 close() ; 193 throw (casa ::AipsError( antennaName_ + " not found." )) ;193 throw (casacore::AipsError( antennaName_ + " not found." )) ; 194 194 } 195 195 else { … … 204 204 if ( antennaRow == 0 ) { 205 205 close() ; 206 throw (casa ::AipsError( "AntennaId " + casa::String::toString(antennaId_) + " is invalid." ) ) ;206 throw (casacore::AipsError( "AntennaId " + casacore::String::toString(antennaId_) + " is invalid." ) ) ; 207 207 } 208 208 } … … 211 211 // set antenna name 212 212 if ( antennaName_.size() == 0 ) { 213 antennaName_ = casa ::String( antennaRow->getName() ) ;213 antennaName_ = casacore::String( antennaRow->getName() ) ; 214 214 } 215 215 … … 218 218 219 219 // station name 220 stationName_ = casa ::String( stationRow->getName() ) ;220 stationName_ = casacore::String( stationRow->getName() ) ; 221 221 222 222 // antenna position 223 223 antennaPosition_.resize( 3 ) ; 224 224 vector<Length> antpos = stationRow->getPosition() ; 225 for ( casa ::uInt i = 0 ; i < 3 ; i++ )226 antennaPosition_[i] = Quantity( casa ::Double( antpos[i].get() ), Unit( "m" ) ) ;227 mp_ = casa ::MPosition( casa::MVPosition( antennaPosition_ ),228 casa ::MPosition::ITRF ) ;225 for ( casacore::uInt i = 0 ; i < 3 ; i++ ) 226 antennaPosition_[i] = Quantity( casacore::Double( antpos[i].get() ), Unit( "m" ) ) ; 227 mp_ = casacore::MPosition( casacore::MVPosition( antennaPosition_ ), 228 casacore::MPosition::ITRF ) ; 229 229 mf_.set( mp_ ) ; 230 230 … … 233 233 234 234 // get Main rows 235 //mainRow_ = casa ::Vector<MainRow *>(asdm_->getMain().get()) ;235 //mainRow_ = casacore::Vector<MainRow *>(asdm_->getMain().get()) ; 236 236 237 237 // set up IFNO … … 266 266 } 267 267 268 void ASDMReader::fillHeader( casa ::Int &nchan,269 casa ::Int &npol,270 casa ::Int &nif,271 casa ::Int &nbeam,272 casa ::String &observer,273 casa ::String &project,274 casa ::String &obstype,275 casa ::String &antennaname,276 casa ::Vector<casa::Double> &antennaposition,277 casa ::Float &equinox,278 casa ::String &freqref,279 casa ::Double &reffreq,280 casa ::Double &bandwidth,281 casa ::Double &utc,282 casa ::String &fluxunit,283 casa ::String &epoch,284 casa ::String &poltype )285 { 286 casa ::String funcName = "fillHeader" ;268 void ASDMReader::fillHeader( casacore::Int &nchan, 269 casacore::Int &npol, 270 casacore::Int &nif, 271 casacore::Int &nbeam, 272 casacore::String &observer, 273 casacore::String &project, 274 casacore::String &obstype, 275 casacore::String &antennaname, 276 casacore::Vector<casacore::Double> &antennaposition, 277 casacore::Float &equinox, 278 casacore::String &freqref, 279 casacore::Double &reffreq, 280 casacore::Double &bandwidth, 281 casacore::Double &utc, 282 casacore::String &fluxunit, 283 casacore::String &epoch, 284 casacore::String &poltype ) 285 { 286 casacore::String funcName = "fillHeader" ; 287 287 288 288 ExecBlockTable &ebtab = asdm_->getExecBlock() ; 289 289 // at the moment take first row of ExecBlock table 290 290 ExecBlockRow *ebrow = ebtab.get()[0] ; 291 casa ::String telescopeName( ebrow->getTelescopeName() ) ;292 //casa ::String stationName( stationRow_p->getName() ) ;291 casacore::String telescopeName( ebrow->getTelescopeName() ) ; 292 //casacore::String stationName( stationRow_p->getName() ) ; 293 293 294 294 // antennaname … … 299 299 // antennaposition 300 300 antennaposition.resize( 3 ) ; 301 for ( casa ::uInt i = 0 ; i < 3 ; i++ )301 for ( casacore::uInt i = 0 ; i < 3 ; i++ ) 302 302 antennaposition[i] = antennaPosition_[i].getValue( Unit("m") ) ; 303 303 … … 311 311 // utc 312 312 // start time of the project 313 utc = casa ::Double( ebrow->getStartTime().getMJD() ) ;313 utc = casacore::Double( ebrow->getStartTime().getMJD() ) ; 314 314 315 315 … … 330 330 refidx = irow ; 331 331 } 332 nchan = casa ::Int( *max_element( nchans.begin(), nchans.end() ) ) ;332 nchan = casacore::Int( *max_element( nchans.begin(), nchans.end() ) ) ; 333 333 334 334 //logsink_->postLocally( LogMessage("refidx = "+String::toString(refidx),LogOrigin(className_,funcName,WHERE)) ) ; … … 341 341 } 342 342 } 343 bandwidth = casa ::Double( *max_element( bws.begin(), bws.end() ) ) ;343 bandwidth = casacore::Double( *max_element( bws.begin(), bws.end() ) ) ; 344 344 345 345 // reffreq 346 reffreq = casa ::Double( spwrows[refidx]->getRefFreq().get() ) ;346 reffreq = casacore::Double( spwrows[refidx]->getRefFreq().get() ) ; 347 347 348 348 // freqref … … 386 386 387 387 // npol 388 npol = casa ::Int( *max_element( npols.begin(), npols.end() ) ) ;388 npol = casacore::Int( *max_element( npols.begin(), npols.end() ) ) ; 389 389 390 390 // poltype … … 425 425 426 426 // nbeam 427 nbeam = casa ::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ;427 nbeam = casacore::Int( *max_element( nbeams.begin(), nbeams.end() ) ) ; 428 428 429 429 // fluxunit … … 445 445 obstype = "" ; 446 446 for ( unsigned int imode = 0 ; imode < obsmode.size() ; imode++ ) { 447 obstype += casa ::String(obsmode[imode]) ;447 obstype += casacore::String(obsmode[imode]) ; 448 448 if ( imode != obsmode.size()-1 ) 449 449 obstype += "#" ; … … 453 453 void ASDMReader::selectConfigDescription() 454 454 { 455 casa ::String funcName = "selectConfigDescription" ;455 casacore::String funcName = "selectConfigDescription" ; 456 456 457 457 vector<ConfigDescriptionRow *> cdrows = asdm_->getConfigDescription().get() ; … … 466 466 configDescIdList_.resize( cdidTags.size() ) ; 467 467 for ( unsigned int i = 0 ; i < cdidTags.size() ; i++ ) { 468 configDescIdList_[i] = casa ::uInt( cdidTags[i].getTagValue() ) ;468 configDescIdList_[i] = casacore::uInt( cdidTags[i].getTagValue() ) ; 469 469 } 470 470 } … … 476 476 Tag atag( antennaId_, TagType::Antenna ) ; 477 477 for ( unsigned int irow = 0 ; irow < frows.size() ; irow++ ) { 478 casa ::uInt feedId = (casa::uInt)(frows[irow]->getFeedId() ) ;479 if ( casa ::anyEQ( feedIdList_, feedId ) )478 casacore::uInt feedId = (casacore::uInt)(frows[irow]->getFeedId() ) ; 479 if ( casacore::anyEQ( feedIdList_, feedId ) ) 480 480 continue ; 481 481 if ( frows[irow]->getAntennaId() == atag ) { … … 487 487 } 488 488 489 casa ::Vector<casa::uInt> ASDMReader::getFieldIdList()490 { 491 casa ::String funcName = "getFieldIdList" ;489 casacore::Vector<casacore::uInt> ASDMReader::getFieldIdList() 490 { 491 casacore::String funcName = "getFieldIdList" ; 492 492 493 493 vector<FieldRow *> frows = asdm_->getField().get() ; … … 501 501 } 502 502 503 casa ::uInt ASDMReader::getNumMainRow()504 { 505 casa ::uInt nrow = casa::uInt( mainRow_.size() ) ;503 casacore::uInt ASDMReader::getNumMainRow() 504 { 505 casacore::uInt nrow = casacore::uInt( mainRow_.size() ) ; 506 506 507 507 return nrow ; … … 534 534 } 535 535 536 casa ::Bool ASDMReader::setMainRow( casa::uInt irow )537 { 538 casa ::Bool status = true ;536 casacore::Bool ASDMReader::setMainRow( casacore::uInt irow ) 537 { 538 casacore::Bool status = true ; 539 539 row_ = irow ; 540 540 execBlockTag_ = mainRow_[row_]->getExecBlockId() ; … … 544 544 status = false ; 545 545 else { 546 status = (casa ::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ;546 status = (casacore::Bool)(sdmBin_->acceptMainRow( mainRow_[row_] )) ; 547 547 } 548 548 return status ; 549 549 } 550 550 551 casa ::Bool ASDMReader::setMainRow( casa::uInt configDescId, casa::uInt fieldId )551 casacore::Bool ASDMReader::setMainRow( casacore::uInt configDescId, casacore::uInt fieldId ) 552 552 { 553 553 clearMainRow() ; … … 558 558 if (rows == 0) 559 559 return false; 560 mainRow_ = casa ::Vector<MainRow *>( *rows ) ;560 mainRow_ = casacore::Vector<MainRow *>( *rows ) ; 561 561 562 562 return true ; … … 570 570 void ASDMReader::setupIFNO() 571 571 { 572 casa ::String funcName = "setupIFNO" ;572 casacore::String funcName = "setupIFNO" ; 573 573 574 574 vector<SpectralWindowRow *> spwrows = asdm_->getSpectralWindow().get() ; 575 575 unsigned int nrow = spwrows.size() ; 576 576 ifno_.clear() ; 577 casa ::uInt idx = 0 ;578 casa ::uInt wvridx = 0 ;577 casacore::uInt idx = 0 ; 578 casacore::uInt wvridx = 0 ; 579 579 for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) { 580 casa ::uInt index ;580 casacore::uInt index ; 581 581 if ( isWVR( spwrows[irow] ) ) { 582 582 //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+" is WVR",LogOrigin(className_,funcName,WHERE)) ) ; … … 586 586 index = ++idx ; 587 587 } 588 ifno_.insert( pair<Tag,casa ::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ;588 ifno_.insert( pair<Tag,casacore::uInt>(spwrows[irow]->getSpectralWindowId(),index) ) ; 589 589 //logsink_->postLocally( LogMessage(spwrows[irow]->getSpectralWindowId().toString()+": IFNO="+String::toString(index),LogOrigin(className_,funcName,WHERE)) ) ; 590 590 } … … 601 601 } 602 602 603 casa ::Bool ASDMReader::setData()604 { 605 casa ::String funcName = "setData" ;603 casacore::Bool ASDMReader::setData() 604 { 605 casacore::String funcName = "setData" ; 606 606 607 607 //logsink_->postLocally( LogMessage("try to retrieve binary data",LogOrigin(className_,funcName,WHERE)) ) ; … … 678 678 } 679 679 680 casa ::uInt ASDMReader::getIFNo( unsigned int idx )680 casacore::uInt ASDMReader::getIFNo( unsigned int idx ) 681 681 { 682 682 prepareData( idx ) ; … … 684 684 } 685 685 686 casa ::uInt ASDMReader::getIFNo()687 { 688 map<Tag,casa ::uInt>::iterator iter = ifno_.find( specWinTag_ ) ;686 casacore::uInt ASDMReader::getIFNo() 687 { 688 map<Tag,casacore::uInt>::iterator iter = ifno_.find( specWinTag_ ) ; 689 689 if ( iter != ifno_.end() ) 690 690 return iter->second ; … … 720 720 string &freqref ) 721 721 { 722 casa ::String funcName = "getFrequency" ;722 casacore::String funcName = "getFrequency" ; 723 723 724 724 int nchan = specWinRow_p->getNumChan() ; … … 737 737 } 738 738 else { 739 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;739 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 740 740 } 741 741 } … … 752 752 } 753 753 else { 754 throw (casa ::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;754 throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ; 755 755 } 756 756 if ( specWinRow_p->isChanFreqStepExists() ) { … … 764 764 } 765 765 else { 766 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;766 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ; 767 767 } 768 768 if ( specWinRow_p->isChanFreqStartExists() ) { … … 773 773 } 774 774 else { 775 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;775 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 776 776 } 777 777 } … … 788 788 } 789 789 else { 790 throw (casa ::AipsError( "Either chanWidthArray or chanWidth must exist." )) ;790 throw (casacore::AipsError( "Either chanWidthArray or chanWidth must exist." )) ; 791 791 } 792 792 if ( specWinRow_p->isChanFreqStepExists() ) { … … 800 800 } 801 801 else { 802 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ;802 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStep must exist." )) ; 803 803 } 804 804 if ( specWinRow_p->isChanFreqStartExists() ) { … … 810 810 } 811 811 else { 812 throw (casa ::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ;812 throw (casacore::AipsError( "Either chanFreqArray or chanFreqStart must exist." )) ; 813 813 } 814 814 } … … 1264 1264 for ( unsigned int irow = 0 ; irow < nrow ; irow++ ) { 1265 1265 CalAtmosphereRow *atmrow = atmrows[irow] ; 1266 if ( casa ::String(atmrow->getAntennaName()) != antennaName_1266 if ( casacore::String(atmrow->getAntennaName()) != antennaName_ 1267 1267 //|| atmrow->getReceiverBand() != rb 1268 1268 //|| atmrow->getBasebandName() != bbname … … 1310 1310 float &windaz ) 1311 1311 { 1312 casa ::String funcName = "getWeatherInfo" ;1312 casacore::String funcName = "getWeatherInfo" ; 1313 1313 1314 1314 temperature = 0.0 ; … … 1710 1710 1711 1711 vector<double> ASDMReader::toJ2000( vector<double> &dir, 1712 casa ::String &dirref,1712 casacore::String &dirref, 1713 1713 double &mjd ) 1714 1714 { 1715 casa ::String funcName = "toJ2000" ;1715 casacore::String funcName = "toJ2000" ; 1716 1716 1717 1717 vector<double> newd( dir ) ; 1718 1718 if ( dirref != "J2000" ) { 1719 me_ = casa ::MEpoch( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;1719 me_ = casacore::MEpoch( casacore::Quantity( (casacore::Double)mjd, "d" ), casacore::MEpoch::UTC ) ; 1720 1720 mf_.set( me_ ) ; 1721 casa ::MDirection::Types dirtype ;1722 casa ::Bool b = casa::MDirection::getType( dirtype, dirref ) ;1721 casacore::MDirection::Types dirtype ; 1722 casacore::Bool b = casacore::MDirection::getType( dirtype, dirref ) ; 1723 1723 if ( b ) { 1724 casa ::Vector<casa::Double> cdir = toj2000_( dir ).getAngle( "rad" ).getValue() ;1724 casacore::Vector<casacore::Double> cdir = toj2000_( dir ).getAngle( "rad" ).getValue() ; 1725 1725 //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ; 1726 1726 newd[0] = (double)(cdir[0]) ; … … 1738 1738 string ASDMReader::getFrame() 1739 1739 { 1740 casa ::String funcName = "getFrame" ;1740 casacore::String funcName = "getFrame" ; 1741 1741 1742 1742 // default is TOPO … … 1767 1767 int ASDMReader::getNumIFs() 1768 1768 { 1769 casa ::String funcName = "getNumIFs" ;1769 casacore::String funcName = "getNumIFs" ; 1770 1770 1771 1771 int nif = 0 ;
Note: See TracChangeset
for help on using the changeset viewer.