Changeset 1579 for trunk/python


Ignore:
Timestamp:
06/29/09 13:52:18 (16 years ago)
Author:
Malte Marquarding
Message:

Ticket #46; changed scnatable.lag_flag to handle a start/end value rather than a width. lag channels can also be specified directly by seeting the unit to

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1576 r1579  
    708708        self._add_history("flag", varlist)
    709709
    710     def lag_flag(self, frequency, width=0.0, unit="GHz", insitu=None):
     710    def lag_flag(self, start, end, unit="GHz", insitu=None):
    711711        """
    712712        Flag the data in 'lag' space by providing a frequency to remove.
     
    714714        No taper is applied.
    715715        Parameters:
    716             frequency:    the frequency (really a period within the bandwidth)
    717                           to remove
    718             width:        the width of the frequency to remove, to remove a
    719                           range of frequencies around the centre.
    720             unit:         the frequency unit (default "GHz")
     716            start:    the start frequency (really a period within the
     717                      bandwidth)  or period to remove
     718            end:      the end frequency or period to remove
     719            unit:     the frequency unit (default "GHz") or "" for
     720                      explicit lag channels
    721721        Notes:
    722             It is recommended to flag edges of the band or strong 
     722            It is recommended to flag edges of the band or strong
    723723            signals beforehand.
    724724        """
     
    726726        self._math._setinsitu(insitu)
    727727        varlist = vars()
    728         base = { "GHz": 1000000000., "MHz": 1000000., "kHz": 1000., "Hz": 1. }
    729         if not base.has_key(unit):
     728        base = { "GHz": 1000000000., "MHz": 1000000., "kHz": 1000., "Hz": 1.}
     729        if not (unit == "" or base.has_key(unit)):
    730730            raise ValueError("%s is not a valid unit." % unit)
    731731        try:
    732             s = scantable(self._math._lag_flag(self, frequency*base[unit],
    733                                                width*base[unit]))
     732            if unit == "":
     733                s = scantable(self._math._lag_flag(self, start, end, "lags"))
     734            else:
     735                s = scantable(self._math._lag_flag(self, start*base[unit],
     736                                                   end*base[unit], "frequency"))
    734737        except RuntimeError, msg:
    735738            if rcParams['verbose']:
Note: See TracChangeset for help on using the changeset viewer.