Representation of SI unit valued scalars and arrays.
Project description
si-units
Representation of quantities with SI units.
The package is written with flexibility in mind and is able to represent arbitrarily complex units. In addition to simple scalar quantities, it can be used to decorate any complex data type (numpy arrays, PyTorch tensors) to provide unit checks.
Installation and Usage
You can install the python package from source (you need a rust compiler for that):
pip install git+https://github.com/itt-ustutt/quantity
or get the compiled files from PyPI
pip install si-units
Examples
Calculate the pressure of an ideal gas.
from si_units import *
temperature = 25.0 * CELSIUS
volume = 1.5 * METER**3
moles = 75.0 * MOL
pressure = moles * RGAS * temperature / volume
print(pressure) # 123.94785148011941 kPa
numpy
functions can be used with SI units:
from si_units import *
import numpy as np
ms = np.linspace(2.0, 4.0, 3) * METER
sqms = ms**2
print(sqms) # [4, 9, 16] m²
Documentation
For the documentation, see here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for si_units-0.9.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e40d92b5917309a0d45394655cf82c5280c9e04267e94e2612fd6bb8442c96c |
|
MD5 | 4b897f7ac65cf347b0b6783406b1ddb6 |
|
BLAKE2b-256 | ef65101758d08f872024db7ed29b6617b6aa69ce77419c7d17d65e5338fa9ba9 |
Close
Hashes for si_units-0.9.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e02269bd418ac0bce96269dd041d5f13cefaf6e7bcbaf57085b44c84d41c7f56 |
|
MD5 | f506a0aedeb5c78c6cec0f514b7dfe73 |
|
BLAKE2b-256 | bfe33073277ed8ff9969efed1af46719984c29f03406fee61792ed42211f2c9f |
Close
Hashes for si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24bab5349dcb1f6c2e32f497b1918fd69b5aee848640d973b50ec6fa5dcf02dd |
|
MD5 | a766c49cdb3cb2fe2bb8e24db65b75e8 |
|
BLAKE2b-256 | d88f59138acc147fff047642429724bb0f88d33bd6eb68a95acd153a35d987fe |
Close
Hashes for si_units-0.9.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ccadd0ce0615519941000df2dbcbfefd6163642c939a60b5fba6b7bc80b19d |
|
MD5 | 4bd5fd91d36f3a16cbb13a6e88a91bb6 |
|
BLAKE2b-256 | fce1c84f86f7a8212069ef72ad5a6b60477c91e87cbbc50fe401c480ed1791bd |