Changeset 1515
- Timestamp:
- 02/23/09 21:39:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/python/scantable.py
r1496 r1515 341 341 Takes a 'mask' as an optional parameter to specify which 342 342 channels should be excluded. 343 Parameters: 344 stat: 'min', 'max', 'sumsq', 'sum', 'mean' 345 'var', 'stddev', 'avdev', 'rms', 'median' 343 You can get min/max values with their position 344 (channels/frequencies/velocities) by selecting stat='minpos' 345 or 'maxpos'. 346 Parameters: 347 stat: 'min', 'max', 'minpos', 'maxpos', 'sumsq', 'sum', 348 'mean', 'var', 'stddev', 'avdev', 'rms', 'median' 346 349 mask: an optional mask specifying where the statistic 347 350 should be determined. … … 359 362 "to select individual IFs") 360 363 361 statvals = self._math._stats(self, mask, stat) 364 if stat.lower().find('pos') == -1: 365 statvals = self._math._stats(self, mask, stat) 366 position = False 367 sstat = str(stat) 368 else: 369 pos = self._math._minmaxpos(self, mask, stat) 370 position = True 371 statvals = [] 372 sstat = stat.lower().strip('pos') 362 373 out = '' 363 374 axes = [] … … 372 383 tm = self._gettime(i) 373 384 src = self._getsourcename(i) 385 xpos = '' 386 if position: 387 qx, y = self.pos2data(rowno=i, pos=pos[i]) 388 statvals.append(y) 389 xpos = '(x = %3.3f' % (qx['value'])+' ['+qx['unit']+'])' 374 390 out += 'Scan[%d] (%s) ' % (axis[0], src) 375 391 out += 'Time[%s]:\n' % (tm) … … 377 393 if self.nif(-1) > 1: out += ' IF[%d] ' % (axis[2]) 378 394 if self.npol(-1) > 1: out += ' Pol[%d] ' % (axis[3]) 379 out += '= %3.3f \n' % (statvals[i])395 out += '= %3.3f ' % (statvals[i]) +xpos+'\n' 380 396 out += "--------------------------------------------------\n" 381 397 382 398 if rcParams['verbose']: 383 399 print "--------------------------------------------------" 384 print " ", s tat400 print " ", sstat 385 401 print "--------------------------------------------------" 386 402 print out … … 390 406 # 'data': statvals} 391 407 return statvals 408 409 def pos2data(self, rowno=0, pos=0): 410 """ 411 Returns the abcissa and ordinate value of a spectrum 412 at an arbitrary row and channel in the scantable. 413 Parameters: 414 rowno: a row number in the scantable. Default is the 415 first row, i.e. rowno=0 416 pos: a channel in the scantable. Default is the first 417 channel, i.e. pos=0 418 """ 419 if isinstance(rowno, int) and isinstance(pos, int): 420 x, xlbl = self.get_abcissa(rowno) 421 qx = {'unit': xlbl, 'value': x[pos]} 422 return qx, self._getspectrum(rowno)[pos] 392 423 393 424 def stddev(self, mask=None):
Note:
See TracChangeset
for help on using the changeset viewer.