Changeset 1502


Ignore:
Timestamp:
02/12/09 19:58:01 (15 years ago)
Author:
Malte Marquarding
Message:

added function to set reference scans manually

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1483 r1502  
    15151515            return s
    15161516
     1517    def set_sourcetype(self, match, sourcetype="reference"):
     1518        """
     1519        Set the type of the source to be an source or reference scan
     1520        using the provided pattern:
     1521        Parameters:
     1522            match:          a Unix style pattern or asap selector
     1523            sourcetype:     the type of the source to use (source/reference)
     1524        """
     1525        varlist = vars()
     1526        basesel = self.get_selection()
     1527        stype = -1
     1528        if sourcetype.lower().startswith("r"):
     1529            stype = 1
     1530        elif sourcetype.lower().startswith("s"):
     1531            stype = 0
     1532        if stype == -1:
     1533            raise ValueError("Illegal sourcetype use s(ource) or r(eference)")
     1534        sel = selector()
     1535        if isinstance(match, selector):
     1536            sel = match
     1537        else:
     1538            sel.set_query("SRCNAME == pattern('%s')" % match)
     1539        self.set_selection(basesel+sel)
     1540        self._setsourcetype(stype)
     1541        self.set_selection(basesel)
     1542        s._add_history("set_sourcetype", varlist)
     1543
    15171544    def auto_quotient(self, preserve=True, mode='paired'):
    15181545        """
     
    15311558                            '_e'/'_w' (Tid) and matches
    15321559                            on/off pairs from the observing pattern
    1533                 'time'
    1534                    finds the closest off in time
     1560                            'time'
     1561                            finds the closest off in time
    15351562
    15361563        """
     
    18091836            r._open(name, -1, -1)
    18101837            r._read()
    1811             #tbl = r._getdata()
    18121838            if average:
    18131839                tbl = self._math._average((tbl, ), (), 'NONE', 'SCAN')
    1814                 #tbl = tbl2
    18151840            if not first:
    18161841                tbl = self._math._merge([self, tbl])
    1817                 #tbl = tbl2
    18181842            Scantable.__init__(self, tbl)
    18191843            r._close()
Note: See TracChangeset for help on using the changeset viewer.