Function adas.adas_vector

def adas_vector(low=0.0, high=100.0, num=10, linear=False)

Generate a log spaced vector of values given the minimum, maximum and number of points required.

Parameters

low : int, float
minimum value of required vector.
high : int, float
maximum value of required vector.
num : int
number of values required, defaults to 10.
linear : bool
if True use a linear spacing.

Returns

value : float
log10 or linear spaced 1-D numpy array.

Notes

A python convenience version of an ADAS routine. It can be replaced by numpy's geomspace or logspace for log-spaced vectors or linspace for linearly spaced results.

Version History

  • Martin O'Mullane, 20-08-2012
    • First version

Example

>>> import adas as adas
>>> import numpy as np
>>> adas.adas_vector(low=1, high=200.0, num=15)
array([  1.        ,   1.46002162,   2.13166312,   3.11227423,
         4.54398764,   6.63432018,   9.68625086,  14.14213562,
        20.64782369,  30.1462689 ,  44.01420421,  64.26168951,
        93.82345571, 136.98427334, 200.        ])
>>> np.geomspace(1, 200, 15)
array([  1.        ,   1.46002162,   2.13166312,   3.11227423,
         4.54398764,   6.63432018,   9.68625086,  14.14213562,
        20.64782369,  30.1462689 ,  44.01420421,  64.26168951,
        93.82345571, 136.98427334, 200.        ])
>>> adas.adas_vector(low=1, high=5, num=8, linear=True)
array([1.        , 1.57142857, 2.14285714, 2.71428571, 3.28571429,
       3.85714286, 4.42857143, 5.        ])