-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloggen.pro
31 lines (27 loc) · 830 Bytes
/
loggen.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;------------------------------------------------------------------------------
;
; Create an array of n logarithmically spaced points between two
; limits
;
; Inputs:
;
; minval = lower bound
; maxval = upper bound
; npoints = # of points
;
; Optional:
;
; double = set keyword if we want a double array instead of floats
; linear = force the array to be linearly spaced
;
; Output: The array
;
;------------------------------------------------------------------------------
function loggen, minval, maxval, npoints, double=double, linear=linear
if keyword_set(double) then points = dindgen(npoints)/(npoints-1) $
else points = findgen(npoints)/(npoints-1)
if keyword_set(linear) then $
return, (maxval - minval)*points + minval $
else $
return, 10^( (alog10(maxval/minval))*points + alog10(minval) )
end