Changeset 393 for trunk/python


Ignore:
Timestamp:
02/08/05 15:48:29 (20 years ago)
Author:
kil064
Message:

merge set_restfreqs and select_restfreqs into 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r391 r393  
    485485        return msk
    486486   
    487     def set_restfreqs(self, freqs, unit='Hz'):
    488         """
    489         Set the restfrequency(s) for this scantable.
    490         Parameters:
    491             freqs:    one or more frequencies
    492             unit:     optional 'unit', default 'Hz'
    493         Example:
    494             scan.set_restfreqs([1000000000.0])
    495         """
    496         if type(freqs) is float or int:
    497             freqs = (freqs)
    498         sdtable._setrestfreqs(self,freqs, unit)
    499         return
    500 
    501487    def get_restfreqs(self):
    502488        """
     
    510496        return list(self._getrestfreqs())
    511497
    512     def select_restfreq(self, freq, unit='Hz', source=None, theif=None):
    513         """
    514         Select the restfrequency for the specified source and IF
    515         Parameters:
     498    def set_restfreqs(self, freqs, unit='Hz', source=None, theif=None):
     499        """
     500        Select the restfrequency for the specified source and IF OR
     501        replace for all IFs.  If the 'freqs' argument holds a scalar,
     502        then that rest frequency will be applied to the selected
     503        data (and added to the list of available rest frequencies).
     504        In this way, you can set a rest frequency for each
     505        source and IF combination.   If the 'freqs' argument holds
     506        a vector, then it MUST be of length the number of IFs
     507        (and the available restfrequencies will be replaced by
     508        this vector).  In this case, *all* data ('source' and
     509        'theif' are ignored) have the restfrequency set per IF according
     510        to the corresponding value you give in the 'freqs' vector. 
     511        E.g. 'freqs=[1e9,2e9]'  would mean IF 0 gets restfreq 1e9 and
     512        IF 1 gets restfreq 2e9.
     513        Parameters:
     514            freqs:   rest frequencies
     515            unit:    unit for rest frequency (default 'Hz')
    516516            source:  Source name (blank means all)
    517517            theif:   IF (-1 means all)
    518             freq:    rest frequency
    519             unit:    unit for rest frequency (default 'Hz')
    520         Example:
    521             scan.select_restfreq(freq=1.4e9, source='NGC253', theif=2)
     518        Example:
     519            scan.set_restfreqs(freqs=1.4e9, source='NGC253', theif=2)
     520            scan.set_restfreqs(freqs=[1.4e9,1.67e9])
    522521        """
    523522        if source is None:
     
    525524        if theif is None:
    526525            theif = -1
    527         sdtable._selectrestfreq(self, freq, unit, source, theif)
     526        t = type(freqs)
     527        if t is int or t is float:
     528           freqs = [freqs]
     529        sdtable._setrestfreqs(self, freqs, unit, source, theif)
    528530        return
    529531
Note: See TracChangeset for help on using the changeset viewer.