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

Home » Public Forums » archive » Re: Help: Plotting 3d data as 2d intensity map or histogram
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Help: Plotting 3d data as 2d intensity map or histogram [message #41423 is a reply to message #41419] Fri, 22 October 2004 08:32 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Gianguido wrote:
> Hi everyone,
>
> here's my problem:
> I have an 3 x N array. the 3 cols represent r,t and F(r,t). I don't
> know what the function F is I just have some noisy data to fill the
> matrix.
>
> I would like to compute a 2d image where the intensity of each pixel
> is proportional to the average value of F(r,t) and where the
> coordinates of the pixel in question is related to the value of r and
> t.
>
> I have two further points:
>
> 1) r and t are continuous so I would like to create bins along the
> axes
> 2) within a given bin (or a given r and t range) F(r,t) can have
> different values, so I need to compute the average of F over the bin.
>

Two functions will help you here (for IDL 5.5+) GRID_INPUT will handle
duplicates in a variety of ways (including average). If you are OK with
interpolating from there, use GRIDDATA to manufacture the 2D 'image'.

If you don't want to interpolate across 'empty' cells, but would rather
'sprinkle' your data onto the image - then you will need to translate your r and
t data pairs into 'image coordinates'. I think something like the following
(kind of thinking out loud here, I have not tried this in a long time)...

nX = imageXSize ;these are based on what resolution you
ny = imageYSize ;need in r and t space
data = MAKE_ARRAY(nx,ny, VALUE = !VALUES.F_NAN)
count = LonArr(nx,ny)

;normalize r and t - then scale up to image coordinates
rValues = (r - MIN(r))/(MAX(r)-MIN(r)) * (nX -1)
tValues = (t - MIN(t))/(MAX(t)-MIN(t)) * (nY -1)

;sprinkle the data onto the image
for i = 0L, n_elements(f)-1 Do Begin
data[rValues[i],tValues[i]] += f[i]
count[rValues[i],tValues[i]] += 1
EndFor

;find the mean of the data
;you could skip this part if you first filtered the data
;using GRID_INPUT with DUPLICATES = 'AVG'
;in which caase data already holds the mean values
data[rValues,tValues] /= count[rValues,tValues]


>
> PS: this group seems more active than the "plain" lang.idl. what is
> the difference between idl and idl-pvwave?

I think the .idl group works with "Interface Definition Language" while
idl-pvwave is for IDL and PVWAVE (and David Fanning's tennis game.) The .idl
groupies might be quieter? Perhaps they are Yankees fans? I don't follow pro
sports, but I noticed my rabid Red-Sox-fan co-workers high-fiving and hugging
each other lately - they certainly aren't quiet.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CW_FORM: Can't seem to get SET_VALUE to work
Next Topic: Re: 2D histogram color plot

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

Current Time: Fri Dec 05 14:25:26 PST 2025

Total time taken to generate the page: 0.01480 seconds