;+ ; NAME: ; log_bins ; ; ; PURPOSE: ; create log spaced bins, useful for plotting spectra with histo_bins ; ; ; CATEGORY: ; stats ; ; ; INPUTS: ; MIN: minimum value of bins ; MAX: maximum value of bins ; NBINS: number of bins to create ; ; ; KEYWORD PARAMETERS: ; DOUBLE: return a double instead of a float ; NATURAL: do natural log spaced bins ; ; ; OUTPUTS: ; bins: the log spaced bins between min and max ; ; ; RESTRICTIONS: ; Requires scale_vector from David Fanning dfanning.com ; ; ; EXAMPLE: ; IDL> print, log_bins(0.1, 10, 10) ; 0.100000 0.166810 0.278256 0.464159 0.774264 ; 1.29155 2.15443 3.59381 5.99484 10.0000 ; ; ; ; MODIFICATION HISTORY: ; ; Tue Sep 29 10:17:28 2009, Brian Larsen ; forget the /double to scale_vector (fixed) ; Wed Aug 12 14:06:28 2009, Brian Larsen ; written and tested ; ;- FUNCTION log_bins, min, max, nbins, DOUBLE = double IF NOT keyword_set(double) THEN $ bins = 10.^scale_vector(findgen(nbins), alog10(min)/alog10(10), alog10(max)/alog10(10)) $ ELSE $ bins = 10.^scale_vector(dindgen(nbins), alog10(min)/alog10(10), alog10(max)/alog10(10), $ /double) RETURN, bins END