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

Home » Public Forums » archive » Re: Number of points inside a contour curve
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: Number of points inside a contour curve [message #52031 is a reply to message #51944] Thu, 21 December 2006 07:38 Go to previous messageGo to previous message
burkina is currently offline  burkina
Messages: 32
Registered: February 2005
Member
On Dec 20, 3:58 pm, David Fanning <n...@dfanning.com> wrote:
> I note that HISTOGRAM_2D uses embedded FOR loops and that HIST_2D
> is written by JD Smith. That's enough for me. :-)

Ok, I'm using hist_2d. The results are similar, I was wrong...

> If you did a HISTOGRAM on the result of HIST_2D, then I should
> think you could find the level where a cumulative total of
> the HISTOGRAM result was 90% of the total (VALUE_LOCATE
> might be handy here). I'm mostly thinking out loud. There
> seem to be a few details missing here....But I think this
> might be a promising direction. :-)

Indeed, your suggestion to use histogram was good. However, I don't
need VALUE_LOCATE. This is how I solved the problem:

;density is the result from HIST_2D

maxvalue=max(density,maxpoint)
maxcoord=ARRAY_INDICES(density,maxpoint)
max_x=xmin+maxcoord[0]*xbinsize+xbinsize/2
max_y=ymin+maxcoord[1]*ybinsize+ybinsize/2
print, 'The maximum density is: ', maxvalue
print, 'It occurs at coordinates:'
print, max_x, max_y

tot_histo=total(density)
histoden=histogram(density)
n_histo=n_elements(histoden)
sum=0
k=0

while sum lt 0.9*tot_histo do begin

sum = sum + histoden[n_histo-1-k] * (maxvalue-k)
k = k+1

endwhile

maxlevel=histoden[n_histo-1-k] * (maxvalue-k)

contour, density, xabscissa,yabscissa,c_colors=fsc_color('red'),
levels=maxlevel, /overplot
xyouts, max_x, max_y, '+', /data, color=fsc_color('red')


Stefano
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: New Eclipse-based IDE
Next Topic: Re: ENVI: procedure to get X, Y of pixel in displayed image

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

Current Time: Fri Oct 10 04:05:57 PDT 2025

Total time taken to generate the page: 1.76277 seconds