Changeset 2678 for trunk


Ignore:
Timestamp:
10/23/12 13:59:36 (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...

Added new parameter to asapgrid.setFunc(). Also, default behavior
of STGrid is changed.


Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapgrid.py

    r2671 r2678  
    135135        self.gridder._defineimage( nx, ny, cellx, celly, center )
    136136
    137     def setFunc( self, func='box', width=-1, gwidth="", jwidth="" ):
     137    def setFunc( self, func='box', convsupport=-1, truncate="-1", gwidth="-1", jwidth="-1" ):
    138138        """
    139139        Set convolution function. Possible options are 'box' (Box-car,
     
    151151                 choose pre-defined value for each convolution function.
    152152        """
    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 )
     153        self.gridder._setfunc(func,
     154                              convsupport=convsupport,
     155                              truncate=truncate,
     156                              gwidth=gwidth,
     157                              jwidth=jwidth)
     158##         fname = func.upper()
     159##         if fname == 'GAUSS' or fname == 'GJINC':
     160##             gw = str(gwidth)
     161##             jw = str(jwidth)
     162##             w = str(width)
     163##             #if len(w) > 0 and w[0] == '-':
     164##             #    w = ''
     165##             #self.gridder._setfunc(fname, -1, w, gw, jw)
     166##             self.gridder._setfunc(fname,convsupport=-1,gwidth=gw,jwidth=jw,truncate=w)
     167##         else:
     168##             #if isinstance(width,str):
     169##             #    w = -1
     170##             #else:
     171##             #    w = width
     172##             self.gridder._setfunc( func, convsupport=width )
    163173
    164174    def setWeight( self, weightType='uniform' ):
  • trunk/src/STGrid.cpp

    r2675 r2678  
    469469  }
    470470  else {
    471     os << "      support = " << convSupport_ << endl;
     471    os << "      support = " << userSupport_ << endl;
    472472  }
    473473  os << "   doclip = " << (doclip_?"True":"False") << endl ;
     
    17891789    // determine pixel gwidth
    17901790    // default is HWHM corresponding to b = 1.0 (Mangum et al. 2007)
    1791     Double pixelGW = sqrt(log(2.0));
     1791    Double pixelGW;
    17921792    Quantum<Double> q ;
    17931793    if (!gwidth_.empty()) {
     
    18001800      }
    18011801    }
     1802    pixelGW = (pixelGW >= 0.0) ? pixelGW : sqrt(log(2.0));
     1803    if (pixelGW < 0.0) {
     1804      os << LogIO::SEVERE
     1805         << "Negative width is specified for gaussian" << LogIO::EXCEPTION;
     1806    }
    18021807    // determine truncation radius
    18031808    // default is 3 * HWHM
    1804     Double truncate = 3.0 * pixelGW;
     1809    Double truncate;
    18051810    if (!truncate_.empty()) {
    18061811      readQuantity( q, truncate_ );
     
    18131818    }     
    18141819    //convSupport_ = (Int)(truncate+0.5);
    1815     convSupport_ = (Int)(truncate);
     1820    truncate = (truncate >= 0.0) ? truncate : 3.0 * pixelGW;
     1821    convSupport_ = Int(truncate);
    18161822    convSupport_ += (((truncate-(Double)convSupport_) > 0.0) ? 1 : 0);
    18171823    Int convSize = convSampling_ * ( 2*convSupport_ + 2 ) ;
     
    18271833    // determine pixel gwidth
    18281834    // default is HWHM corresponding to b = 2.52 (Mangum et al. 2007)
    1829     Double pixelGW = sqrt(log(2.0)) * 2.52;
     1835    Double pixelGW;
    18301836    Quantum<Double> q ;
    18311837    if (!gwidth_.empty()) {
     
    18381844      }
    18391845    }
     1846    pixelGW = (pixelGW >= 0.0) ? pixelGW : sqrt(log(2.0)) * 2.52;
     1847    if (pixelGW < 0.0) {
     1848      os << LogIO::SEVERE
     1849         << "Negative width is specified for gaussian" << LogIO::EXCEPTION;
     1850    }
    18401851    // determine pixel c
    18411852    // default is c = 1.55 (Mangum et al. 2007)
    1842     Double pixelJW = 1.55;
     1853    Double pixelJW;
    18431854    if (!jwidth_.empty()) {
    18441855      readQuantity( q, jwidth_ );
     
    18491860        pixelJW = q.getValue("rad")/celly_;
    18501861      }
    1851     }     
     1862    }
     1863    pixelJW = (pixelJW >= 0.0) ? pixelJW : 1.55;
     1864    if (pixelJW < 0.0) {
     1865      os << LogIO::SEVERE
     1866         << "Negative width is specified for jinc" << LogIO::EXCEPTION;
     1867    }
    18521868    // determine truncation radius
    18531869    // default is -1.0 (truncate at first null)
Note: See TracChangeset for help on using the changeset viewer.