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

Home » Public Forums » archive » DIST Function - 3D
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
DIST Function - 3D [message #92624] Tue, 26 January 2016 07:06 Go to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hi

I wanted to create a 3D array [x,y,t] that when display it I'll see something not simple black images. I found the DIST() function but unfortunately I cannot use it to make a 3D array.

Can anyone help with this?

Thanks!
Re: DIST Function - 3D [message #92629 is a reply to message #92624] Wed, 27 January 2016 01:57 Go to previous messageGo to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den tisdag 26 januari 2016 kl. 16:06:18 UTC+1 skrev g.na...@gmail.com:
> Hi
>
> I wanted to create a 3D array [x,y,t] that when display it I'll see something not simple black images. I found the DIST() function but unfortunately I cannot use it to make a 3D array.
>
> Can anyone help with this?
>
> Thanks!

a=randomn(seed,100,100,10)
Re: DIST Function - 3D [message #92632 is a reply to message #92624] Wed, 27 January 2016 07:33 Go to previous messageGo to next message
d.rowenhorst@gmail.co is currently offline  d.rowenhorst@gmail.co
Messages: 10
Registered: August 2008
Junior Member
On Tuesday, January 26, 2016 at 10:06:18 AM UTC-5, g.na...@gmail.com wrote:
> Hi
>
> I wanted to create a 3D array [x,y,t] that when display it I'll see something not simple black images. I found the DIST() function but unfortunately I cannot use it to make a 3D array.
>
> Can anyone help with this?
>
> Thanks!

FUNCTION Dist_3d,n,m,l , calib=calib ;Return a 3d array in which each pixel = euclidian
;distance from the origin.
COMPILE_OPT idl2

On_error,2 ;Return to caller if an error occurs

IF Keyword_set(calib) NE 1 THEN calib = [1,1,1.]
IF N_elements(calib) NE 3 THEN cailb=[1,1,1.]

c0 = calib[0]*calib[0]
c1 = calib[1]*calib[1]
c2 = calib[2]*calib[2]

n1 = n[0]
m1 = (N_elements(m) LE 0) ? n1 : m[0]
l1 = (N_elements(m) LE 0) ? n1 : l[0]
x=Findgen(n1) ;Make a row
x = ((x < (n1-x)) ^ 2)*c0 ;column squares

a = Reform(Fltarr(n1,m1,l1,/NOZERO),n1,m1,l1) ;Make array

FOR i=0L, m1/2 DO BEGIN ;Row loop
y = (x + (i^2.)*c1) ;Euclidian distance
a[*,i,0] = y ;Insert the row
IF i NE 0 THEN a[*, m1-i, 0] = y ;Symmetrical
ENDFOR

x = a[*,*,0]

FOR i=0L, l1/2 DO BEGIN ;Stack loop
z = (x + (i^2.)*c2) ;Euclidian distance
a[*,*,i] = z ;Insert the row
IF i NE 0 THEN a[*, *,l1-i] = z ;Symmetrical
ENDFOR

a = Sqrt(Temporary(a))

Return,a
END
Re: DIST Function - 3D [message #92634 is a reply to message #92624] Wed, 27 January 2016 08:42 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mardi 26 janvier 2016 16:06:18 UTC+1, g.na...@gmail.com a écrit :
> Hi
>
> I wanted to create a 3D array [x,y,t] that when display it I'll see something not simple black images. I found the DIST() function but unfortunately I cannot use it to make a 3D array.
>
> Can anyone help with this?
>
> Thanks!

Maybe, by this:

function dist_3D, nx, ny, nz
x = [rebin(dindgen(1,nx), 1, nx, ny, nz), $
rebin(dindgen(1,1,ny), 1, nx, ny, nz), $
rebin(dindgen(1,1,1,nz), 1, nx, ny, nz)]
return, sqrt(total(x^2, 1))
end

alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Using histogram (or cghistogram) to get top X percent of distribution?
Next Topic: IDL new graphics mapping issue

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

Current Time: Wed Oct 08 09:19:08 PDT 2025

Total time taken to generate the page: 0.00459 seconds