Changeset 2755 for trunk/external-alma


Ignore:
Timestamp:
01/31/13 16:39:48 (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...

Speed up asdm2ASAP by reusing MDirection::Convert object.


Location:
trunk/external-alma/asdm2ASAP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/asdm2ASAP/ASDMReader.cc

    r2705 r2755  
    4848  corrMode_.reset() ;
    4949  timeSampling_.reset() ;
     50  initConvert() ;
    5051}
    5152
     
    224225  for ( casa::uInt i = 0 ; i < 3 ; i++ )
    225226    antennaPosition_[i] = Quantity( casa::Double( antpos[i].get() ), Unit( "m" ) ) ;
     227  mp_ = casa::MPosition( casa::MVPosition( antennaPosition_ ),
     228                         casa::MPosition::ITRF ) ;
     229  mf_.set( mp_ ) ;
    226230
    227231  // create SDMBinData object
     
    887891        String ref( CDirectionReferenceCode::toString( dircode ) ) ;
    888892        double mjd = vmsData_->v_time[dataIndex_] * s2d ;
    889         srcdir = toJ2000( srcdir, ref, mjd, antennaPosition_ ) ;
     893        srcdir = toJ2000( srcdir, ref, mjd ) ;
    890894      }
    891895    }
     
    16701674    }
    16711675   
    1672     toJ2000( dir, az, el, tcen, antennaPosition_ ) ;
     1676    toJ2000( dir, az, el, tcen ) ;
    16731677  }
    16741678
     
    16941698                          double &az,
    16951699                          double &el,
    1696                           double &mjd,
    1697                           casa::Vector<casa::Quantity> &antpos )
    1698 //                          casa::Vector<casa::Double> antpos )
     1700                          double &mjd )
    16991701{
    17001702  String funcName = "toJ2000" ;
     
    17041706  azel[0] = az ;
    17051707  azel[1] = el ;
    1706   dir = toJ2000( azel, ref, mjd, antpos ) ;
     1708  dir = toJ2000( azel, ref, mjd ) ;
    17071709}
    17081710
    17091711vector<double> ASDMReader::toJ2000( vector<double> &dir,
    17101712                                    casa::String &dirref,
    1711                                     double &mjd,
    1712                                     casa::Vector<casa::Quantity> &antpos )
    1713 //                                    casa::Vector<casa::Double> antpos )
     1713                                    double &mjd )
    17141714{
    17151715  casa::String funcName = "toJ2000" ;
     
    17171717  vector<double> newd( dir ) ;
    17181718  if ( dirref != "J2000" ) {
    1719     casa::MEpoch me( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
    1720     casa::MPosition mp( casa::MVPosition( antpos ),
    1721                         casa::MPosition::ITRF ) ;
    1722     //ostringstream oss ;
    1723     //mp.print( oss ) ;
    1724     //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
    1725    
    1726     casa::MeasFrame mf( me, mp ) ;
     1719    me_ = casa::MEpoch( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
     1720    mf_.set( me_ ) ;
    17271721    casa::MDirection::Types dirtype ;
    17281722    casa::Bool b = casa::MDirection::getType( dirtype, dirref ) ;
    17291723    if ( b ) {
    1730       casa::MDirection::Convert toj2000( dirtype,
    1731                                          casa::MDirection::Ref( casa::MDirection::J2000, mf ) ) ;
    1732       casa::Vector<casa::Double> cdir = toj2000( dir ).getAngle( "rad" ).getValue() ;
     1724      casa::Vector<casa::Double> cdir = toj2000_( dir ).getAngle( "rad" ).getValue() ;
    17331725      //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ;
    17341726      newd[0] = (double)(cdir[0]) ;
     
    18961888  return dir ;
    18971889}
     1890
     1891void ASDMReader::initConvert()
     1892{
     1893  toj2000_ = MDirection::Convert(MDirection::AZELGEO,
     1894                                 MDirection::Ref(MDirection::J2000, mf_));
     1895}
  • trunk/external-alma/asdm2ASAP/ASDMReader.h

    r2301 r2755  
    1010#include <ASDMAll.h>
    1111#include <SDMBinData.h>
     12
     13class casa::MDirection;
     14class casa::MeasFrame;
     15class casa::MPosition;
     16class casa::MEpoch;
    1217
    1318class ASDMReader
     
    489494                double &az,
    490495                double &el,
    491                 double &mjd,
    492                 casa::Vector<casa::Quantity> &antpos ) ;
    493 
     496                double &mjd ) ;
    494497  /**
    495498  * to J2000
     
    503506  std::vector<double> toJ2000( std::vector<double> &dir,
    504507                               casa::String &dirref,
    505                                double &mjd,
    506                                casa::Vector<casa::Quantity> &antpos ) ;
     508                               double &mjd ) ;
     509
    507510  /**
    508511   * get nIF
     
    537540   **/
    538541  std::vector< std::vector<double> > pointingDir( asdm::PointingRow *row ) ;
     542
     543  /**
     544   * initialize conversion engine
     545   **/
     546  void initConvert() ;
    539547
    540548  asdm::ASDM *asdm_ ; // pointer to ASDM object
     
    606614  // time
    607615  asdm::ArrayTimeInterval timeInterval_ ;
     616
     617  casa::MDirection::Convert toj2000_ ;
     618  casa::MeasFrame mf_ ;
     619  casa::MPosition mp_ ;
     620  casa::MEpoch me_ ;
    608621} ;
    609622#endif // ASAP_ASDM_READER_H
Note: See TracChangeset for help on using the changeset viewer.