Changeset 1192 for trunk/python


Ignore:
Timestamp:
08/28/06 16:33:58 (18 years ago)
Author:
mar637
Message:

added lag_flag - flagging of frequencies in fft space

Location:
trunk/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1190 r1192  
    409409            set_restfreqs   - set a list of rest frequencies
    410410            flag            - flag selected channels in the data
     411            lag_flag        - flag specified frequency in the data
    411412            save            - save the scantable to disk as either 'ASAP',
    412413                              'SDFITS' or 'ASCII'
  • trunk/python/scantable.py

    r1190 r1192  
    639639            else: raise
    640640        self._add_history("flag", varlist)
     641
     642    def lag_flag(self, frequency, unit="GHz", width=0, insitu=None):
     643        """
     644        Flag the data in 'lag' space by providing a frequency to remove.
     645        Flagged data in the scantable gets set to 0.0 before the fft.
     646        No taper is applied.
     647        Parameters:
     648            frequency:    the frequency to remove
     649            unit:         the frequency unit ()default "GHz")
     650            width:        the number of 'lag' channels to extent the frequency
     651                          by, i.e. the interval
     652                          [bandwidth/frequency-width, bandwidth/frequency+width]
     653        """
     654        if insitu is None: insitu = rcParams['insitu']
     655        self._math._setinsitu(insitu)
     656        varlist = vars()
     657        base = { "GHz": 100000000., "MHz": 1000000., "kHz": 1000., "Hz": 1. }
     658        if not base.has_key(unit):
     659            raise ValueError("%s is not a valid unit." % unit)
     660        try:
     661            s = scantable(self._math._lag_flag(self, frequency*base[unit], width))
     662        except RuntimeError, msg:
     663            if rcParams['verbose']:
     664                print msg
     665                return
     666            else: raise
     667        s._add_history("lag_flag", varlist)
     668        print_log()
     669        if insitu:
     670            self._assign(s)
     671        else:
     672            return s
    641673
    642674
Note: See TracChangeset for help on using the changeset viewer.