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

Home » Public Forums » archive » hist_nd question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
hist_nd question [message #52936] Mon, 05 March 2007 07:17
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Hi all,

I have been using JD's hist_nd before, but I just found something
strange. Maybe this is already corrected somewhere or maybe this is a
"feature", but N-dimensional points falling outside of the given
min/max boundries, are mapped to the first and the last bin. To
clarify:

IDL> ha=hist_nd([[0,1,0],[2,0,1],[3,2,2],[0,1,1],[-1,0,0]],
Min=[0,0,0], Max=[2,2,2],1) & print,ha
1* 0 0
1 0 0
0 0 0

0 0 1
1 0 0
0 0 0

0 0 0
0 0 0
0 0 0

The 1* must be 0.

The fix is simple: change two lines.

h=(nbins[s[0]-1]-1)<long((V[s[0]-1,*]-mn[s[0]-1])/bs[s[0]-1]) >0L
=>
h=nbins[s[0]-1]<long((V[s[0]-1,*]-mn[s[0]-1])/bs[s[0]-1])>-1L

h=nbins[i]*h+((nbins[i]-1)<long((V[i,*]-mn[i])/bs[i])>0L)
=>
h=nbins[i]*h+(nbins[i]<long((V[i,*]-mn[i])/bs[i])>-1L)



But since this function was written be JD and presented on Fanning's
website, I obviously started doubting myself :-). Hence the question:
is this a bug or a feature? And by changing these two lines, are there
negative consequences which I overlooked?
[Message index]
 
Read Message
Previous Topic: Re: !p.multi[0] = ? What's the first element of !p.multi ?
Next Topic: field plot

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

Current Time: Sat Oct 11 19:12:57 PDT 2025

Total time taken to generate the page: 0.87989 seconds