Changeset 2461


Ignore:
Timestamp:
04/11/12 12:32:41 (13 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: sdgrid unit test

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Fixed a bug which is caused by the fact that R.A. can be shifted by 2*pi
when it is represented in radian. Center coordinate is shifted by 2*pi
or -2*pi to match DIRECTION value if it is too far from observed position.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.cpp

    r2454 r2461  
    10581058    center_(0) = xcen.getValue( "rad" ) ;
    10591059    center_(1) = ycen.getValue( "rad" ) ;
    1060   }
     1060    double base = 0.5 * (xmin + xmax) ;
     1061    int maxrotate = 1 ;
     1062    int nelem = 2 * maxrotate + 1 ;
     1063    double *sep = new double[nelem] ;
     1064    for ( int i = 0 ; i < nelem ; i++ )
     1065      sep[i] = abs(base - center_[0] - (i-maxrotate) * C::_2pi) ;
     1066//     os << "sep[0]=" << sep[0] << endl 
     1067//        << "sep[1]=" << sep[1] << endl
     1068//        << "sep[2]=" << sep[2] << LogIO::POST ;
     1069    int idx = 0 ;
     1070    base = sep[0] ;
     1071    int nrotate = 0 ;
     1072    while ( idx < nelem ) {
     1073      if ( base > sep[idx] ) {
     1074        base = sep[idx] ;
     1075        nrotate = idx ;
     1076      }
     1077      idx++ ;
     1078    }
     1079    delete sep ;
     1080    nrotate -= maxrotate ;
     1081//     os << "nrotate = " << nrotate << LogIO::POST ;
     1082    center_[0] += nrotate * C::_2pi ;
     1083  }
     1084//   os << "xmin=" << xmin << LogIO::POST ;
     1085//   os << "center_=" << center_ << LogIO::POST ;
    10611086
    10621087
Note: See TracChangeset for help on using the changeset viewer.