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

Home » Public Forums » archive » Simple? problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Simple? problem [message #30081] Tue, 09 April 2002 08:49 Go to previous message
Ivan Valtchanov is currently offline  Ivan Valtchanov
Messages: 8
Registered: April 2002
Junior Member
Hi,

I have a small problem concerning a good programming techniques, so here it is:
----------------------
pro test,nx,ny,image

; Make some random X and Y arrays
x = randomu(s,1000)
y = randomu(s,1000)

; now give arbitrary weights for each point
w = randomu(s,1000)/100.0
; take the square
w2=2.0*w*w

; I want to construct a 2-D image with a specified dimension
image = fltarr(nx,ny)

; I want to sum up the contribution of each point as Gaussian
; with width=w to the image pixels

for i=0, nx-1 do begin
xgi = i/float(nx)
dx = x-xgi
for j=0, ny-1 do begin
ygi = j/float(ny)
dy = y-ygi
dr2 = dx*dx+dy*dy
arg = -dr2/w2 > (-20.0) ; to avoid overflows
image[i,j] = total(exp(arg))
endfor
endfor

return
end
---------------------------

This is obviously quite unoptimised - two cycles etc. Do you have any ideas, references or do you know if it is already solved in IDL?

I have looked for something similar in David Fanning pages and IDL astronomical libraries but I couldn't find something to adapt, maybe I have missed it?

Thanks.

Ivan V.
[Message index]
 
Read Message
Read Message
Previous Topic: sec : U Re: Ascertaining Keyword Parameters
Next Topic: Re: Where is "Pause" function?

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

Current Time: Wed Oct 08 17:49:01 PDT 2025

Total time taken to generate the page: 0.05829 seconds