- Timestamp:
- 04/26/07 14:32:17 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1338 r1348 125 125 """ 126 126 Return a copy of this scantable. 127 Note: 128 This makes a full (deep) copy. scan2 = scan1 makes a reference. 127 129 Parameters: 128 130 none … … 179 181 Return a specific scan (by scanno) or collection of scans (by 180 182 source name) in a new scantable. 183 Note: 184 See scantable.drop_scan() for the inverse operation. 181 185 Parameters: 182 186 scanid: a (list of) scanno or a source name, unix-style … … 377 381 """ 378 382 Return the System temperatures. 379 Parameters:380 381 383 Returns: 382 384 a list of Tsys values for the current selection … … 427 429 428 430 429 def get_time(self, row=-1 ):431 def get_time(self, row=-1, asdatetime=False): 430 432 """ 431 433 Get a list of time stamps for the observations. 432 Return a string for each integration in the scantable. 433 Parameters: 434 row: row no of integration. Default -1 return all rows 434 Return a datetime object for each integration time stamp in the scantable. 435 Parameters: 436 row: row no of integration. Default -1 return all rows 437 asdatetime: return values as datetime objects rather than strings 435 438 Example: 436 439 none … … 438 441 from time import strptime 439 442 from datetime import datetime 440 times = self._get_column(self._gettime, row) 443 if not asdatetime: 444 return self._get_column(self._gettime, row) 441 445 format = "%Y/%m/%d/%H:%M:%S" 442 446 if isinstance(times, list): … … 445 449 return datetime(*strptime(times, format)[:6]) 446 450 451 452 def get_inttime(self, row=-1): 453 """ 454 Get a list of integration times for the observations. 455 Return a time in seconds for each integration in the scantable. 456 Parameters: 457 row: row no of integration. Default -1 return all rows. 458 Example: 459 none 460 """ 461 return self._get_column(self._getinttime, row) 462 463 447 464 def get_sourcename(self, row=-1): 448 465 """ … … 450 467 Return a string for each integration in the scantable. 451 468 Parameters: 452 row: row no of integration. Default -1 return all rows 469 row: row no of integration. Default -1 return all rows. 453 470 Example: 454 471 none … … 461 478 Return a float for each integration in the scantable. 462 479 Parameters: 463 row: row no of integration. Default -1 return all rows 480 row: row no of integration. Default -1 return all rows. 464 481 Example: 465 482 none … … 472 489 Return a float for each integration in the scantable. 473 490 Parameters: 474 row: row no of integration. Default -1 return all rows 491 row: row no of integration. Default -1 return all rows. 475 492 Example: 476 493 none … … 483 500 Return a float for each integration in the scantable. 484 501 Parameters: 485 row: row no of integration. Default -1 return all rows 502 row: row no of integration. Default -1 return all rows. 486 503 Example: 487 504 none … … 517 534 def set_instrument(self, instr): 518 535 """ 519 Set the instrument for subsequent processing 536 Set the instrument for subsequent processing. 520 537 Parameters: 521 538 instr: Select from 'ATPKSMB', 'ATPKSHOH', 'ATMOPRA', … … 599 616 """ 600 617 Get the default unit set in this scantable 601 Parameters:602 618 Returns: 603 619 A unit string … … 616 632 first row, i.e. rowno=0 617 633 Returns: 618 The abcissa values and it'sformat string (as a dictionary)634 The abcissa values and the format string (as a dictionary) 619 635 """ 620 636 abc = self._getabcissa(rowno) … … 648 664 No taper is applied. 649 665 Parameters: 650 frequency: the frequency (really a period within the bandwidth) to remove 651 width: the width of the frequency to remove, to remove a range 652 of frequencies aroung the centre. 666 frequency: the frequency (really a period within the bandwidth) 667 to remove 668 width: the width of the frequency to remove, to remove a 669 range of frequencies aroung the centre. 653 670 unit: the frequency unit (default "GHz") 654 671 Notes: 655 It is recommended to flag edges of the band or strong signals beforehand. 672 It is recommended to flag edges of the band or strong 673 signals beforehand. 656 674 """ 657 675 if insitu is None: insitu = rcParams['insitu'] … … 771 789 # set the given restfrequency for the whole table 772 790 scan.set_restfreqs(freqs=1.4e9) 773 # If thee number of IFs in the data is >= 2 theIF0 gets the first791 # If thee number of IFs in the data is >= 2 IF0 gets the first 774 792 # value IF1 the second... 775 793 scan.set_restfreqs(freqs=[1.4e9, 1.67e9]) … … 839 857 """ 840 858 Print the history. Optionally to a file. 859 Parameters: 860 filename: The name of the file to save the history to. 841 861 """ 842 862 hist = list(self._gethistory()) … … 1063 1083 """ 1064 1084 Return a scan where all spectra have been binned up. 1085 Parameters: 1065 1086 width: The bin width (default=5) in pixels 1066 1087 insitu: if False a new scantable is returned. … … 1080 1101 def resample(self, width=5, method='cubic', insitu=None): 1081 1102 """ 1082 Return a scan where all spectra have been binned up 1103 Return a scan where all spectra have been binned up. 1104 1105 Parameters: 1083 1106 width: The bin width (default=5) in pixels 1084 1107 method: Interpolation method when correcting from a table. … … 1159 1182 Smooth the spectrum by the specified kernel (conserving flux). 1160 1183 Parameters: 1161 scan: The input scan1162 1184 kernel: The type of smoothing kernel. Select from 1163 1185 'hanning' (default), 'gaussian' and 'boxcar'. … … 1187 1209 Return a scan which has been baselined (all rows) by a polynomial. 1188 1210 Parameters: 1189 scan: a scantable1190 1211 mask: an optional mask 1191 1212 order: the order of the polynomial (default is 0) … … 1378 1399 def swap_linears(self): 1379 1400 """ 1380 Swap the linear polarisations XX and YY 1401 Swap the linear polarisations XX and YY, or better the first two 1402 polarisations as this also works for ciculars. 1381 1403 """ 1382 1404 varlist = vars() … … 1438 1460 return s 1439 1461 1440 def auto_quotient(self, mode='paired', preserve=True):1462 def auto_quotient(self, preserve=True, mode='paired'): 1441 1463 """ 1442 1464 This function allows to build quotients automatically. 1443 1465 It assumes the observation to have the same numer of 1444 1466 "ons" and "offs" 1445 It will support "closest off in time" in the future 1446 Parameters: 1447 mode: the on/off detection mode 1448 'paired' (default) 1449 identifies 'off' scans by the 1450 trailing '_R' (Mopra/Parkes) or 1451 '_e'/'_w' (Tid) and matches 1452 on/off pairs from the observing pattern 1453 'time' 1454 finds the closest off in time 1467 Parameters: 1455 1468 preserve: you can preserve (default) the continuum or 1456 1469 remove it. The equations used are 1457 1470 preserve: Output = Toff * (on/off) - Toff 1458 1471 remove: Output = Toff * (on/off) - Ton 1459 """ 1460 modes = ["time", "suffix"] 1472 mode: the on/off detection mode 1473 'paired' (default) 1474 identifies 'off' scans by the 1475 trailing '_R' (Mopra/Parkes) or 1476 '_e'/'_w' (Tid) and matches 1477 on/off pairs from the observing pattern 1478 'time' 1479 finds the closest off in time 1480 1481 """ 1482 modes = ["time", "paired"] 1461 1483 if not mode in modes: 1462 1484 msg = "please provide valid mode. Valid modes are %s" % (modes) 1463 1485 raise ValueError(msg) 1464 1486 varlist = vars() 1465 1466 if mode.lower() == "suffix":1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1487 s = None 1488 if mode.lower() == "paired": 1489 basesel = self.get_selection() 1490 sel = selector() 1491 self.set_selection(basesel+sel) 1492 offs = self.copy() 1493 sel.set_query("SRCTYPE==0") 1494 self.set_selection(basesel+sel) 1495 ons = self.copy() 1496 s = scantable(self._math._quotient(ons, offs, preserve)) 1497 self.set_selection(basesel) 1498 elif mode.lower() == "time": 1499 s = scantable(self._math._auto_quotient(self, mode, preserve)) 1478 1500 s._add_history("auto_quotient", varlist) 1479 1501 print_log()
Note:
See TracChangeset
for help on using the changeset viewer.