11.1.14.2. Unit¶
This module implements units.
A shortcut is defined for each unit prefix, e.g. pico
, nano
, micro
,
milli
, kilo
, mega
, tera
.
-
class
PySpice.Unit.Unit.
FrequencyMixin
[source]¶ Bases:
object
This class implements a frequency mixin.
-
property
period
¶ Return the period \(T = \frac{1}{f}\).
-
property
pulsation
¶ Return the pulsation \(\omega = 2\pi f\).
-
property
-
class
PySpice.Unit.Unit.
PeriodMixin
[source]¶ Bases:
object
This class implements a period mixin.
-
property
frequency
¶ Return the period \(f = \frac{1}{T}\).
-
property
pulsation
¶ Return the pulsation \(\omega = \frac{2\pi}{T}\).
-
property
-
class
PySpice.Unit.Unit.
PrefixedUnit
(unit=None, power=None, value_ctor=None, values_ctor=None)[source]¶ Bases:
object
This class implements a prefixed unit.
-
property
is_unit_less
¶
-
property
power
¶
-
property
scale
¶
-
property
unit
¶
-
property
-
class
PySpice.Unit.Unit.
SiBaseUnit
(si_unit=None)[source]¶ Bases:
PySpice.Unit.Unit.Unit
This class implements an SI base unit.
-
SI_UNIT
= SiDerivedUnit()¶
-
-
class
PySpice.Unit.Unit.
SiDerivedUnit
(string=None, powers=None)[source]¶ Bases:
object
This class implements a unit defined as powers of SI base units.
-
BASE_UNITS
= ('m', 'kg', 's', 'A', 'K', 'mol', 'cd')¶
-
property
hash
¶
-
property
powers
¶
-
property
string
¶
-
-
class
PySpice.Unit.Unit.
Unit
(si_unit=None)[source]¶ Bases:
object
This class implements a unit.
-
DEFAULT_UNIT
= False¶
-
QUANTITY
= ''¶
-
SI_UNIT
= SiDerivedUnit()¶
-
UNIT_NAME
= ''¶
-
UNIT_SUFFIX
= ''¶
-
property
is_unit_less
¶
-
property
quantity
¶
-
property
si_unit
¶
-
property
unit_name
¶
-
property
unit_suffix
¶
-
-
exception
PySpice.Unit.Unit.
UnitError
[source]¶ Bases:
ValueError
-
class
PySpice.Unit.Unit.
UnitMetaclass
(class_name, base_classes, attributes)[source]¶ Bases:
type
Metaclass to register units
-
class
PySpice.Unit.Unit.
UnitPrefix
[source]¶ Bases:
object
This class implements a unit prefix like kilo
-
POWER
= None¶
-
PREFIX
= ''¶
-
property
is_defined_in_spice
¶
-
property
is_unit
¶
-
property
power
¶
-
property
prefix
¶
-
property
scale
¶
-
property
spice_prefix
¶
-
-
class
PySpice.Unit.Unit.
UnitPrefixMetaclass
(class_name, base_classes, attributes)[source]¶ Bases:
type
Metaclass to register unit prefixes
-
class
PySpice.Unit.Unit.
UnitValue
(prefixed_unit, value)[source]¶ Bases:
object
This class implements a value with a unit and a power (prefix).
The value is not converted to float if the value is an int.
-
property
power
¶
-
property
prefixed_unit
¶
-
property
scale
¶
-
property
unit
¶
-
property
value
¶
-
property
-
class
PySpice.Unit.Unit.
UnitValues
(prefixed_unit, shape, dtype=<class 'float'>, buffer=None, offset=0, strides=None, order=None)[source]¶ Bases:
numpy.ndarray
This class implements a Numpy array with a unit and a power (prefix).
-
CONVERSION
¶ alias of
PySpice.Tools.EnumFactory.ConversionType
-
UFUNC_MAP
= {<ufunc 'add'>: UNIT_MATCH, <ufunc 'subtract'>: UNIT_MATCH, <ufunc 'multiply'>: NEW_UNIT, <ufunc 'true_divide'>: NEW_UNIT, <ufunc 'logaddexp'>: FLOAT, <ufunc 'logaddexp2'>: FLOAT, <ufunc 'floor_divide'>: NEW_UNIT, <ufunc 'negative'>: NO_CONVERSION, <ufunc 'positive'>: NO_CONVERSION, <ufunc 'power'>: NEW_UNIT, <ufunc 'remainder'>: UNIT_MATCH, <ufunc 'fmod'>: NOT_IMPLEMENTED, <ufunc 'divmod'>: UNIT_MATCH, <ufunc 'absolute'>: NO_CONVERSION, <ufunc 'fabs'>: NOT_IMPLEMENTED, <ufunc 'rint'>: NO_CONVERSION, <ufunc 'sign'>: NO_CONVERSION, <ufunc 'heaviside'>: NOT_IMPLEMENTED, <ufunc 'conjugate'>: NOT_IMPLEMENTED, <ufunc 'exp'>: FLOAT, <ufunc 'exp2'>: FLOAT, <ufunc 'log'>: FLOAT, <ufunc 'log2'>: FLOAT, <ufunc 'log10'>: FLOAT, <ufunc 'expm1'>: FLOAT, <ufunc 'log1p'>: FLOAT, <ufunc 'sqrt'>: NEW_UNIT, <ufunc 'square'>: NEW_UNIT, <ufunc 'cbrt'>: NEW_UNIT, <ufunc 'reciprocal'>: NEW_UNIT, <ufunc 'sin'>: FLOAT, <ufunc 'cos'>: FLOAT, <ufunc 'tan'>: FLOAT, <ufunc 'arcsin'>: FLOAT, <ufunc 'arccos'>: FLOAT, <ufunc 'arctan'>: FLOAT, <ufunc 'arctan2'>: FLOAT, <ufunc 'hypot'>: FLOAT, <ufunc 'sinh'>: FLOAT, <ufunc 'cosh'>: FLOAT, <ufunc 'tanh'>: FLOAT, <ufunc 'arcsinh'>: FLOAT, <ufunc 'arccosh'>: FLOAT, <ufunc 'arctanh'>: FLOAT, <ufunc 'deg2rad'>: FLOAT, <ufunc 'rad2deg'>: FLOAT, <ufunc 'bitwise_and'>: NOT_IMPLEMENTED, <ufunc 'bitwise_or'>: NOT_IMPLEMENTED, <ufunc 'bitwise_xor'>: NOT_IMPLEMENTED, <ufunc 'invert'>: NOT_IMPLEMENTED, <ufunc 'left_shift'>: NOT_IMPLEMENTED, <ufunc 'right_shift'>: NOT_IMPLEMENTED, <ufunc 'greater'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'greater_equal'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'less'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'less_equal'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'not_equal'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'equal'>: UNIT_MATCH_NO_OUT_CAST, <ufunc 'logical_and'>: UNIT_MATCH, <ufunc 'logical_or'>: UNIT_MATCH, <ufunc 'logical_xor'>: UNIT_MATCH, <ufunc 'logical_not'>: UNIT_MATCH, <ufunc 'maximum'>: UNIT_MATCH, <ufunc 'minimum'>: UNIT_MATCH, <ufunc 'fmax'>: UNIT_MATCH, <ufunc 'fmin'>: UNIT_MATCH, <ufunc 'isfinite'>: NOT_IMPLEMENTED, <ufunc 'isinf'>: NOT_IMPLEMENTED, <ufunc 'isnan'>: NOT_IMPLEMENTED, <ufunc 'signbit'>: NOT_IMPLEMENTED, <ufunc 'copysign'>: NOT_IMPLEMENTED, <ufunc 'nextafter'>: NOT_IMPLEMENTED, <ufunc 'spacing'>: NOT_IMPLEMENTED, <ufunc 'modf'>: NOT_IMPLEMENTED, <ufunc 'ldexp'>: NOT_IMPLEMENTED, <ufunc 'frexp'>: NOT_IMPLEMENTED, <ufunc 'floor'>: NOT_IMPLEMENTED, <ufunc 'ceil'>: NO_CONVERSION, <ufunc 'trunc'>: NO_CONVERSION, <function mean>: NO_CONVERSION}¶
-
property
power
¶
-
property
prefixed_unit
¶
-
property
scale
¶
-
property
unit
¶
-