POINT_CONVOLVE
Name
POINT_CONVOLVE
Purpose
Convolves a list of N-dimensional points with a Gaussian kernel.
Category
Math
Calling Sequence
Result = POINT_CONVOLVE()
Keyword Parameters
POINTS: Array of MxN points for M dimensions and N particles (required).
BINSIZE: Bin sizes for final output grid. Either a scalar or an
array of length M. (required)
RANGE: Array of Mx2, containning the extent of output grid
in each dimension. (required)
SIGMA: Width of Gaussian kernel. May either be a scalar that is
applied to all dimensions, an array of length M for
different widths in each dimension, OR an MxN array
containing a separate width for each particle and
dimension (this option uses manual summation as if
/NOCONVOL were set, and is therefore much slower).
(required)
WEIGHT: An array of length N containing the weight to assign to
each point. A weight of 1 (default) corresponds to a Gaussian
normalized such that its integral over the entire M-dimensional
space is unity.
CUTOFF: Assume that the kernel may be safely truncated after this many
SIGMAs. Default: 8 (corresponding to a dynmical range of 7.9e13).
NOCONVOL: If /NOCONVOL is set than use manual summation rather than an FFT.
NOFFT: If /NOFFT is set then use the built-in CONVOL routine rather
than an FFT.
Outputs
An grid containing the output density field. Each dimension i in the output
grid has length (RANGE[i,1]-RANGE[i,0])/BINSIZE[i]. Returns -1 on error.
Procedure
By default, this function uses an FFT and the convolution theorem.
If /NOFFT is set, then it uses the built-in CONVOL function. If
either /NOCONVOL is set or SIGMA is an MxN array, then it uses
manual summation.
Example
xpos = 10.*RANDOMU(seed,100)
ypos = 20.*RANDOMU(seed,100)
density = POINT_CONVOLVE(POINTS=TRANSPOSE([[xpos],[ypos]]),
BINSIZE=1., RANGE=[[0.,0.], [10.,20.]], SIGMA=[2.,4.])
Modification History
Written by: Jeremy Bailin
12 June 2008 Public release in JBIU
15 Apr 2008 Fixed off-by-one bug and improved memory usage