Changeset 1517 for branches/alma
- Timestamp:
- 02/24/09 14:22:57 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/python/scantable.py
r1515 r1517 341 341 Takes a 'mask' as an optional parameter to specify which 342 342 channels should be excluded. 343 You can get min/max values with their position344 (channels/frequencies/velocities) by selecting stat='minpos'345 or 'max pos'.346 Parameters: 347 stat: 'min', 'max', 'min pos', 'maxpos', 'sumsq', 'sum',343 You can get min/max values with their 344 channels/frequencies/velocities by selecting stat='min_abc' 345 or 'max_abc'. 346 Parameters: 347 stat: 'min', 'max', 'min_abc', 'max_abc', 'sumsq', 'sum', 348 348 'mean', 'var', 'stddev', 'avdev', 'rms', 'median' 349 349 mask: an optional mask specifying where the statistic … … 362 362 "to select individual IFs") 363 363 364 if stat.lower().find(' pos') == -1:364 if stat.lower().find('_abc') == -1: 365 365 statvals = self._math._stats(self, mask, stat) 366 position = False366 getchan = False 367 367 sstat = str(stat) 368 368 else: 369 pos = self._math._minmaxpos(self, mask, stat)370 position = True369 chan = self._math._minmaxchan(self, mask, stat) 370 getchan = True 371 371 statvals = [] 372 sstat = stat.lower().strip(' pos')372 sstat = stat.lower().strip('_abc') 373 373 out = '' 374 374 axes = [] … … 384 384 src = self._getsourcename(i) 385 385 xpos = '' 386 if position:387 qx, y = self.pos2data(rowno=i, pos=pos[i])388 statvals.append( y)386 if getchan: 387 qx, qy = self.chan2data(rowno=i, chan=chan[i]) 388 statvals.append(qy['value']) 389 389 xpos = '(x = %3.3f' % (qx['value'])+' ['+qx['unit']+'])' 390 390 out += 'Scan[%d] (%s) ' % (axis[0], src) … … 407 407 return statvals 408 408 409 def pos2data(self, rowno=0, pos=0):410 """ 411 Returns the abcissa and ordinate value of a spectrum409 def chan2data(self, rowno=0, chan=0): 410 """ 411 Returns channel/frequency/velocity and spectral value 412 412 at an arbitrary row and channel in the scantable. 413 413 Parameters: 414 414 rowno: a row number in the scantable. Default is the 415 415 first row, i.e. rowno=0 416 pos:a channel in the scantable. Default is the first416 chan: a channel in the scantable. Default is the first 417 417 channel, i.e. pos=0 418 418 """ 419 if isinstance(rowno, int) and isinstance( pos, int):419 if isinstance(rowno, int) and isinstance(chan, int): 420 420 x, xlbl = self.get_abcissa(rowno) 421 qx = {'unit': xlbl, 'value': x[pos]} 422 return qx, self._getspectrum(rowno)[pos] 421 qx = {'unit': xlbl, 'value': x[chan]} 422 qy = {'unit': self.get_fluxunit(), 423 'value': self._getspectrum(rowno)[chan]} 424 return qx, qy 423 425 424 426 def stddev(self, mask=None):
Note:
See TracChangeset
for help on using the changeset viewer.