Changeset 2459 for branches/hpc33/python
- Timestamp:
- 04/09/12 18:49:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc33/python/asapgrid.py
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/python/asapgrid.py merged eligible /branches/alma/python/asapgrid.py 1386-1818 /branches/asap4casa3.1.0/python/asapgrid.py 1935-1936,1940
r2397 r2459 105 105 numerical value and unit, e.g. '0.5arcmin', or numerical value. 106 106 If those values are specified as numerical value, their units 107 will be assumed to 'arc min'. If which of those is not specified,107 will be assumed to 'arcsec'. If which of those is not specified, 108 108 it will be set to the same value as the other. If none of them 109 109 are specified, it will be determined from map extent and number … … 130 130 """ 131 131 if not isinstance( cellx, str ): 132 cellx = '%sarc min'%(cellx)132 cellx = '%sarcsec'%(cellx) 133 133 if not isinstance( celly, str ): 134 celly = '%sarc min'%(celly)134 celly = '%sarcsec'%(celly) 135 135 self.gridder._defineimage( nx, ny, cellx, celly, center ) 136 136 … … 145 145 'box': 1 pixel 146 146 'sf': 3 pixels 147 'gauss': 3 pixels(width is used as HWHM)147 'gauss': 1 pixel (width is used as HWHM) 148 148 149 149 func -- Function type ('box', 'sf', 'gauss'). … … 265 265 idx = 0 266 266 d0 = s.get_direction( 0 ).split()[-1] 267 while ( s.get_direction(self.npol*idx).split()[-1] == d0 ): 267 while ( s.get_direction(self.npol*idx) is not None \ 268 and s.get_direction(self.npol*idx).split()[-1] == d0 ): 268 269 idx += 1 269 270 … … 276 277 #print self.blc 277 278 #print self.trc 278 incrx = s.get_directionval( self.npol ) 279 incry = s.get_directionval( self.nx*self.npol ) 279 if nrow > 1: 280 incrx = s.get_directionval( self.npol ) 281 incry = s.get_directionval( self.nx*self.npol ) 282 else: 283 incrx = [0.0,0.0] 284 incry = [0.0,0.0] 280 285 self.cellx = abs( self.blc[0] - incrx[0] ) 281 286 self.celly = abs( self.blc[1] - incry[1] ) … … 287 292 else: 288 293 opt = 'pol %s'%(pol) 289 if chan < 0: 294 if type(chan) is list: 295 opt += ', averaged over channel %s-%s'%(chan[0],chan[1]) 296 elif chan < 0: 290 297 opt += ', averaged over channel' 291 298 else: 292 299 opt += ', channel %s'%(chan) 293 data = self.getData( chan, pol ) 300 data = self.getData( chan, pol ) 301 data = numpy.fliplr( data ) 294 302 title = 'Gridded Image (%s)'%(opt) 295 303 pl.figure(10) … … 319 327 #print irow 320 328 # show image 321 extent=[self. blc[0]-0.5*self.cellx,322 self. trc[0]+0.5*self.cellx,329 extent=[self.trc[0]+0.5*self.cellx, 330 self.blc[0]-0.5*self.cellx, 323 331 self.blc[1]-0.5*self.celly, 324 332 self.trc[1]+0.5*self.celly] 333 deccorr = 1.0/numpy.cos(0.5*(self.blc[1]+self.trc[1])) 325 334 pl.imshow(data,extent=extent,origin='lower',interpolation='nearest') 326 335 pl.colorbar() 327 336 pl.xlabel('R.A. [rad]') 328 337 pl.ylabel('Dec. [rad]') 338 ax = pl.axes() 339 ax.set_aspect(deccorr) 329 340 pl.title( title ) 330 341 … … 359 370 360 371 def getData( self, chan=-1, pol=-1 ): 361 if chan == -1: 372 if type(chan) == list: 373 spectra = self.__chanAverage(start=chan[0],end=chan[1]) 374 elif chan == -1: 362 375 spectra = self.__chanAverage() 363 376 else: … … 370 383 return retval 371 384 372 def __chanAverage( self ):385 def __chanAverage( self, start=-1, end=-1 ): 373 386 s = scantable( self.outfile, average=False ) 374 387 nrow = s.nrow() … … 376 389 irow = 0 377 390 sp = [0 for i in xrange(self.nchan)] 391 if start < 0: 392 start = 0 393 if end < 0: 394 end = self.nchan 378 395 for i in xrange(nrow/self.npol): 379 396 for ip in xrange(self.npol): 380 sp = s._getspectrum( irow ) 397 sp = s._getspectrum( irow )[start:end] 381 398 spectra[ip,i] = numpy.mean( sp ) 382 399 irow += 1 400 383 401 return spectra 384 402 -
Property svn:mergeinfo
set to (toggle deleted branches)
Note:
See TracChangeset
for help on using the changeset viewer.