11.1.12.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\).

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}\).

class PySpice.Unit.Unit.PrefixedUnit(unit=None, power=None, value_ctor=None, values_ctor=None)[source]

Bases: object

This class implements a prefixed unit.

class PySpice.Unit.Unit.SiBaseUnit(si_unit=None)[source]

Bases: PySpice.Unit.Unit.Unit

This class implements an SI base unit.

class PySpice.Unit.Unit.SiDerivedUnit(string=None, powers=None)[source]

Bases: object

This class implements a unit defined as powers of SI base units.

class PySpice.Unit.Unit.Unit(si_unit=None)[source]

Bases: object

This class implements a unit.

exception PySpice.Unit.Unit.UnitError[source]

Bases: ValueError

class PySpice.Unit.Unit.UnitMetaclass[source]

Bases: type

Metaclass to register units

class PySpice.Unit.Unit.UnitPrefix[source]

Bases: object

This class implements a unit prefix like kilo

class PySpice.Unit.Unit.UnitPrefixMetaclass[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.

convert(prefixed_unit)[source]

Convert the value to another power.

convert_to_power(power=0)[source]

Convert the value to another power.

class PySpice.Unit.Unit.UnitValues[source]

Bases: numpy.ndarray

This class implements a Numpy array with a unit and a power (prefix).

convert(prefixed_unit)[source]

Convert the value to another power.

convert_to_power(power=0)[source]

Convert the value to another power.

class PySpice.Unit.Unit.ZeroPower[source]

Bases: PySpice.Unit.Unit.UnitPrefix