Changeset 2686
- Timestamp:
- 11/15/12 23:28:32 (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapgrid.py
r2680 r2686 306 306 storg = rcParams['scantable.storage'] 307 307 rcParams['scantable.storage'] = 'disk' 308 plotter = _SDGridPlotter( self.infile, self.outfile, self.ifno ) 308 [nx,ny] = self.gridder._get_resultant_map_size() 309 [cellx,celly] = self.gridder._get_resultant_cell_size() 310 plotter = _SDGridPlotter( self.infile, self.outfile, self.ifno, 311 nx=nx, ny=ny, cellx=cellx, celly=celly ) 309 312 plotter.plot( chan=plotchan, pol=plotpol, plotobs=plotobs, plotgrid=plotgrid ) 310 313 # back to original setup … … 376 379 377 380 class _SDGridPlotter: 378 def __init__( self, infile, outfile=None, ifno=-1 ):381 def __init__( self, infile, outfile=None, ifno=-1, nx=-1, ny=-1, cellx=0.0, celly=0.0 ): 379 382 if isinstance( infile, str ): 380 383 self.infile = [infile] … … 384 387 if self.outfile is None: 385 388 self.outfile = self.infile[0].rstrip('/')+'.grid' 386 self.nx = -1387 self.ny = -1389 self.nx = nx 390 self.ny = ny if ny > 0 else nx 388 391 self.nchan = 0 389 392 self.npol = 0 390 393 self.pollist = [] 391 self.cellx = 0.0392 self.celly = 0.0394 self.cellx = cellx 395 self.celly = celly if celly > 0.0 else cellx 393 396 self.center = [0.0,0.0] 394 397 self.nonzero = [[0.0],[0.0]] … … 414 417 #print 'nrow=',nrow 415 418 416 idx = 1 417 d0 = s.get_direction( 0 ).split()[-2] 418 d = s.get_direction(self.npol*idx) 419 while( d is not None \ 420 and d.split()[-2] != d0): 421 idx += 1 419 if self.nx <= 0 or self.ny <= 0: 420 idx = 1 421 d0 = s.get_direction( 0 ).split()[-2] 422 422 d = s.get_direction(self.npol*idx) 423 while( d is not None \ 424 and d.split()[-2] != d0): 425 idx += 1 426 d = s.get_direction(self.npol*idx) 423 427 424 self.nx = idx425 self.ny = nrow / (self.npol * idx )426 #print 'nx,ny=',self.nx,self.ny428 self.nx = idx 429 self.ny = nrow / (self.npol * idx ) 430 #print 'nx,ny=',self.nx,self.ny 427 431 428 432 self.blc = s.get_directionval( 0 ) … … 430 434 #print self.blc 431 435 #print self.trc 432 if nrow > 1: 433 incrx = s.get_directionval( self.npol ) 434 incry = s.get_directionval( self.nx*self.npol ) 435 else: 436 incrx = [0.0,0.0] 437 incry = [0.0,0.0] 438 self.cellx = abs( self.blc[0] - incrx[0] ) 439 self.celly = abs( self.blc[1] - incry[1] ) 440 #print 'cellx,celly=',self.cellx,self.celly 436 437 if self.cellx <= 0.0 or self.celly <= 0.0: 438 if nrow > 1: 439 incrx = s.get_directionval( self.npol ) 440 incry = s.get_directionval( self.nx*self.npol ) 441 else: 442 incrx = [0.0,0.0] 443 incry = [0.0,0.0] 444 self.cellx = abs( self.blc[0] - incrx[0] ) 445 self.celly = abs( self.blc[1] - incry[1] ) 446 #print 'cellx,celly=',self.cellx,self.celly 441 447 442 448 def plot( self, chan=-1, pol=-1, plotobs=False, plotgrid=False ): -
trunk/src/STGrid.cpp
r2684 r2686 2084 2084 } 2085 2085 2086 vector<int> STGrid::getResultantMapSize() 2087 { 2088 vector<int> r(2); 2089 r[0] = nx_; 2090 r[1] = ny_; 2091 return r; 2092 } 2093 2094 vector<double> STGrid::getResultantCellSize() 2095 { 2096 vector<double> r(2); 2097 r[0] = cellx_; 2098 r[1] = celly_; 2099 return r; 2100 } 2101 2086 2102 // STGrid2 2087 2103 STGrid2::STGrid2() -
trunk/src/STGrid.h
r2671 r2686 77 77 // support function to know how grid function looks like 78 78 vector<float> getConvFunc(); 79 80 // for plotting 81 vector<int> getResultantMapSize(); 82 vector<double> getResultantCellSize(); 79 83 80 84 //private: -
trunk/src/python_STGrid.cpp
r2671 r2686 43 43 .def("_save", &STGrid::saveData) 44 44 .def("_getfunc", &STGrid::getConvFunc) 45 .def("_get_resultant_map_size", &STGrid::getResultantMapSize) 46 .def("_get_resultant_cell_size", &STGrid::getResultantCellSize) 45 47 ; 46 48
Note:
See TracChangeset
for help on using the changeset viewer.