Changeset 714 for trunk/python


Ignore:
Timestamp:
11/17/05 14:33:03 (19 years ago)
Author:
mar637
Message:

updated logging; added public get_sourcename

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r710 r714  
    11from asap._asap import sdtable
    22from asap import rcParams
     3from asap import print_log
    34from numarray import ones,zeros
    45import sys
     
    6364                beamSel = -1
    6465                r = sdreader()
    65                 r._setlog(asaplog)
    6666                r._open(filename,ifSel,beamSel)
    6767                asaplog.push('Importing data...')
     
    8080                del r,tbl
    8181                self._add_history("scantable", varlist)
    82                 log = asaplog.pop()
    83                 if len(log): print log
     82        print_log()
    8483
    8584    def save(self, name=None, format=None, stokes=False, overwrite=False):
     
    397396                return self._gettime(row)
    398397
     398    def get_sourcename(self, row=-1):
     399        """
     400        Get a list source anmes for the observations.
     401        Return a string for each integration in the scantable.
     402        Parameters:
     403            row:    row no of integration. Default -1 return all rows
     404        Example:
     405            none
     406        """
     407        out = []
     408        if row == -1:
     409            return [self._getsourcename(i) for i in range(self.nrow())]
     410        else:
     411            if  0 <= row < self.nrow():
     412                return self._getsourcename(row)
     413
    399414    def set_unit(self, unit='channel'):
    400415        """
     
    558573        Print the list of known spectral lines
    559574        """
    560         sdtable._lines(self)
     575        l = sdtable._lines(self)
     576        if rcParams['verbose']:
     577            print l
     578        else:
     579            return l
    561580
    562581    def set_restfreqs(self, freqs=None, unit='Hz', lines=None, source=None,
     
    12851304        """
    12861305        modes = ["suffix","time"]
    1287         print mode
    12881306        if not mode in modes:
    12891307            print "please provide valid mode. Valid modes are %s" % (modes)
     
    14761494            i = j
    14771495        return segments
     1496
    14781497    def _get_ordinate_label(self):
    14791498        fu = "("+self.get_fluxunit()+")"
Note: See TracChangeset for help on using the changeset viewer.