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 7 of 10 Topic 5450 of 6457
Post > Topic >>

Re: Histogram and bin sizes

by "Kenneth P. Bowman" <k-bowman@[EMAIL PROTECTED] > Feb 21, 2008 at 04:54 PM

In article 
<f6219865-59f4-4bf8-8718-67884c9df226@[EMAIL PROTECTED]
>,
 Conor <cmancone@[EMAIL PROTECTED]
> wrote:

> Arbitrary bin sizes should be pretty easy to program.  You just need
> to map your data points appropriately.  For instance if you had the
> data set:
> 
> x = randomu(seed,100)
> 
> and you wanted bins from:
> [0-.1,.1-.3,.3-.35,.35-.8,.8-1]
> 
> you might do something like this:
> 
> x = randomu(seed,100)
> bins = [ [0,.1], [.1,.3], [.3,.35], [.35,.8], [.8,1] ]
> newx = fltarr(n_elements(x))
> for i=0,n_elements(bins[0,*])-1 do begin
>   w = where( x ge bins[0,i] and x lt bins[1,i], c )
>   if c gt 0 then newx[w] = i+.5
> endfor
> 
> hist = histogram(newx,binsize=1.0,min=0)
> plothist,newx

This will work, but will be extremely slow because you test every value
in the input array once for every bin.

The VALUE_LOCATE approach will be much faster, particularly for large
numbers of bins, as it does a binary search.

Ken Bowman
 




 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 Thu Dec 4 0:12:54 CST 2008.