Ignore:
Timestamp:
10/18/12 18:36:25 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-4429

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...

Implemented gauss and gjinc gridding. Added some arguments to
pass necessary parameters for those grid functions.

Also, defined helper function that plots current grid function
against radius in pixel.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapgrid.py

    r2669 r2671  
    135135        self.gridder._defineimage( nx, ny, cellx, celly, center )
    136136
    137     def setFunc( self, func='box', width=-1 ):
     137    def setFunc( self, func='box', width=-1, gwidth="", jwidth="" ):
    138138        """
    139139        Set convolution function. Possible options are 'box' (Box-car,
     
    151151                 choose pre-defined value for each convolution function.
    152152        """
    153         self.gridder._setfunc( func, width )
     153        fname = func.upper()
     154        if fname == 'GAUSS' or fname == 'GJINC':
     155            gw = str(gwidth)
     156            jw = str(jwidth)
     157            w = str(width)
     158            if w[0] == '-': w = ''
     159            #self.gridder._setfunc(fname, -1, w, gw, jw)
     160            self.gridder._setfunc(fname,convsupport=-1,gwidth=gw,jwidth=jw,truncate=w)
     161        else:
     162            self.gridder._setfunc( func, convsupport=width )
    154163
    155164    def setWeight( self, weightType='uniform' ):
     
    223232        asaplog.push('plot: elapsed time %s sec'%(t1-t0))
    224233        asaplog.post('DEBUG','asapgrid.plot')
     234
     235    def plotFunc(self, clear=True):
     236        """
     237        Support function to see the shape of current grid function.
     238
     239        clear -- clear panel if True. Default is True.
     240        """
     241        pl.figure(11)
     242        if clear:
     243            pl.clf()
     244        f = self.gridder._getfunc()
     245        convsampling = 100
     246        a = numpy.arange(0,len(f)/convsampling,1./convsampling,dtype=float)
     247        pl.plot(a,f,'.-')
     248        pl.xlabel('pixel')
     249        pl.ylabel('convFunc')
    225250       
    226251class asapgrid2:
     
    367392                 choose pre-defined value for each convolution function.
    368393        """
    369         self.gridder._setfunc( func, width )
     394        fname = func.upper()
     395        if fname == 'GAUSS' or fname == 'GJINC':
     396            gw = str(gwidth)
     397            jw = str(jwidth)
     398            w = str(width)
     399            if w[0] == '-': w = ''
     400            #self.gridder._setfunc(fname, -1, w, gw, jw)
     401            self.gridder._setfunc(fname,convsupport=-1,gwidth=gw,jwidth=jw,truncate=w)
     402        else:
     403            self.gridder._setfunc( func, convsupport=width )
    370404
    371405    def setWeight( self, weightType='uniform' ):
     
    408442        tp = 0 if rcParams['scantable.storage']=='memory' else 1
    409443        return scantable( self.gridder._get( tp ), average=False )
     444   
     445    def plotFunc(self, clear=True):
     446        """
     447        Support function to see the shape of current grid function.
     448
     449        clear -- clear panel if True. Default is True.
     450        """
     451        pl.figure(11)
     452        if clear:
     453            pl.clf()
     454        f = self.gridder._getfunc()
     455        convsampling = 100
     456        a = numpy.arange(0,len(f)/convsampling,1./convsampling,dtype=float)
     457        pl.plot(a,f,'.-')
     458        pl.xlabel('pixel')
     459        pl.ylabel('convFunc')
    410460
    411461class _SDGridPlotter:
Note: See TracChangeset for help on using the changeset viewer.