Changeset 1338


Ignore:
Timestamp:
04/20/07 10:49:11 (17 years ago)
Author:
mar637
Message:

Added matched pair auto_quotient and made it the default 'mode'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1322 r1338  
    14381438            return s
    14391439
    1440     def auto_quotient(self, mode='time', preserve=True):
     1440    def auto_quotient(self, mode='paired', preserve=True):
    14411441        """
    14421442        This function allows to build quotients automatically.
     
    14451445        It will support "closest off in time" in the future
    14461446        Parameters:
    1447             mode:           the on/off detection mode; 'suffix' (default)
    1448                             'suffix' identifies 'off' scans by the
    1449                             trailing '_R' (Mopra/Parkes) or
    1450                             '_e'/'_w' (Tid)
     1447            mode:           the on/off detection mode
     1448                            'paired' (default)
     1449                               identifies 'off' scans by the
     1450                               trailing '_R' (Mopra/Parkes) or
     1451                               '_e'/'_w' (Tid) and matches
     1452                               on/off pairs from the observing pattern
     1453                            'time'
     1454                               finds the closest off in time
    14511455            preserve:       you can preserve (default) the continuum or
    14521456                            remove it.  The equations used are
     
    14541458                            remove:   Output = Toff * (on/off) - Ton
    14551459        """
    1456         modes = ["time"]
     1460        modes = ["time", "suffix"]
    14571461        if not mode in modes:
    14581462            msg = "please provide valid mode. Valid modes are %s" % (modes)
    14591463            raise ValueError(msg)
    14601464        varlist = vars()
    1461         s = scantable(self._math._auto_quotient(self, mode, preserve))
     1465        s = None
     1466        if mode.lower() == "suffix":
     1467            basesel = self.get_selection()
     1468            sel = selector()
     1469            self.set_selection(basesel+sel)
     1470            offs = self.copy()
     1471            sel.set_query("SRCTYPE==0")
     1472            self.set_selection(basesel+sel)
     1473            ons = self.copy()
     1474            s = scantable(self._math._quotient(ons, offs, preserve))
     1475            self.set_selection(basesel)
     1476        elif mode.lower() == "time":
     1477            s = scantable(self._math._auto_quotient(self, mode, preserve))
    14621478        s._add_history("auto_quotient", varlist)
    14631479        print_log()
Note: See TracChangeset for help on using the changeset viewer.