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

Home » Public Forums » archive » binning a point clouds in the xy plane
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: binning a point clouds in the xy plane [message #87015 is a reply to message #87014] Thu, 19 December 2013 16:20 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nafiseh M writes:

> Thanks a lot,
>
> it is really a brilliant idea. :)
>
> I have just problem with cgReverseIndices to find indices of avg z values.
>
> here is the code;
>
> readcol, 'sampledata.txt', x, y, z
>
> hist_xy=hist_nd(transpose([[x],[y]]),[0.05,0.05],$
> min=[min(x),min(y)],max=[max(x),max(y)],reverse_indices=ri)
>
> avg_hist_xyz=make_array(size(hist_xy,/DIMENSIONS),VALUE=!VAL UES.F_NAN)
>
> for j=0,n_elements(hist_xy)-1 do if ri[j+1] gt ri[j] then $
> avg_hist_xyz[j]=mean(z[ri[ri[j]:ri[j+1]-1]])
>
> ;;;;;;;;;;;;;;; I am not sure how to use correctly "cgReverseIndices"
>
> help, indicesz ?????

I would use it like this:

for j=0,n_elements(hist_xy)-1 do begin
indicesz = cgReverseIndices(ri, j, COUNT=cnt)
if cnt gt 0 then avg_hist[j] = Median(z[indicesz])
endfor

I would use Median rather than Mean so I wasn't being confused by
outliers, but you should decide what is best for you.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bar plotting in IDL
Next Topic: Color bar colors not matching Image colors

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

Current Time: Sat Oct 11 08:22:17 PDT 2025

Total time taken to generate the page: 0.88017 seconds