Ignore:
Timestamp:
06/29/09 13:40:55 (15 years ago)
Author:
Malte Marquarding
Message:

Ticket #169: allow direct settings of selections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1574 r1576  
    312312        return selector(self._getselection())
    313313
    314     def set_selection(self, selection=selector()):
     314    def set_selection(self, selection=None, **kw):
    315315        """
    316316        Select a subset of the data. All following operations on this scantable
     
    325325            scan.set_selection()     # unset the selection
    326326        """
     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)
    327337        self._setselection(selection)
    328338
Note: See TracChangeset for help on using the changeset viewer.