units¶
Unit definitions and surrounding Value system.
A quick note on what this module does not do: it does not set out a complete unit system, and you will experience issues if you use it that way.
This system is designed purely for the ergonomic specification of units of a quantity at display time, and because of this, it is designed to precisely mirror the form of the expression as it is written in code. The below highlights a particular quirk of this.
>>> 1 / (KILO * VOLT) == 1 * KILO / VOLT
True
This is because the system stores units as they would be written, and you would write \(\mathrm{1 / kV = 1 kV^{-1}}\) and not \(\mathrm{1 k^{-1} V^{-1}}\).
Available prefixes¶
Prefix variable |
Displayed as |
|---|---|
|
Q |
|
R |
|
Y |
|
Z |
|
E |
|
P |
|
T |
|
G |
|
M |
|
k |
|
h |
|
da |
|
d |
|
c |
|
m |
|
µ |
|
n |
|
p |
|
f |
|
a |
|
z |
|
y |
|
r |
|
q |
|
Yi |
|
Zi |
|
Ei |
|
Pi |
|
Ti |
|
Gi |
|
Mi |
|
Ki |
Available units¶
Length/area/volume¶
Unit variable |
Displayed as |
|---|---|
|
m |
|
|
|
Å |
|
μm |
|
L |
|
Mass¶
Unit variable |
Displayed as |
|---|---|
|
g |
Time/frequency¶
Unit variable |
Displayed as |
|---|---|
|
s |
|
min |
|
hr |
|
Hz |
Electricity¶
Unit variable |
Displayed as |
|---|---|
AMP |
A |
VOLT |
V |
OHM |
Ω |
SIEMENS |
S |
FARAD |
F |
HENRY |
H |
COULOMB |
C |
Temperature¶
Unit variable |
Displayed as |
|---|---|
|
K |
|
°C |
Illumination¶
Unit variable |
Displayed as |
|---|---|
|
cd |
|
lm |
|
lx |
Quantity¶
Unit variable |
Displayed as |
|---|---|
|
mol |
Angles¶
Unit variable |
Displayed as |
|---|---|
|
° |
|
rad |
|
sr |
Energy and power¶
Unit variable |
Displayed as |
|---|---|
|
J |
|
eV |
|
W |
|
dB |
Force and pressure¶
Unit variable |
Displayed as |
|---|---|
|
N |
|
Pa |
|
bar |
Magnetism¶
Unit variable |
Displayed as |
|---|---|
|
Wb |
|
T |
Digital storage¶
Unit variable |
Displayed as |
|---|---|
|
b |
|
B |
Classes
Unit representing scientific notation. |
|
An SI unit or prefix. |
|
A sequence of individual units. |
|
Representation of a quantity with units for display purposes. |