- Timestamp:
- 07/02/09 13:56:26 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1589 r1590 358 358 if mask == None: 359 359 mask = [] 360 axes = ['Beam', 'IF', 'Pol', 'Time']361 360 if not self._check_ifs(): 362 361 raise ValueError("Cannot apply mask as the IFs have different " … … 365 364 366 365 statvals = self._math._stats(self, mask, stat) 367 out = '' 368 axes = [] 369 for i in range(self.nrow()): 370 axis = [] 371 axis.append(self.getscan(i)) 372 axis.append(self.getbeam(i)) 373 axis.append(self.getif(i)) 374 axis.append(self.getpol(i)) 375 axis.append(self.getcycle(i)) 376 axes.append(axis) 377 tm = self._gettime(i) 378 src = self._getsourcename(i) 379 out += 'Scan[%d] (%s) ' % (axis[0], src) 380 out += 'Time[%s]:\n' % (tm) 381 if self.nbeam(-1) > 1: out += ' Beam[%d] ' % (axis[1]) 382 if self.nif(-1) > 1: out += ' IF[%d] ' % (axis[2]) 383 if self.npol(-1) > 1: out += ' Pol[%d] ' % (axis[3]) 384 out += '= %3.3f\n' % (statvals[i]) 385 out += "--------------------------------------------------\n" 386 387 if rcParams['verbose']: 388 print "--------------------------------------------------" 389 print " ", stat 390 print "--------------------------------------------------" 391 print out 392 #else: 393 #retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'], 394 # 'axes' : axes, 395 # 'data': statvals} 396 return statvals 366 def cb(i): 367 return statvals[i] 368 369 return self._row_callback(cb, stat) 397 370 398 371 def stddev(self, mask=None): … … 429 402 430 403 def _row_callback(self, callback, label): 431 axes = []432 axesnames = ['scanno', 'beamno', 'ifno', 'polno', 'cycleno']433 404 out = "" 434 405 outvec = [] 406 sep = '-'*50 435 407 for i in range(self.nrow()): 436 axis = []437 axis.append(self.getscan(i))438 axis.append(self.getbeam(i))439 axis.append(self.getif(i))440 axis.append(self.getpol(i))441 axis.append(self.getcycle(i))442 axes.append(axis)443 408 tm = self._gettime(i) 444 409 src = self._getsourcename(i) 445 out += 'Scan[%d] (%s) ' % ( axis[0], src)410 out += 'Scan[%d] (%s) ' % (self.getscan(i), src) 446 411 out += 'Time[%s]:\n' % (tm) 447 if self.nbeam(-1) > 1: out += ' Beam[%d] ' % (axis[1]) 448 if self.nif(-1) > 1: out += ' IF[%d] ' % (axis[2]) 449 if self.npol(-1) > 1: out += ' Pol[%d] ' % (axis[3]) 412 if self.nbeam(-1) > 1: 413 out += ' Beam[%d] ' % (self.getbeam(i)) 414 if self.nif(-1) > 1: out += ' IF[%d] ' % (self.getif(i)) 415 if self.npol(-1) > 1: out += ' Pol[%d] ' % (self.getpol(i)) 450 416 outvec.append(callback(i)) 451 417 out += '= %3.3f\n' % (outvec[i]) 452 out += "--------------------------------------------------\n"418 out += sep+'\n' 453 419 if rcParams['verbose']: 454 print "--------------------------------------------------"420 print sep 455 421 print " %s" % (label) 456 print "--------------------------------------------------"422 print sep 457 423 print out 458 # disabled because the vector seems more useful459 #retval = {'axesnames': axesnames, 'axes': axes, 'data': outvec}460 424 return outvec 461 425
Note:
See TracChangeset
for help on using the changeset viewer.