Changeset 2419 for trunk


Ignore:
Timestamp:
03/01/12 03:51:53 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2816

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Added function to plot integrated data for specified channel range.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapgrid.py

    r2397 r2419  
    287287        else:
    288288            opt = 'pol %s'%(pol)
    289         if chan < 0:
     289        if type(chan) is list:
     290            opt += ', averaged over channel %s-%s'%(chan[0],chan[1])
     291        elif chan < 0:
    290292            opt += ', averaged over channel'
    291293        else:
     
    359361
    360362    def getData( self, chan=-1, pol=-1 ):
    361         if chan == -1:
     363        if type(chan) == list:
     364            spectra = self.__chanAverage(start=chan[0],end=chan[1])
     365        elif chan == -1:
    362366            spectra = self.__chanAverage()
    363367        else:
     
    370374        return retval
    371375
    372     def __chanAverage( self ):
     376    def __chanAverage( self, start=-1, end=-1 ):
    373377        s = scantable( self.outfile, average=False )
    374378        nrow = s.nrow()
     
    376380        irow = 0
    377381        sp = [0 for i in xrange(self.nchan)]
     382        if start < 0:
     383            start = 0
     384        if end < 0:
     385            end = self.nchan
    378386        for i in xrange(nrow/self.npol):
    379387            for ip in xrange(self.npol):
    380                 sp = s._getspectrum( irow )
     388                sp = s._getspectrum( irow )[start:end]
    381389                spectra[ip,i] = numpy.mean( sp )
    382390                irow += 1
     391           
    383392        return spectra
    384393
Note: See TracChangeset for help on using the changeset viewer.