Changeset 2669
- Timestamp:
- 10/17/12 17:20:35 (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapgrid.py
r2594 r2669 448 448 #print 'nrow=',nrow 449 449 450 idx = 0 451 d0 = s.get_direction( 0 ).split()[-1] 452 while ( s.get_direction(self.npol*idx) is not None \ 453 and s.get_direction(self.npol*idx).split()[-1] == d0 ): 450 idx = 1 451 d0 = s.get_direction( 0 ).split()[-2] 452 d = s.get_direction(self.npol*idx) 453 while( d is not None \ 454 and d.split()[-2] != d0): 454 455 idx += 1 456 d = s.get_direction(self.npol*idx) 455 457 456 458 self.nx = idx … … 484 486 opt += ', channel %s'%(chan) 485 487 data = self.getData( chan, pol ) 486 data = numpy.fliplr( data )488 #data = numpy.fliplr( data ) 487 489 title = 'Gridded Image (%s)'%(opt) 488 490 pl.figure(10) … … 530 532 if self.ifno < 0: 531 533 ifno = self.tablein.getif(0) 532 print 'ifno=',ifno534 #print 'ifno=',ifno 533 535 else: 534 536 ifno = self.ifno -
trunk/src/STGrid.cpp
r2638 r2669 1143 1143 } 1144 1144 cellx_ = qcellx.getValue( "rad" ) ; 1145 // DEC correction1146 cellx_ /= cos( center_[1] ) ;1147 1145 celly_ = qcelly.getValue( "rad" ) ; 1148 1146 //os << "cellx_=" << cellx_ << ", celly_=" << celly_ << ", cos("<<center_(1)<<")=" << cos(center_(1)) << LogIO::POST ; … … 1156 1154 wy = 0.00290888 ; 1157 1155 } 1158 nx_ = Int( ceil( wx/ cellx_) ) ;1156 nx_ = Int( ceil( wx/(cellx_/cos(center_[1])) ) ) ; 1159 1157 ny_ = Int( ceil( wy/celly_ ) ) ; 1160 1158 } 1159 1160 // create DirectionCoordinate 1161 Matrix<Double> xform(2,2) ; 1162 xform = 0.0 ; 1163 xform.diagonal() = 1.0 ; 1164 dircoord_ = new DirectionCoordinate(MDirection::J2000, 1165 Projection( Projection::SIN ), 1166 center_[0], center_[1], 1167 -cellx_, celly_, 1168 xform, 1169 0.5*Double(nx_-1), 1170 0.5*Double(ny_-1)) ; 1161 1171 } 1162 1172 … … 1528 1538 void STGrid::toPixel( Array<Double> &world, Array<Double> &pixel ) 1529 1539 { 1530 // using DirectionCoordinate1531 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) ) ;1541 1540 uInt nrow = world.shape()[1] ; 1542 1541 Bool bw, bp ; … … 1550 1549 _world.takeStorage( vshape, ww_p, SHARE ) ; 1551 1550 _pixel.takeStorage( vshape, wp_p, SHARE ) ; 1552 coord.toPixel( _pixel, _world ) ;1551 dircoord_->toPixel( _pixel, _world ) ; 1553 1552 ww_p += 2 ; 1554 1553 wp_p += 2 ; … … 1690 1689 cpix(1) = Double( ny_ - 1 ) * 0.5 ; 1691 1690 Vector<Double> dir( 2 ) ; 1691 Vector<Double> pix( 2 ); 1692 1692 ArrayColumn<Double> directionCol( tab, "DIRECTION" ) ; 1693 1693 ArrayColumn<Float> spectraCol( tab, "SPECTRA" ) ; … … 1704 1704 uInt scanno = 0 ; 1705 1705 for ( Int iy = 0 ; iy < ny_ ; iy++ ) { 1706 dir(1) = center_(1) - ( cpix(1) - (Double)iy ) * celly_;1706 pix(1) = (Double)(iy); 1707 1707 for ( Int ix = 0 ; ix < nx_ ; ix++ ) { 1708 dir(0) = center_(0) - ( cpix(0) - (Double)ix ) * cellx_ ; 1708 pix(0) = (Double)(nx_-1-ix); 1709 dircoord_->toWorld(dir,pix); 1710 //os << "dir[" << ix << "," << iy << "]=" << dir << LogIO::POST; 1709 1711 for ( Int ipol = 0 ; ipol < npol_ ; ipol++ ) { 1710 offset = ix + iy * nx_ + ipol * nx_ * ny_;1712 offset = ix + nx_ * (iy + ipol * ny_) ; 1711 1713 //os << "offset = " << offset << LogIO::POST ; 1712 1714 sp_p = sp.getStorage( bsp ) ; -
trunk/src/STGrid.h
r2638 r2669 22 22 #include <casa/Arrays/Vector.h> 23 23 #include <casa/Containers/RecordField.h> 24 #include <casa/Utilities/CountedPtr.h> 24 25 25 26 #include <tables/Tables/Table.h> 26 27 #include <tables/Tables/ScalarColumn.h> 27 28 #include <tables/Tables/ArrayColumn.h> 29 30 #include <coordinates/Coordinates/DirectionCoordinate.h> 28 31 29 32 #include "ScantableWrapper.h" … … 236 239 Vector<uInt> rows_ ; 237 240 Int nchunk_ ; 241 CountedPtr<DirectionCoordinate> dircoord_; 238 242 239 243 /////////////// gridPerRow variable
Note:
See TracChangeset
for help on using the changeset viewer.