Changeset 2638
- Timestamp:
- 08/09/12 12:40:16 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2636 r2638 17 17 #include <casa/Utilities/CountedPtr.h> 18 18 #include <casa/Logging/LogIO.h> 19 20 #include <coordinates/Coordinates/DirectionCoordinate.h> 19 21 20 22 #include <tables/Tables/Table.h> … … 1084 1086 // os << "xmin=" << xmin << LogIO::POST ; 1085 1087 // os << "center_=" << center_ << LogIO::POST ; 1086 decCorr_ = 1.0 / cos( center_[1] ) ;1087 1088 1088 1089 nx_ = nx ; … … 1143 1144 cellx_ = qcellx.getValue( "rad" ) ; 1144 1145 // DEC correction 1145 cellx_ *= decCorr_;1146 cellx_ /= cos( center_[1] ) ; 1146 1147 celly_ = qcelly.getValue( "rad" ) ; 1147 1148 //os << "cellx_=" << cellx_ << ", celly_=" << celly_ << ", cos("<<center_(1)<<")=" << cos(center_(1)) << LogIO::POST ; … … 1527 1528 void STGrid::toPixel( Array<Double> &world, Array<Double> &pixel ) 1528 1529 { 1529 // gridding will be done on (nx_+2*convSupport_) x (ny_+2*convSupport_) 1530 // grid plane to avoid unexpected behavior on grid edge 1531 Block<Double> pixc( 2 ) ; 1532 pixc[0] = Double( nx_-1 ) * 0.5 ; 1533 pixc[1] = Double( ny_-1 ) * 0.5 ; 1534 // pixc[0] = Double( nx_+2*convSupport_-1 ) * 0.5 ; 1535 // pixc[1] = Double( ny_+2*convSupport_-1 ) * 0.5 ; 1530 // using DirectionCoordinate 1531 Matrix<Double> xform(2,2) ; 1532 xform = 0.0 ; 1533 xform.diagonal() = 1.0 ; 1534 DirectionCoordinate coord( MDirection::J2000, 1535 Projection( Projection::SIN ), 1536 center_[0], center_[1], 1537 cellx_, celly_, 1538 xform, 1539 0.5*Double(nx_-1), 1540 0.5*Double(ny_-1) ) ; 1536 1541 uInt nrow = world.shape()[1] ; 1537 1542 Bool bw, bp ; 1538 constDouble *w_p = world.getStorage( bw ) ;1543 Double *w_p = world.getStorage( bw ) ; 1539 1544 Double *p_p = pixel.getStorage( bp ) ; 1540 constDouble *ww_p = w_p ;1545 Double *ww_p = w_p ; 1541 1546 Double *wp_p = p_p ; 1547 IPosition vshape( 1, 2 ) ; 1548 Vector<Double> _world, _pixel ; 1542 1549 for ( uInt i = 0 ; i < nrow ; i++ ) { 1543 *wp_p = pixc[0] + ( *ww_p - center_[0] ) / cellx_ ; 1544 wp_p++ ; 1545 ww_p++ ; 1546 *wp_p = pixc[1] + ( *ww_p - center_[1] ) / celly_ ; 1547 wp_p++ ; 1548 ww_p++ ; 1549 } 1550 world.freeStorage( w_p, bw ) ; 1551 pixel.putStorage( p_p, bp ) ; 1550 _world.takeStorage( vshape, ww_p, SHARE ) ; 1551 _pixel.takeStorage( vshape, wp_p, SHARE ) ; 1552 coord.toPixel( _pixel, _world ) ; 1553 ww_p += 2 ; 1554 wp_p += 2 ; 1555 } 1556 world.putStorage( w_p, bw ) ; 1557 pixel.putStorage( p_p, bp ) ; 1552 1558 } 1553 1559 -
trunk/src/STGrid.h
r2631 r2638 226 226 Double celly_ ; 227 227 Vector<Double> center_ ; 228 Double decCorr_ ;229 228 String convType_ ; 230 229 Int convSupport_ ;
Note:
See TracChangeset
for help on using the changeset viewer.