Representation of SI unit valued scalars and arrays.
Project description
si-units
Representation of SI unit valued scalars and arrays. Python bindings to the quantity Rust library.
The package is written with flexibility in mind and is able to represent arbitrarily complex units. Additional to simple scalar quantities, it also provides utilities for vector valued quantities based on numpy, where all entries share the same unit.
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²
print(sqms.sqrt()) # [2, 3, 4] 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
Built Distributions
Hashes for si_units-0.6.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d06144e945fb5d820b0c6b23bf450d6c3f42940f15b733304d4fd3a9024740a4 |
|
MD5 | 7a74d95e6aeecbf3ade3853816b84e48 |
|
BLAKE2b-256 | af22cc9feb8a684ed0f2ca054108848ba61530fceadb866568dacc6a35069ae9 |
Hashes for si_units-0.6.0-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61b402024a778ff62e6bb2401c9d7ded13cb8cc47d8ba59114675e01fe7d593b |
|
MD5 | 94e01d4e6395bd066b70d97249c538a7 |
|
BLAKE2b-256 | 861a8ad026a1b8a904a08072e86498c8747444f7f4be01d62aedff24b27594ee |
Hashes for si_units-0.6.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56ddd93e21466dca3e0fce9a234f824d3ca4a03e788922926ad9de1f53a186f0 |
|
MD5 | c552b0f922b0ce85ad05a00ac4ce4db2 |
|
BLAKE2b-256 | 709f60bddb8112eefe0c8ca9829e8cea5ff128f04c59ecb215509767cd2fdb1d |
Hashes for si_units-0.6.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec70db8840f5949c9a318905cf11ec7e98bbf6b36a7b4c0572ed01ca5f7c5ae |
|
MD5 | 3bd9701160479eeaed1ec6ea71fbef48 |
|
BLAKE2b-256 | 83dadec967e56dc78a9b92b166155bf450236ff45673dbc351c424d2759bb8a0 |
Hashes for si_units-0.6.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94cc3dd6040c3134c877f272b23dd515ef7e62f890c21e2e7c7d75a8593d34ff |
|
MD5 | cb7a322295c4b8df28011612768dc1a8 |
|
BLAKE2b-256 | 5c847de847238781b95691455612da7b18bbb1ac00f5c736b8b70ea8b99d8883 |