Changeset 180


Ignore:
Timestamp:
01/07/05 11:20:21 (19 years ago)
Author:
kil064
Message:

add function 'smooth' and remove function 'hanning'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r174 r180  
    127127        return
    128128   
    129 def hanning(scan, insitu=False, all=True):
     129def smooth(scan, kernel="hanning", width=5.0, insitu=False, all=True):
    130130    """
    131     Hanning smooth the channels.
     131    Smooth the spectrum by the specified kernel (conserving flux).
    132132    Parameters:
    133133        scan:       The input scan
     134        kernel:     The type of smoothing kernel. Select from
     135                    'hanning' (default), 'gaussian' and 'boxcar'.
     136                    The first three characters are sufficient.
     137        width:      The width of the kernel in pixels. For hanning this is
     138                    ignored otherwise it defauls to 5 pixels.
     139                    For 'gaussian' it is the Full Width Half
     140                    Maximum. For 'boxcar' it is the full width.
    134141        insitu:     If False (default) a new scantable is returned.
    135142                    Otherwise, the scaling is done in-situ
    136         all:         if True (default) apply to all spectra. Otherwise
    137                      apply only to the selected (beam/pol/if)spectra only
     143        all:        If True (default) apply to all spectra. Otherwise
     144                    apply only to the selected (beam/pol/if)spectra only
    138145    Example:
    139146         none
    140147    """
    141148    if not insitu:
    142         from asap._asap import hanning as _hann
    143         return scantable(_hann(scan,all))
     149        from asap._asap import smooth as _smooth
     150        return scantable(_smooth(scan,kernel,width,all))
    144151    else:
    145         from asap._asap import hanning_insitu as _hann
    146         _hann(scan,all)
     152        from asap._asap import smooth_insitu as _smooth
     153        _smooth(scan,kernel,width,all)
    147154        return
    148155   
Note: See TracChangeset for help on using the changeset viewer.