Number of points inside a contour curve [message #51947] |
Wed, 20 December 2006 01:38  |
burkina
Messages: 32 Registered: February 2005
|
Member |
|
|
What I need to do is basically simple, I guess, but I can't find an
easy way to do that.
I have an array of two parameters, let's call them x and y, each pair a
couple of measures taken simultaneously. I need to:
-Plot them in the x and y axis (at least this one is trivial!)
-Produce a density plot, i.e. divide the x-y space in discrete bins and
assign the number of points falling in each bin to that bin (This
should be done by hist_2D, but the results are fairly disappointing. A
better work is done by histogram_2d. Do you have any comments?)
-Plot confidence contour levels on that density plot, i.e. a contour at
the level where, say, 90% of points are contained. In other words, you
can use the normal contour IDL procedure, but you must find a way to
count all points lying inside this contour, in order to set the level
for the contour plot. The procedure should be able to find the
iso-count curve which encompass 90% of the total points.
So... I'm not sure I'm doing the right/best thing for point 2
(hist_2d/histogram_2d) and have no idea how to do point 3. However,
this problem seems to me quite common, because it's a way to find
statistical confidence level for a distribution of two parameters.
Can you help me?
Thanks,
Stefano
|
|
|
Re: Number of points inside a contour curve [message #52016 is a reply to message #51947] |
Fri, 22 December 2006 02:24  |
burkina
Messages: 32 Registered: February 2005
|
Member |
|
|
On Dec 21, 4:55 pm, David Fanning <n...@dfanning.com> wrote:
> but couldn't this
> loop be replaced with a cumulative total (I.e., TOTAL
> with the CUMULATIVE keyword set)?
>
I think I cannot replace it with a TOTAL/CUMULATIVE command, because
the histogram I have to sum contains the frequencies of the points of
the 2D array and these frequencies cannot be summed up before being
transformed in points as I do in the while loop. I may be wrong, but I
cannot find an easy way to cancel the loop (although I'm sure most of
you can!).
In any case, the code was slightly wrong, because I didn't consider the
k increment at the end of the while loops, so that the maxlevel should
read:
maxlevel=histoden[n_histo-k] * (maxvalue-k+1)
Thanks,
Stefano
|
|
|
Re: Number of points inside a contour curve [message #52030 is a reply to message #51947] |
Thu, 21 December 2006 07:55  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
burkina writes:
> while sum lt 0.9*tot_histo do begin
>
> sum = sum + histoden[n_histo-1-k] * (maxvalue-k)
> k = k+1
>
> endwhile
I've got two feet of snow on my (large) driveway, and
my boots are on, and I've stoked myself with Ibuprofen,
so I'm not going to check this out, but couldn't this
loop be replaced with a cumulative total (I.e., TOTAL
with the CUMULATIVE keyword set)?
Cheers,
David
P.S. Alas, the only reason I *had* so many sons
was for days like this, and with the airport closed
they can't even get here. Sigh...
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|