Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: Histogram a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 10 Topic 5450 of 6248
Post > Topic >>

Re: Histogram and bin sizes

by lyle_pakula@[EMAIL PROTECTED] Mar 6, 2008 at 04:14 PM

On Feb 22, 1:54=A0am, "Kenneth P. Bowman" <k-bow...@[EMAIL PROTECTED]
> 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 =A0=3D 100.0*RANDOMU(seed, 10^7)
> t0 =3D SYSTIME(/SECONDS)
> h1 =3DHISTOGRAM(r, MIN =3D 0.0, BINSIZE =3D 1.0)
> PRINT, 'Time for evenly-spaced bins =A0 : ', SYSTIME(/SECONDS) - t0
>
> ;Use VALUE_LOCATE andHISTOGRAMto bin 10^7 numbers
> ;with unevenly-spaced bins
>
> bins =3D [0.0, FINDGEN(99) + 0.1*RANDOMU(seed, 99)]
> t0 =A0 =3D SYSTIME(/SECONDS)
> i =A0 =A0=3D VALUE_LOCATE(bins, r)
> h2 =A0 =3DHISTOGRAM(i, MIN =3D 0, BINSIZE =3D 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 =3D VALUE_LOCATE(bin, data)
	return, HISTOGRAM(tmp, MIN =3D 0, BINSIZE =3D 1, nbins =3D
n_elements(bin))
end
 




 10 Posts in Topic:
Histogram and bin sizes
jeffnettles4870@[EMAIL PR  2008-02-20 11:20:40 
Re: Histogram and bin sizes
pgrigis@[EMAIL PROTECTED]  2008-02-20 11:43:35 
Re: Histogram and bin sizes
Conor <cmancone@[EMAIL  2008-02-21 06:05:00 
Re: Histogram and bin sizes
"Kenneth P. Bowman&q  2008-02-21 08:54:54 
Re: Histogram and bin sizes
jeffnettles4870@[EMAIL PR  2008-02-21 08:29:40 
Re: Histogram and bin sizes
Conor <cmancone@[EMAIL  2008-02-21 09:19:29 
Re: Histogram and bin sizes
"Kenneth P. Bowman&q  2008-02-21 16:54:19 
Re: Histogram and bin sizes
Conor <cmancone@[EMAIL  2008-02-21 09:20:17 
Re: Histogram and bin sizes
Conor <cmancone@[EMAIL  2008-02-22 05:51:48 
Re: Histogram and bin sizes
lyle_pakula@[EMAIL PROTEC  2008-03-06 16:14:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 14:28:45 CDT 2008.