comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Smoothing 3D array with periodic boundaries: what am I missing?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Smoothing 3D array with periodic boundaries: what am I missing? [message #68214] Thu, 24 September 2009 10:19
Luds is currently offline  Luds
Messages: 7
Registered: September 2009
Junior Member
I've been trying for a couple days now to write a Gaussian-smoothing
algorithm to smooth a cube of (scalar) data with periodic boundary
conditions (this is needed for my task since "structure" in the data
that straddles an edge of the cube appears on two+ sides of the box).
I've made it so far, but now can't seem to get around excessive For-
loop's...

For example, say the box of scalars values runs from (0,1) in x,y, and
z, and has N^3 points. To smooth at point (x,y,z) in the box I
generate a 3-D Gaussian with its centroid (mean) at point x,y,z:

Gauss_field = rebin(periodic_gauss_func(X,[[sig],[x]]),N,N,N) * $
rebin(reform(periodic_gauss_func(X,[[sig],[y]]),
1,N),N,N,N) * $
rebin(reform(periodic_gauss_func(X,[[sig],[z]]),
1,1,N),N,N,N)

where periodic_gauss_func is a 1-D Gaussian kernel function that wraps
around the box edge, X=(0,1,...N-1)... sig=sigma. (i.e. this just does
separate Gaussian smoothing along each direction and combines the
result).

Then the smoothed field at point (x,y,z) is something like

Smoothed(x,y,z) = TOTAL(TOTAL(scalar_field*Gauss_field,1))

What I can't figure out is an efficient way to do this for all (x,y,z)
- for a N=1024^3 grid it takes a couple seconds to generate
Gauss_field. Realistically, I'll have N=1024^3, so For-loops are
pretty much useless(???), and memory is a bit of an issue too.

Does anyone know of any "canned" routines to do this type of Gaussian
smoothing? Or of an efficient way to convolve my 3D Gaussian field
with my scalar field for all (x,y,z)? (I must stress that the Gaussian
kernel must not be affected by, or truncated at, the box edge)

Many thanks!!

Aaron
[Message index]
 
Read Message
Previous Topic: Optimization "AMOEBA"
Next Topic: Re: optimization; which point falls into a polygon

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 06:03:05 PDT 2025

Total time taken to generate the page: 0.00525 seconds