Changeset 150


Ignore:
Timestamp:
12/26/04 20:48:59 (20 years ago)
Author:
kil064
Message:

add arg. 'all' to functions 'scale' and 'add' to apply
to either cursor selection or all spectra

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r143 r150  
    5050    return scantable(_quot(source, reference))
    5151
    52 def scale(scan, factor, insitu=False):
     52def scale(scan, factor, insitu=False, all=True):
    5353    """
    5454    Return a scan where all spectra are scaled by the give 'factor'
     
    5656        scan:        a scantable
    5757        factor:      the scaling factor
    58     Note:
    59         This currently applies the all beams/IFs/pols
     58        insitu:      if False (default) a new scantable is returned.
     59                     Otherwise, the scaling is done in-situ
     60        all:         if True (default) apply to all spectra. Otherwise
     61                     apply only to the selected (beam/pol/if)spectra only
    6062    """
    6163    if not insitu:
    6264        from asap._asap import scale as _scale
    63         return scantable(_scale(scan, factor))
     65        return scantable(_scale(scan, factor, all))
    6466    else:
    6567        from asap._asap import scale_insitu as _scale
    66         _scale(scan, factor)
     68        _scale(scan, factor, all)
    6769        return
    6870       
    6971
    70 def add(scan, offset):
     72def add(scan, offset, insitu=False, all=True):
    7173    """
    72     Return a scan where the offset is added.
     74    Return a scan where all spectra have the offset added
    7375    Parameters:
    7476        scan:        a scantable
    75         offset:      the value to add
    76     Note:
    77         This currently applies the all beams/IFs/pols
     77        offset:      the offset
     78        insitu:      if False (default) a new scantable is returned.
     79                     Otherwise, the addition is done in-situ
     80        all:         if True (default) apply to all spectra. Otherwise
     81                     apply only to the selected (beam/pol/if)spectra only
    7882    """
    79     from asap._asap import add as _add
    80     return scantable(_add(scan, offset))
    81 
    82 
     83    if not insitu:
     84        from asap._asap import add as _add
     85        return scantable(_add(scan, offset, all))
     86    else:
     87        from asap._asap import add_insitu as _add
     88        _add(scan, offset, all)
     89        return
     90       
    8391def bin(scan, binwidth=5):
    8492    """
Note: See TracChangeset for help on using the changeset viewer.