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

Home » Public Forums » archive » Re: Histogram and bin sizes
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: Histogram and bin sizes [message #59211 is a reply to message #58869] Thu, 06 March 2008 16:14 Go to previous messageGo to previous message
lyle_pakula is currently offline  lyle_pakula
Messages: 2
Registered: March 2008
Junior Member
On Feb 22, 1:54 am, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:

>
>
> times slower than usingHISTOGRAMwith regular bins due to the time
> required to do a binary search.
>
> ;UseHISTOGRAMto bin 10^7 numbers with evenly-spaced bins
>
> r  = 100.0*RANDOMU(seed, 10^7)
> t0 = SYSTIME(/SECONDS)
> h1 =HISTOGRAM(r, MIN = 0.0, BINSIZE = 1.0)
> PRINT, 'Time for evenly-spaced bins   : ', SYSTIME(/SECONDS) - t0
>
> ;Use VALUE_LOCATE andHISTOGRAMto bin 10^7 numbers
> ;with unevenly-spaced bins
>
> bins = [0.0, FINDGEN(99) + 0.1*RANDOMU(seed, 99)]
> t0   = SYSTIME(/SECONDS)
> i    = VALUE_LOCATE(bins, r)
> h2   =HISTOGRAM(i, MIN = 0, BINSIZE = 1)
> PRINT, 'Time for unevenly-spaced bins : ', SYSTIME(/SECONDS) - t0

My first comp.lang.idl post ..

I think you may have to add nbins to the above histogram call as if
none of the elements lie in your desired bin range (i.e. value_locate
returns an array of -1's) histogram will not return a mapping into
your desired bin range.

e.g

function hist_ireg_bin, data, bin
; Calculate a histogram with irregular bin spacing
tmp = VALUE_LOCATE(bin, data)
return, HISTOGRAM(tmp, MIN = 0, BINSIZE = 1, nbins =
n_elements(bin))
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 6.3 read_binary ??
Next Topic: Re: widget draw background color

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

Current Time: Sun Oct 12 11:11:13 PDT 2025

Total time taken to generate the page: 1.19967 seconds