Changeset 1070
- Timestamp:
- 07/04/06 14:45:26 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1061 r1070 377 377 return retval 378 378 379 def _get_column(self, callback, row=-1): 380 """ 381 """ 382 if row == -1: 383 return [callback(i) for i in range(self.nrow())] 384 else: 385 if 0 <= row < self.nrow(): 386 return callback(row) 387 379 388 380 389 def get_time(self, row=-1): … … 387 396 none 388 397 """ 389 out = [] 390 if row == -1: 391 for i in range(self.nrow()): 392 out.append(self._gettime(i)) 393 return out 394 else: 395 if row < self.nrow(): 396 return self._gettime(row) 398 return self._get_column(self._gettime, row) 397 399 398 400 def get_sourcename(self, row=-1): … … 405 407 none 406 408 """ 407 out = [] 408 if row == -1: 409 return [self._getsourcename(i) for i in range(self.nrow())] 410 else: 411 if 0 <= row < self.nrow(): 412 return self._getsourcename(row) 409 return self._get_column(self._getsourcename, row) 413 410 414 411 def get_elevation(self, row=-1): … … 421 418 none 422 419 """ 423 out = [] 424 if row == -1: 425 return [self._getelevation(i) for i in range(self.nrow())] 426 else: 427 if 0 <= row < self.nrow(): 428 return self._getelevation(row) 420 return self._get_column(self._getelevation, row) 429 421 430 422 def get_azimuth(self, row=-1): … … 437 429 none 438 430 """ 439 out = [] 440 if row == -1: 441 return [self._getazimuth(i) for i in range(self.nrow())] 442 else: 443 if 0 <= row < self.nrow(): 444 return self._getazimuth(row) 431 return self._get_column(self._getazimuth, row) 445 432 446 433 def get_parangle(self, row=-1): … … 453 440 none 454 441 """ 455 out = [] 456 if row == -1: 457 return [self._getparangle(i) for i in range(self.nrow())] 458 else: 459 if 0 <= row < self.nrow(): 460 return self._getparangle(row) 442 return self._get_column(self._getparangle, row) 443 444 def get_direction(self, row=-1): 445 """ 446 Get a list of Positions on the sky (direction) for the observations. 447 Return a float for each integration in the scantable. 448 Parameters: 449 row: row no of integration. Default -1 return all rows 450 Example: 451 none 452 """ 453 return self._get_column(self._getdirection, row) 461 454 462 455 def set_unit(self, unit='channel'): … … 756 749 def average_time(self, mask=None, scanav=False, weight='tint', align=False): 757 750 """ 758 Return the (time) average of a scan, or apply it 'insitu'.751 Return the (time) weighted average of a scan. 759 752 Note: 760 in channels only 761 The cursor of the output scan is set to 0. 753 in channels only - align if necessary 762 754 Parameters: 763 755 one scan or comma separated scans … … 795 787 else: raise 796 788 s._add_history("average_time",varlist) 789 print_log() 790 return s 791 792 def average_channel(self, mode="MEDIAN", align=False): 793 """ 794 Return the (median) average of a scan. 795 Note: 796 in channels only - align if necessary 797 the mdeian Tsys is computed. 798 Parameters: 799 one scan or comma separated scans 800 mode: type of average, default "MEDIAN" 801 align: align the spectra in velocity before averaging. It takes 802 the time of the first spectrum as reference time. 803 Example: 804 # mdeian average the scan 805 newscan = scan.average_channel() 806 """ 807 varlist = vars() 808 if mode is None: mode = 'MEDIAN' 809 scan = self 810 try: 811 if align: 812 scan = self.freq_align(insitu=False) 813 s = scantable(self._math._averagechannel(scan, mode)) 814 except RuntimeError,msg: 815 if rcParams['verbose']: 816 print msg 817 return 818 else: raise 819 s._add_history("average_channel",varlist) 797 820 print_log() 798 821 return s … … 1282 1305 remove it. The equations used are 1283 1306 preserve: Output = Toff * (on/off) - Toff 1284 remove: Output = T ref * (on/off) - Ton1307 remove: Output = Toff * (on/off) - Ton 1285 1308 """ 1286 1309 modes = ["time"] … … 1289 1312 raise ValueError(msg) 1290 1313 varlist = vars() 1291 s = scantable(self._math._ quotient(self, mode, preserve))1314 s = scantable(self._math._auto_quotient(self, mode, preserve)) 1292 1315 s._add_history("auto_quotient",varlist) 1293 1316 print_log()
Note:
See TracChangeset
for help on using the changeset viewer.