Changeset 720


Ignore:
Timestamp:
11/18/05 11:16:23 (18 years ago)
Author:
mar637
Message:

added asaplog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r710 r720  
    11from scantable import scantable
    22from asap import rcParams
     3from asap import print_log
    34
    45def average_time(*args, **kwargs):
     
    1112        scanav:   True averages each scan separately.
    1213                  False (default) averages all scans together,
    13         weight:   Weighting scheme. 'none, 'var' (1/var(spec) 
     14        weight:   Weighting scheme. 'none, 'var' (1/var(spec)
    1415                  weighted), 'tsys' (1/Tsys**2 weighted), 'tint'
    15                   (integration time weighted) or 'tintsys' (Tsys 
     16                  (integration time weighted) or 'tintsys' (Tsys
    1617                  and tint). The default is 'tint'
    1718    Example:
     
    3940    else:
    4041        lst = tuple(args)
    41        
     42
    4243    del varlist["kwargs"]
    4344    varlist["args"] = "%d scantables" % len(lst)
    4445    # need special formatting her for history...
    45    
     46
    4647    from asap._asap import average as _av
    4748    for s in lst:
    4849        if not isinstance(s,scantable):
    49             print "Please give a list of scantables"
    50             return
     50            msg = "Please give a list of scantables"
     51            if rcParams['verbose']:
     52                print msg
     53                return
     54            else:
     55                raise TypeError(msg)
    5156    s = scantable(_av(lst, mask, scanAv, weight))
    5257    s._add_history("average_time",varlist)
     58    print_log()
    5359    return s
    5460
     
    6268        source:        the 'on' scan
    6369        reference:     the 'off' scan
    64         preserve:      you can preserve (default) the continuum or 
    65                        remove it.  The equations used are 
    66                           preserve:  Output = Toff * (on/off) - Toff
    67                           remove:    Output = Toff * (on/off) - Ton
     70        preserve:      you can preserve (default) the continuum or
     71                       remove it.  The equations used are
     72                       preserve:  Output = Toff * (on/off) - Toff
     73                       remove:    Output = Toff * (on/off) - Ton
    6874    """
    6975    varlist = vars()
     
    7177    s = scantable(_quot(source, reference, preserve))
    7278    s._add_history("quotient",varlist)
     79    print_log()
    7380    return s
    7481
    7582def simple_math(left, right, op='add', tsys=True):
    7683    """
    77     Apply simple mathematical binary operations to two 
     84    Apply simple mathematical binary operations to two
    7885    scan tables,  returning the result in a new scan table.
    7986    The operation is applied to both the correlations and the TSys data
     
    8895    varlist = vars()
    8996    if not isinstance(left,scantable) and not isinstance(right,scantable):
    90         print "Please provide two scantables as input"
    91         return
     97        msg = "Please provide two scantables as input"
     98        if rcParams['verbose']:
     99            print msg
     100            return
     101        else:
     102            raise TypeError(msg)
    92103    from asap._asap import b_operate as _bop
    93104    s = scantable(_bop(left, right, op, tsys))
    94105    s._add_history("simple_math", varlist)
     106    print_log()
    95107    return s
    96    
    97    
Note: See TracChangeset for help on using the changeset viewer.