Changeset 1504 for trunk/python


Ignore:
Timestamp:
02/13/09 11:27:42 (16 years ago)
Author:
Malte Marquarding
Message:

Fix for ticket #151: added facilities to help with on/off scan identification/setting

Location:
trunk/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1472 r1504  
    114114    'scantable.verbosesummary'   : [False, _validate_bool],
    115115    'scantable.storage'   : ['memory', str],
    116     'scantable.history'   : [True, _validate_bool]
     116    'scantable.history'   : [True, _validate_bool],
     117    'scantable.reference'      : ['.*(e|w|_R)$', str]
    117118    # fitter
    118119    }
     
    180181scantable.verbosesummary   : False
    181182
     183# Control the identification of reference (off) scans
     184# This is has to be a regular expression
     185scantable.reference         : .*(e|w|_R)$
    182186# Fitter
    183187"""
  • trunk/python/scantable.py

    r1502 r1504  
    15151515            return s
    15161516
    1517     def set_sourcetype(self, match, sourcetype="reference"):
     1517    def set_sourcetype(self, match, matchtype="pattern",
     1518                       sourcetype="reference"):
    15181519        """
    15191520        Set the type of the source to be an source or reference scan
    15201521        using the provided pattern:
    15211522        Parameters:
    1522             match:          a Unix style pattern or asap selector
     1523            match:          a Unix style pattern, regular expression or selector
     1524            matchtype:      'pattern' (default) UNIX style pattern or
     1525                            'regex' regular expression
    15231526            sourcetype:     the type of the source to use (source/reference)
    15241527        """
     
    15301533        elif sourcetype.lower().startswith("s"):
    15311534            stype = 0
    1532         if stype == -1:
     1535        else:
    15331536            raise ValueError("Illegal sourcetype use s(ource) or r(eference)")
     1537        if matchtype.lower().startswith("p"):
     1538            matchtype = "pattern"
     1539        elif matchtype.lower().startswith("r"):
     1540            matchtype = "regex"
     1541        else:
     1542            raise ValueError("Illegal matchtype, use p(attern) or r(egex)")
    15341543        sel = selector()
    15351544        if isinstance(match, selector):
    15361545            sel = match
    15371546        else:
    1538             sel.set_query("SRCNAME == pattern('%s')" % match)
     1547            sel.set_query("SRCNAME == %s('%s')" % (matchtype, match))
    15391548        self.set_selection(basesel+sel)
    15401549        self._setsourcetype(stype)
     
    18311840            tbl = Scantable(stype)
    18321841            r = stfiller(tbl)
     1842            rx = rcParams['scantable.reference']
     1843            r._setreferenceexpr(rx)
    18331844            msg = "Importing %s..." % (name)
    18341845            asaplog.push(msg, False)
Note: See TracChangeset for help on using the changeset viewer.