Changeset 1576 for trunk/python
- Timestamp:
- 06/29/09 13:40:55 (16 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1574 r1576 312 312 return selector(self._getselection()) 313 313 314 def set_selection(self, selection= selector()):314 def set_selection(self, selection=None, **kw): 315 315 """ 316 316 Select a subset of the data. All following operations on this scantable … … 325 325 scan.set_selection() # unset the selection 326 326 """ 327 if selection is None: 328 # reset 329 if len(kw) == 0: 330 selection = selector() 331 else: 332 # try keywords 333 for k in kw: 334 if k not in selector.fields: 335 raise KeyError("Invalid selection key '%s', valid keys are %s" % (k, selector.fields)) 336 selection = selector(**kw) 327 337 self._setselection(selection) 328 338 -
trunk/python/selector.py
r1542 r1576 7 7 scantables to specific rows. 8 8 """ 9 def __init(self): 10 _selector.__init__(self) 9 fields = ["pols", "ifs", "beams", "scans", "cycles", "name", "query"] 10 11 def __init__(self, *args, **kw): 12 if len(args) == 1: 13 if isinstance(args[0], self.__class__) \ 14 or isinstance(args[0], _selector): 15 _selector.__init__(self, args[0]) 16 else: 17 raise TypeError("Argument can only be a selector object") 18 else: 19 _selector.__init__(self) 20 for k,v in kw.items(): 21 if k in self.fields: 22 func = getattr(self, "set_%s" % k) 23 func(v) 11 24 12 25 def reset(self): … … 45 58 else: 46 59 raise TypeError('Unknown pol type. Please use [0,1...] or ["XX","YY"...]') 47 60 48 61 # for the americans 49 62 set_polarizations = set_polarisations
Note:
See TracChangeset
for help on using the changeset viewer.