Changeset 301


Ignore:
Timestamp:
01/26/05 02:00:39 (19 years ago)
Author:
kil064
Message:

add function resample

Location:
trunk/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r297 r301  
    287287        simple_math         - simple mathematical operations on two scantables,
    288288                              'add', 'sub', 'mul', 'div'
    289         scale               - returns a scan scaled by a given factor
    290         add                 - returns a scan with given value added
     289        scale               - return a scan scaled by a given factor
     290        add                 - return a scan with given value added
    291291        bin                 - return a scan with binned channels
     292        resample            - return a scan with resampled channels
    292293        smooth              - return the spectrally smoothed scan
    293294        poly_baseline       - fit a polynomial baseline to all Beams/IFs/Pols
  • trunk/python/asapmath.py

    r296 r301  
    262262        from asap._asap import bin_insitu as _bin
    263263        _bin(scan, width)
     264        return
     265
     266def resample(scan, width=5, method='cubic', insitu=None):
     267    """
     268    Return a scan where all spectra have been binned up
     269        width:       The bin width (default=5) in pixels
     270        method:      Interpolation method when correcting from a table. Values
     271                     are  "nearest", "linear", "cubic" (default) and "spline"
     272        insitu:      if False a new scantable is returned.
     273                     Otherwise, the scaling is done in-situ
     274                     The default is taken from .asaprc (False)
     275    """
     276    if insitu is None: insitu = rcParams['insitu']
     277    if not insitu:
     278        from asap._asap import resample as _resample
     279        return scantable(_resample(scan, method, width))
     280    else:
     281        from asap._asap import resample_insitu as _resample
     282        _resample(scan, method, width)
    264283        return
    265284
Note: See TracChangeset for help on using the changeset viewer.