Changeset 1684 for branches/alma/python


Ignore:
Timestamp:
02/04/10 20:42:12 (15 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-1810

Ready to Release: Yes

Interface Changes: Yes

What Interface Changed: Added 'antenna' parameter to scantable constructor

Test Programs: List test programs

Put in Release Notes: Yes

Module(s): atnf

Description: Describe your changes here...

I have added 'antenna' parameter to scantable constructor to be able to
select specific antenna from MS data with multiple antenna data.
Currently, only single antenna selection is working. For multiple antenna
selection, only first selection is used.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/scantable.py

    r1681 r1684  
    1212    """
    1313
    14     def __init__(self, filename, average=None, unit=None, getpt=None):
     14    def __init__(self, filename, average=None, unit=None, getpt=None, antenna=None):
    1515        """
    1616        Create a scantable from a saved one or make a reference
     
    3939        if getpt is None:
    4040            getpt = True
     41        if antenna is None:
     42            antenna = ''
     43        elif type(antenna) == int:
     44            antenna = '%s'%antenna
     45        elif type(antenna) == list:
     46            tmpstr = ''
     47            for i in range( len(antenna) ):
     48                if type(antenna[i]) == int:
     49                    tmpstr = tmpstr + ('%s,'%(antenna[i]))
     50                elif type(antenna[i]) == str:
     51                    tmpstr=tmpstr+antenna[i]+','
     52                else:
     53                    asaplog.push('Bad antenna selection.')
     54                    print_log('ERROR')
     55                    return
     56            antenna = tmpstr.rstrip(',')
    4157        varlist = vars()
    4258        from asap._asap import stmath
     
    8096                            raise IOError(msg)
    8197                else:
    82                     self._fill([filename], unit, average, getpt)
     98                    self._fill([filename], unit, average, getpt, antenna)
    8399            elif (isinstance(filename, list) or isinstance(filename, tuple)) \
    84100                  and isinstance(filename[-1], str):
    85                 self._fill(filename, unit, average, getpt)
     101                self._fill(filename, unit, average, getpt, antenna)
    86102        self._add_history("scantable", varlist)
    87103        print_log()
     
    21642180        return (sum(nchans)/len(nchans) == nchans[0])
    21652181
    2166     def _fill(self, names, unit, average, getpt):
     2182    def _fill(self, names, unit, average, getpt, antenna):
    21672183        import os
    21682184        from asap._asap import stfiller
     
    21922208            asaplog.push(msg, False)
    21932209            print_log()
    2194             r._open(name, -1, -1, getpt)
     2210            r._open(name, antenna, -1, -1, getpt)
    21952211            r._read()
    21962212            if average:
Note: See TracChangeset for help on using the changeset viewer.