Perform operations on SI units
This is a library used to symbolically manipulate SI units. It comprises a
used for base SI units like
meter etc, a
for units derived from them, and a
Composite type, for when numerical coefficients
are included. Python version 3.7 or greater is required. There are no dependencies.
This library is useful for dimensional analysis. It relies on the concept that SI units are all composed of varying exponents of 7 base units. We can think of all other units as linear combinations of base units.
You can perform normal multiplication, division, and power operations on units
provided by this lib, and between them and
floats. You can check equality,
based on the resulting combination of base units.
pip install siunits
In Linux, you may need to use something like
pip3 install siunits, or
python3.7 -m pip install siunits.
A base unit:
import siunits as u u.kg >>> kilogram (kg), mass
A derived unit:
u.v >>> volt (V), [kg: 1, m: 2, s: -3, A: -1]
u.kg * u.s >>> kilogram·second (kg·s), [kg: 1, s: 1]
u.j / u.m**2 >>> joule / meter² (kg·s⁻²), [kg: 1, s: -2] u.s**2 / u.kg**3 >>> second²·kilogram⁻³ (s²·kg⁻³), [s: 2, kg: -3]
With numerical coefficients:
2*u.a**2 * 3*u.v**2 >>> 6kg²·m⁴·s⁻⁶
Equality testing is based on composition of base units:
u.w == u.v * u.a == u.kg * u.m**2 / u.s**3 >>> True
- Infer composite types that match a given custom (eg multiplied) unit
- Apply arithmetic to quantities as well (eg
worketc), and display them
- Addition and subtraction
This project doesn't aim to provide conversions with other unit systems, like
imperial, nor does it provide physical constants. For these
tasks, try scipy.constants.
Why add another unit library?
The clean symbolic manipulation this library provides doesn't appear to exist in any existing one.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size siunits-0.0.6-py3-none-any.whl (8.4 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size siunits-0.0.6.tar.gz (6.8 kB)||File type Source||Python version None||Upload date||Hashes View hashes|