Re: histogram, how to trasfer from linear bins to logarithmic bin? [message #68181 is a reply to message #68180] |
Tue, 29 September 2009 07:31   |
Brian Larsen
Messages: 270 Registered: June 2006
|
Senior Member |
|
|
Along the lines that David is saying here, when all the value_locate
stuff was hot on the group I wrote up a few routines that *might* be
useful to you.
One of them "log_bins" is like findgen for log spaced bins over a
given range. I use this constantly for binning particle energy
spectra.
http://people.bu.edu/balarsen/IDLdoc/log_bins.html
Another is "histo_bins" this creates a histogram with use specified
bins, it is exactly what David did in his logbins page just bundled up
for easier (for me) use.
http://people.bu.edu/balarsen/IDLdoc/histo_bins.html
To recreate David's example:
IDL> v1 = Randomu(-3L, 1000) * 100
IDL> v2 = Randomu(-5L, 1000) * 100
IDL> ratio = v1 / v2
IDL> bins=log_bins(0.01, 1000, 6)
IDL> print, log_bins(0.01, 1000, 6)
0.0100000 0.100000 1.00000 10.0000 100.000
1000.00
IDL> hist=histo_bins(ratio, bins)
IDL> plot, bins, hist, /xlog, psym=10
For me this is easier than the labels and xyouts stuff.
Cheers,
Brian
------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
|
|
|