Ignore:
Timestamp:
12/09/05 14:50:59 (18 years ago)
Author:
mar637
Message:

update from Release12

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r780 r794  
    226226                    raise IOError(msg)
    227227        if rcParams['verbose']:
    228             print info
     228            try:
     229                from IPython.genutils import page as pager
     230            except ImportError:
     231                from pydoc import pager
     232            pager(info)
    229233        else:
    230234            return info
     
    429433    def get_sourcename(self, row=-1):
    430434        """
    431         Get a list source anmes for the observations.
     435        Get a list source names for the observations.
    432436        Return a string for each integration in the scantable.
    433437        Parameters:
     
    442446            if  0 <= row < self.nrow():
    443447                return self._getsourcename(row)
     448
     449    def get_elevation(self, row=-1):
     450        """
     451        Get a list of elevations for the observations.
     452        Return a float for each integration in the scantable.
     453        Parameters:
     454            row:    row no of integration. Default -1 return all rows
     455        Example:
     456            none
     457        """
     458        out = []
     459        if row == -1:
     460            return [self._getelevation(i) for i in range(self.nrow())]
     461        else:
     462            if  0 <= row < self.nrow():
     463                return self._getelevation(row)
     464
     465    def get_azimuth(self, row=-1):
     466        """
     467        Get a list of azimuths for the observations.
     468        Return a float for each integration in the scantable.
     469        Parameters:
     470            row:    row no of integration. Default -1 return all rows
     471        Example:
     472            none
     473        """
     474        out = []
     475        if row == -1:
     476            return [self._getazimuth(i) for i in range(self.nrow())]
     477        else:
     478            if  0 <= row < self.nrow():
     479                return self._getazimuth(row)
     480
     481    def get_parangle(self, row=-1):
     482        """
     483        Get a list of parallactic angles for the observations.
     484        Return a float for each integration in the scantable.
     485        Parameters:
     486            row:    row no of integration. Default -1 return all rows
     487        Example:
     488            none
     489        """
     490        out = []
     491        if row == -1:
     492            return [self._getparangle(i) for i in range(self.nrow())]
     493        else:
     494            if  0 <= row < self.nrow():
     495                return self._getparangle(row)
    444496
    445497    def set_unit(self, unit='channel'):
     
    717769    def history(self):
    718770        hist = list(self._gethistory())
    719         print "-"*80
     771        out = "-"*80
    720772        for h in hist:
    721773            if h.startswith("---"):
    722                 print h
     774                out += "\n"+h
    723775            else:
    724776                items = h.split("##")
     
    726778                func = items[1]
    727779                items = items[2:]
    728                 print date
    729                 print "Function: %s\n  Parameters:" % (func)
     780                out += "\n"+date+"\n"
     781                out += "Function: %s\n  Parameters:" % (func)
    730782                for i in items:
    731783                    s = i.split("=")
    732                     print "   %s = %s" % (s[0],s[1])
    733                 print "-"*80
     784                    out += "\n   %s = %s" % (s[0],s[1])
     785                out += "\n"+"-"*80
     786        try:
     787            from IPython.genutils import page as pager
     788        except ImportError:
     789            from pydoc import pager
     790        pager(out)
    734791        return
    735792
     
    10551112            return
    10561113
    1057     def poly_baseline(self, mask=None, order=0, insitu=None):
     1114    def poly_baseline(self, mask=None, order=0, insitu=None, allaxes=None):
    10581115        """
    10591116        Return a scan which has been baselined (all rows) by a polynomial.
    10601117        Parameters:
    1061             scan:    a scantable
    1062             mask:    an optional mask
    1063             order:   the order of the polynomial (default is 0)
    1064             insitu:      if False a new scantable is returned.
    1065                          Otherwise, the scaling is done in-situ
    1066                          The default is taken from .asaprc (False)
     1118            scan:       a scantable
     1119            mask:       an optional mask
     1120            order:      the order of the polynomial (default is 0)
     1121            insitu:     if False a new scantable is returned.
     1122                        Otherwise, the scaling is done in-situ
     1123                        The default is taken from .asaprc (False)
     1124            allaxes:    If True (default) apply to all spectra. Otherwise
     1125                        apply only to the selected (beam/pol/if)spectra only
     1126                        The default is taken from .asaprc (True if none)
    10671127        Example:
    10681128            # return a scan baselined by a third order polynomial,
     
    10701130            bscan = scan.poly_baseline(order=3)
    10711131        """
     1132        if allaxes is None: allaxes = rcParams['scantable.allaxes']
    10721133        if insitu is None: insitu = rcParams['insitu']
    10731134        varlist = vars()
     
    10791140        f.set_scan(self, mask)
    10801141        f.set_function(poly=order)
    1081         sf = f.auto_fit(insitu)
     1142        sf = f.auto_fit(insitu,allaxes)
    10821143        if insitu:
    10831144            self._add_history("poly_baseline", varlist)
     
    12911352            refs = self.get_scan("*[_ewR]")
    12921353            if isinstance(srcs,scantable) and isinstance(refs,scantable):
     1354                from asap import asaplog
    12931355                ns,nr = srcs.nrow(),refs.nrow()
     1356                msg = "Found %i Off and %i On scans" % (ns,nr)
     1357                asaplog.push(msg)
    12941358                if nr > ns:
     1359                    asaplog("Found more Off integrations than On scans - dropping excess Offs.")
    12951360                    refs = refs.get_scan(range(ns))
    12961361                print_log()
Note: See TracChangeset for help on using the changeset viewer.