Changeset 1875


Ignore:
Timestamp:
08/13/10 16:07:29 (14 years ago)
Author:
Malte Marquarding
Message:

Added srctype enum handling

Location:
trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1861 r1875  
    5252from opacity import skydip
    5353from opacity import model as opacity_model
     54from _asap import srctype
    5455
    5556__date__ = '$Date$'.split()[1]
  • trunk/python/scantable.py

    r1862 r1875  
    22482248        if mode.lower() == "paired":
    22492249            sel = self.get_selection()
    2250             sel.set_query("SRCTYPE==1")
     2250            sel.set_query("SRCTYPE==psoff")
    22512251            self.set_selection(sel)
    22522252            offs = self.copy()
    2253             sel.set_query("SRCTYPE==0")
     2253            sel.set_query("SRCTYPE==pson")
    22542254            self.set_selection(sel)
    22552255            ons = self.copy()
  • trunk/python/selector.py

    r1826 r1875  
    1 from asap._asap import selector as _selector
     1import re
     2from asap._asap import selector as _selector, srctype
    23from asap.utils import unique, _to_list
    34
     
    148149        Example:
    149150            # select all off scans with integration times over 60 seconds.
    150             selection.set_query("SRCTYPE == 1 AND INTERVAL > 60.0")
    151         """
     151            selection.set_query("SRCTYPE == PSOFF AND INTERVAL > 60.0")
     152        """
     153        rx = re.compile("((SRCTYPE *[!=][=] *)([a-zA-Z.]+))", re.I)
     154        for r in rx.findall(query):
     155            sval = None
     156            stype = r[-1].lower()
     157            if stype.find('srctype.') == -1:
     158                stype = ".".join(["srctype", stype])
     159            try:
     160                sval = eval(stype)
     161                sval = "%s%d" % (r[1], sval)
     162            except:
     163                continue
     164            query = query.replace(r[0], sval)
    152165        taql = "SELECT FROM $1 WHERE " + query
    153166        self._settaql(taql)
Note: See TracChangeset for help on using the changeset viewer.