Changeset 2391 for trunk


Ignore:
Timestamp:
12/28/11 19:58:50 (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 documentation of toolkit level.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapgrid.py

    r2390 r2391  
    88
    99class asapgrid:
     10    """
     11    The asapgrid class is defined to convolve data onto regular
     12    spatial grid. Typical usage is as follows:
     13
     14       # create asapgrid instance with two input data
     15       g = asapgrid( ['testimage1.asap','testimage2.asap'] )
     16       # set IFNO if necessary
     17       g.setIF( 0 )
     18       # set POLNOs if necessary
     19       g.setPolList( [0,1] )
     20       # set SCANNOs if necessary
     21       g.setScanList( [22,23,24] )
     22       # define image with full specification
     23       # you can skip some parameters (see help for defineImage)
     24       g.defineImage( nx=12, ny=12, cellx='10arcsec', celly='10arcsec',
     25                      center='J2000 10h10m10s -5d05m05s' )
     26       # set convolution function
     27       g.setFunc( func='sf', width=3 )
     28       # actual gridding
     29       g.grid()
     30       # save result
     31       g.save( outfile='grid.asap' )
     32       # plot result
     33       g.plot( plotchan=1246, plotpol=-1, plotgrid=True, plotobs=True )
     34    """
    1035    def __init__( self, infile ):
     36        """
     37        Create asapgrid instance.
     38
     39        infile -- input data as a string or string list if you want
     40                  to grid more than one data at once. 
     41        """
    1142        self.outfile = None
    1243        self.ifno = None
     
    1546
    1647    def setData( self, infile ):
     48        """
     49        Set data to be processed.
     50
     51        infile -- input data as a string or string list if you want
     52                  to grid more than one data at once. 
     53        """
    1754        if isinstance( infile, str ):
    1855            self.gridder._setin( infile )
     
    2259
    2360    def setIF( self, ifno ):
     61        """
     62        Set IFNO to be processed. Currently, asapgrid allows to process
     63        only one IFNO for one gridding run even if the data contains
     64        multiple IFs. If you didn't specify IFNO, default value, which
     65        is IFNO in the first spectrum, will be processed.
     66
     67        ifno -- IFNO to be processed.
     68        """
    2469        self.ifno = ifno
    2570        self.gridder._setif( self.ifno )
    2671
    2772    def setPolList( self, pollist ):
     73        """
     74        Set list of polarization components you want to process.
     75        If not specified, all POLNOs will be processed.
     76
     77        pollist -- list of POLNOs.
     78        """
    2879        self.gridder._setpollist( pollist )
    2980
    3081    def setScanList( self, scanlist ):
     82        """
     83        Set list of scans you want to process. If not specified, all
     84        scans will be processed.
     85
     86        scanlist -- list of SCANNOs.
     87        """
    3188        self.gridder._setscanlist( scanlist )
    3289
    3390    def defineImage( self, nx=-1, ny=-1, cellx='', celly='', center='' ):
     91        """
     92        Define spatial grid.
     93
     94        First two parameters, nx and ny, define number of pixels of
     95        the grid. If which of those is not specified, it will be set
     96        to the same value as the other. If none of them are specified,
     97        it will be determined from map extent and cell size.
     98
     99        Next two parameters, cellx and celly, define size of pixel.
     100        You should set those parameters as string, which is constructed
     101        numerical value and unit, e.g. '0.5arcmin', or numerical value.
     102        If those values are specified as numerical value, their units
     103        will be assumed to 'arcmin'. If which of those is not specified,
     104        it will be set to the same value as the other. If none of them
     105        are specified, it will be determined from map extent and number
     106        of pixels, or set to '1arcmin' if neither nx nor ny is set.
     107
     108        The last parameter, center, define the central coordinate of
     109        the grid. You should specify its value as a string, like,
     110
     111           'J2000 05h08m50s -16d23m30s'
     112
     113        or
     114
     115           'J2000 05:08:50 -16.23.30'
     116
     117        You can omit equinox when you specify center coordinate. In that
     118        case, J2000 is assumed. If center is not specified, it will be
     119        determined from the observed positions of input data.
     120
     121        nx -- number of pixels along x (R.A.) direction.
     122        ny -- number of pixels along y (Dec.) direction.
     123        cellx -- size of pixel in x (R.A.) direction.
     124        celly -- size of pixel in y (Dec.) direction.
     125        center -- central position of the grid.
     126        """
     127        if not isinstance( cellx, str ):
     128            cellx = '%sarcmin'%(cellx)
     129        if not isinstance( celly, str ):
     130            celly = '%sarcmin'%(celly)
    34131        self.gridder._defineimage( nx, ny, cellx, celly, center )
    35132
    36133    def setFunc( self, func='box', width=-1 ):
     134        """
     135        Set convolution function. Possible options are 'box' (Box-car,
     136        default), 'sf' (prolate spheroidal), and 'gauss' (Gaussian).
     137        Width of convolution function can be set using width parameter.
     138        By default (-1), width is automatically set depending on each
     139        convolution function. Default values for width are:
     140
     141           'box': 1 pixel
     142           'sf': 3 pixels
     143           'gauss': 3 pixels (width is used as HWHM)
     144
     145        func -- Function type ('box', 'sf', 'gauss').
     146        width -- Width of convolution function. Default (-1) is to
     147                 choose pre-defined value for each convolution function.
     148        """
    37149        self.gridder._setfunc( func, width )
    38150
    39151    def setWeight( self, weightType='uniform' ):
     152        """
     153        Set weight type. Possible options are 'uniform' (default),
     154        'tint' (weight by integration time), 'tsys' (weight by
     155        Tsys: 1/Tsys**2), and 'tintsys' (weight by integration time
     156        as well as Tsys: tint/Tsys**2).
     157
     158        weightType -- weight type ('uniform', 'tint', 'tsys', 'tintsys')
     159        """
    40160        self.gridder._setweight( weightType )
    41161
    42162    def grid( self ):
     163        """
     164        Actual gridding which will be done based on several user inputs.
     165        """
    43166        self.gridder._grid()
    44167
    45168    def save( self, outfile='' ):
     169        """
     170        Save result. By default, output data name will be constructed
     171        from first element of input data name list (e.g. 'input.asap.grid').
     172
     173        outfile -- output data name.
     174        """
    46175        self.outfile = self.gridder._save( outfile )
    47176
    48177    def plot( self, plotchan=-1, plotpol=-1, plotobs=False, plotgrid=False ):
     178        """
     179        Plot gridded data.
     180
     181        plotchan -- Which channel you want to plot. Default (-1) is
     182                    to average all the channels.
     183        plotpol -- Which polarization component you want to plot.
     184                   Default (-1) is to average all the polarization
     185                   components.
     186        plotobs -- Also plot observed position if True. Default
     187                   is False. Setting True for large amount of spectra
     188                   might be time consuming.
     189        plotgrid -- Also plot grid center if True. Default is False.
     190                    Setting True for large number of grids might be
     191                    time consuming.
     192        """
    49193        import time
    50194        t0=time.time()
Note: See TracChangeset for help on using the changeset viewer.