qunits.prefix
The qunits.prefix module contains the SI prefixes, the exponent maps of the units and the
Context of the units.
Exponent maps
An exponent map (ExpMap) is a frozenset of (symbol, exponent) pairs, e.g.
frozenset({("m", 1), ("s", -1)}) for m/s. It identifies a unit and is how the unit is printed.
Units are multiplied and divided by merging their exponent maps with
merge_exp_maps.
- Type aliases:
-
- ExpMapfrozenset[tuple[str, int]]
An exponent map, a frozenset of (symbol, exponent) pairs, e.g.
frozenset({("m", 1), ("s", -1)})for m/s. It identifies a unit and is how the unit is printed.
Contexts
The Context of a unit
distinguishes quantities of the same dimension that must not be mixed, e.g. angles from other dimensionless
quantities. CONTEXT_DICT maps each context to the symbol of its unit, CONTEXT_DICT_UNIT
the other way around.
Prefixes
PREFIX_DICT maps the prefix symbols to their exponents, PREFIX_DICT_EXP the other way
around. The prefixes are written in ASCII, micro is u. Only the prefixes for powers of 1000 are
defined.
| Prefix | Symbol | Factor | Prefix | Symbol | Factor |
|---|---|---|---|---|---|
| quecto | q | $10^{-30}$ | kilo | k | $10^{3}$ |
| ronto | r | $10^{-27}$ | mega | M | $10^{6}$ |
| yocto | y | $10^{-24}$ | giga | G | $10^{9}$ |
| zepto | z | $10^{-21}$ | tera | T | $10^{12}$ |
| atto | a | $10^{-18}$ | peta | P | $10^{15}$ |
| femto | f | $10^{-15}$ | exa | E | $10^{18}$ |
| pico | p | $10^{-12}$ | zetta | Z | $10^{21}$ |
| nano | n | $10^{-9}$ | yotta | Y | $10^{24}$ |
| micro | u | $10^{-6}$ | ronna | R | $10^{27}$ |
| milli | m | $10^{-3}$ | quetta | Q | $10^{30}$ |