Changeset 166


Ignore:
Timestamp:
12/27/04 20:32:00 (20 years ago)
Author:
kil064
Message:

function 'average_pol' now has insitu version as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapmath.py

    r160 r166  
    9595    return scantable(_bin(scan, binwidth))
    9696
    97 def average_pol(scan, mask=None):
     97def average_pol(scan, mask=None, insitu=False):
    9898    """
    9999    Average the Polarisations together.
    100100    Parameters:
    101101        scan   - a scantable
    102         mask   - an optional mask defining the region, where
    103                  the averaging will be applied. The output
    104                  will have all specified points masked.
    105                  The dimension won't be reduced and
    106                  all polarisations will contain the
    107                  averaged spectrum.
     102        mask   - an optional mask defining the region, where the
     103                 averaging will be applied. The output will have all
     104                 specified points masked.
     105        insitu:      if False (default) a new scantable is returned.
     106                     Otherwise, the averaging is done in-situ
    108107    Example:
    109108        polav = average_pols(myscan)
    110109    """
    111     from asap._asap import averagepol as _avpol
    112     from numarray import ones
    113110    if mask is None:
    114         mask = tuple(ones(scan.nchan()))
    115     return scantable(_avpol(scan, mask))
     111        mask = ()
     112    if not insitu:
     113        from asap._asap import averagepol as _avpol
     114        return scantable(_avpol(scan, mask))
     115    else:
     116        from asap._asap import averagepol_insitu as _avpol
     117        _avpol(scan, mask)
     118        return
    116119   
    117120def hanning(scan):
Note: See TracChangeset for help on using the changeset viewer.