spice_value¶
-
decida.
spice_value
(val)¶ synopsis:
Return a numeric value, given a “Spice” value.arguments:
val (str)
number in “Spice” format (t, g, meg, k, m, u, n, p, f, a are scale factors)results:
- return string in normal number format
- for parameterized values, no change
example:
>>> import decida >>> nums = ["1.23GHz", "1AC", "1FF", "1MEGOHM", "1.2MV", "23KOHM"] >>> for num in nums: >>> print num, decida.spice_value(num) 1.23GHz 1230000000.0 1AC 1e-18 1FF 1e-15 1MEGOHM 1000000.0 1.2MV 0.0012 23KOHM 23000.0