range_sample

decida.range_sample(beg, end, num=0, step=0.0, mode='lin')

synopsis:

lin or log sample a range of values.

arguments:

beg (float)

begin value of the range to sample

end (float)

end value of the range to sample

num (int, default=0)

number of points to sample

step (float, default=0.0)

step size (lin mode only)

if first step is greater than last step, step down

mode (str, default=”lin”)

sweep mode

  • “lin” linear sampling mode
  • “log” logarithmic sampling mode
  • “uniform” uniform random sampling mode

results:

  • return a list of sampled values

examples:

>>> import decida
>>> vmin = 0 ; vmax  = 2
>>> values = decida.range_sample(vmin, vmax, num=11, mode="lin")
>>> print values
[0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0]
>>> import decida
>>> vmin, vmax = 0, 2
>>> values = decida.range_sample(vmin, vmax, step=0.5)
>>> print values
[0.0, 0.5, 1.0, 1.5, 2.0]