Changeset 2252 for trunk/external-alma


Ignore:
Timestamp:
07/28/11 16:20:38 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1913

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...

Rnage of SRCDIRECTION (in rad) is limited between -pi and pi.

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

Legend:

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

    r2251 r2252  
    99#include <measures/Measures/MeasConvert.h>
    1010#include <casa/Logging/LogMessage.h>
     11#include <casa/BasicSL/Constants.h>
    1112
    1213#include "ASDMReader.h"
     
    10111012    SourceRow *srow = asdm_->getSource().getRowByKey( sid, tint, spwtag ) ;
    10121013    vector<Angle> srcdir = srow->getDirection() ;
     1014    dir[0] = limitedAngle( srcdir[0].get() ) ;
     1015    dir[1] = limitedAngle( srcdir[1].get() ) ;
    10131016    if ( srow->isDirectionCodeExists() ) {
    10141017      DirectionReferenceCode dircode = srow->getDirectionCode() ;
     1018      //logsink_->postLocally( LogMessage("dircode="+CDirectionReferenceCode::toString(dircode),LogOrigin(className_,funcName,WHERE)) ) ;
    10151019      if ( dircode != J2000 ) {
    10161020        // if not J2000, need direction conversion
    1017       }
    1018     }
    1019     dir[0] = srcdir[0].get() ;
    1020     dir[1] = srcdir[1].get() ;
     1021        string ref = CDirectionReferenceCode::toString( dircode ) ;
     1022        double mjd = vmsData_->v_time[index] * s2d ;
     1023        Tag atag( antennaId_, TagType::Antenna ) ;
     1024        AntennaRow *arow = asdm_->getAntenna().getRowByKey( atag ) ;
     1025        StationRow *srow = arow->getStationUsingStationId() ;
     1026        vector<Length> antposL = srow->getPosition() ;
     1027        casa::Vector<casa::Double> antpos( 3 ) ;
     1028        for ( int i = 0 ; i < 3 ; i++ )
     1029          antpos[i] = antposL[i].get() ;
     1030        dir = toJ2000( dir, ref, mjd, antpos ) ;
     1031      }
     1032    }
    10211033  }
    10221034  return dir ;
     
    10481060      ref = CDirectionReferenceCode::toString( srow->getDirectionCode() ) ;
    10491061    }
    1050     dir[0] = srcdir[0].get() ;
    1051     dir[1] = srcdir[1].get() ;
     1062    dir[0] = limitedAngle( srcdir[0].get() ) ;
     1063    dir[1] = limitedAngle( srcdir[1].get() ) ;
    10521064  }
    10531065}
     
    17391751  String funcName = "toJ2000" ;
    17401752
    1741 //   casa::Vector<casa::Double> azel( 2 ) ;
    1742 //   azel[0] = az ;
    1743 //   azel[1] = el ;
    1744 //   casa::MEpoch me( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
    1745 //   casa::Vector<casa::Quantity> qantpos( 3 ) ;
    1746 //   qantpos[0] = casa::Quantity( antpos[0], "m" ) ;
    1747 //   qantpos[1] = casa::Quantity( antpos[1], "m" ) ;
    1748 //   qantpos[2] = casa::Quantity( antpos[2], "m" ) ;
    1749 //   casa::MPosition mp( casa::MVPosition( qantpos ),
    1750 //                       casa::MPosition::ITRF ) ;
    1751 //   //ostringstream oss ;
    1752 //   //mp.print( oss ) ;
    1753 //   //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
    1754 
    1755 //   casa::MeasFrame mf( me, mp ) ;
    1756 //   casa::MDirection::Convert toj2000( casa::MDirection::AZELGEO,
    1757 //                                      casa::MDirection::Ref( casa::MDirection::J2000, mf ) ) ;
    1758 //   casa::Vector<casa::Double> cdir = toj2000( azel ).getAngle( "rad" ).getValue() ;
    1759 //   //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ;
    1760 //   dir.resize(2) ;
    1761 //   dir[0] = (double)(cdir[0]) ;
    1762 //   dir[1] = (double)(cdir[1]) ;
    17631753  vector<double> azel( 2 ) ;
    17641754  azel[0] = az ;
     
    19241914  return row ;
    19251915}
     1916
     1917double ASDMReader::limitedAngle( double angle )
     1918{
     1919  if ( angle > C::pi )
     1920    while ( angle > C::pi ) angle -= C::_2pi ;
     1921  else if ( angle < -C::pi )
     1922    while ( angle < -C::pi ) angle += C::_2pi ;
     1923  return angle ;
     1924}
  • trunk/external-alma/asdm2ASAP/ASDMReader.h

    r2251 r2252  
    548548   **/
    549549  asdm::SysCalRow *getSysCalRow( unsigned int idx ) ;
     550
     551  /**
     552   * limit angule in radian within [-pi,pi]
     553   *
     554   * @param any angule in radian
     555   * @return equivalent angle that satisfies [-pi,pi]
     556   **/
     557  double limitedAngle( double angle ) ;
    550558
    551559  asdm::ASDM *asdm_ ; // pointer to ASDM object
Note: See TracChangeset for help on using the changeset viewer.