Changeset 946 for trunk/python
- Timestamp:
- 03/30/06 15:39:30 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r936 r946 2 2 from asap import rcParams 3 3 from asap import print_log 4 from asap import selector 4 5 from numarray import ones,zeros 5 6 import sys … … 175 176 176 177 try: 177 bsel = self. _getselection()178 sel = asap._asap.Selector()178 bsel = self.get_selection() 179 sel = selector() 179 180 if type(scanid) is str: 180 sel. _setname()181 self. _setselection(sel)181 sel.set_name(scanid) 182 self.set_selection(bsel+sel) 182 183 scopy = self._copy() 183 self. _setselection(bsel)184 self.set_selection(bsel) 184 185 return scantable(scopy) 185 186 elif type(scanid) is int: 186 sel. _setscans([scanid])187 self. _setselection(sel)187 sel.set_scans([scanid]) 188 self.set_selection(bsel+sel) 188 189 scopy = self._copy() 189 self. _setselection(bsel)190 self.set_selection(bsel) 190 191 return scantable(scopy) 191 192 elif type(scanid) is list: 192 sel. _setscans(scanid)193 self. _setselection(sel)193 sel.set_scans(scanid) 194 self.set_selection(sel) 194 195 scopy = self._copy() 195 self. _setselection(bsel)196 self.set_selection(bsel) 196 197 return scantable(scopy) 197 198 else: … … 242 243 else: 243 244 return info 245 246 247 def get_selection(self): 248 """ 249 """ 250 return selector(self._getselection()) 251 252 def set_selection(self, selection): 253 """ 254 """ 255 self._setselection(selection) 244 256 245 257 def set_cursor(self, beam=0, IF=0, pol=0): … … 693 705 elif isinstance(freqs, list) or isinstance(freqs,tuple): 694 706 if isinstance(freqs[-1], int) or isinstance(freqs[-1],float): 695 from asap._asap import selector696 707 sel = selector() 697 708 savesel = self._getselection() 698 709 for i in xrange(len(freqs)): 699 sel. _setifs([i])710 sel.set_ifs([i]) 700 711 self._setselection(sel) 701 712 self._setrestfreqs(freqs[i], unit) … … 942 953 943 954 944 # def average_pol(self, mask=None, weight='none', insitu=None): 945 # """ 946 # Average the Polarisations together. 947 # The polarisation cursor of the output scan is set to 0 948 # Parameters: 949 # mask: An optional mask defining the region, where the 950 # averaging will be applied. The output will have all 951 # specified points masked. 952 # weight: Weighting scheme. 'none' (default), 'var' (1/var(spec) 953 # weighted), or 'tsys' (1/Tsys**2 weighted) 954 # insitu: if False a new scantable is returned. 955 # Otherwise, the scaling is done in-situ 956 # The default is taken from .asaprc (False) 957 # """ 958 # if insitu is None: insitu = rcParams['insitu'] 959 # self._math._setinsitu(insitu) 960 # varlist = vars() 961 # 962 # if mask is None: 963 # mask = () 964 # s = self._math._averagepol(self, mask, weight) 965 # s._add_history("average_pol",varlist) 966 # print_log() 967 # if insitu: self._assign(s) 968 # else: return scantable(s) 955 def average_pol(self, mask=None, weight='none'): 956 """ 957 Average the Polarisations together. 958 Parameters: 959 mask: An optional mask defining the region, where the 960 averaging will be applied. The output will have all 961 specified points masked. 962 weight: Weighting scheme. 'none' (default), 'var' (1/var(spec) 963 weighted), or 'tsys' (1/Tsys**2 weighted) 964 """ 965 varlist = vars() 966 if mask is None: 967 mask = () 968 s = self._math._averagepol(self, mask, weight) 969 s._add_history("average_pol",varlist) 970 print_log() 971 return scantable(s) 969 972 970 973 def smooth(self, kernel="hanning", width=5.0, insitu=None):
Note:
See TracChangeset
for help on using the changeset viewer.