Changeset 948
- Timestamp:
- 03/30/06 15:41:18 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/selector.py
r932 r948 1 1 from asap._asap import selector as _selector 2 from asap import unique, _to_list 3 2 4 class selector(_selector): 5 """ 6 A selection object to be applied to scantables to restrict the 7 scantables to specific rows. 8 """ 3 9 def __init(self): 4 10 _selector.__init__(self) … … 10 16 self._reset() 11 17 12 18 def is_empty(self): 19 """ 20 Has anything been set? 21 """ 22 return self._empty() 23 13 24 def set_polarisations(self, pols=[]): 14 25 """ … … 24 35 # reset the polarisation selection 25 36 sel.set_polarisations() 26 37 27 38 """ 28 39 vec = _to_list(pols, str) and _to_list(pols, int) … … 82 93 else: 83 94 raise TypeError('Unknown Cycle number type. Use lists of integers.') 84 95 85 96 86 97 def set_name(self, name): … … 97 108 else: 98 109 raise TypeError('name must be a string') 99 110 100 111 def set_tsys(self, tsysmin=0.0, tsysmax=None): 101 112 """ … … 107 118 # select all spectra with Tsys <= 500.0 108 119 selection.set_tsys(tsysmax=500.0) 109 120 110 121 """ 111 122 taql = "SELECT FROM $1 WHERE TSYS >= %f" % (tsysmin) … … 123 134 taql = "SELECT FROM $1 WHERE " + query 124 135 self._settaql(taql) 125 136 137 def set_order(self, order): 138 """ 139 Set the order the scantable should be sorted by. 140 Parameters: 141 order: The list of column nmaes to sort by in order 142 """ 143 self._setorder(order) 144 145 def get_scans(self): 146 return list(self._getscans()) 147 def get_cycles(self): 148 return list(self._getcycles()) 149 def get_beams(self): 150 return list(self._getbeams()) 151 def get_ifs(self): 152 return list(self._getifs()) 153 def get_pols(self): 154 return list(self._getpols()) 155 def get_poltypes(self): 156 return list(self._getpoltypes()) 157 def get_order(self): 158 return list(self._getorder()) 159 def get_taql(self): 160 return self._gettaql() 161 def get_name(self): 162 print "NYI" 163 s = self._gettaql() 164 return "" 165 166 def __add__(self, other): 167 """ 168 Merge two selections. 169 """ 170 union = selector() 171 gets = [[self._getscans(), other._getscans(), union._setscans], 172 [self._getcycles(), other._getcycles(),union._setcycles], 173 [self._getbeams(), other._getbeams(), union._setbeams], 174 [self._getifs(), other._getifs(), union._setifs], 175 [self._getpols(), other._getpols(), union._setpols]] 176 for v in gets: 177 vec = list(v[0]+v[1]) 178 vec.sort() 179 v[2](unique(vec)) 180 union._settaql(other._gettaql()) 181 return union
Note:
See TracChangeset
for help on using the changeset viewer.