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.5.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c423713c2a69d6673fcc13f3c1d32f6b92ff3eddd6caa27bc2bbf5c855cfabc |
|
MD5 | 5fa9d86f0e398a2b2cf11be53e590a1a |
|
BLAKE2b-256 | d4379c3758bbbe5d1d65f43b56e794348fa71526b211b54f06bbe9e294ab2702 |
Hashes for si_units-0.5.1-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 728c7382a3f471c8d973ddfc87081bafbe6e9214e28e4812ba45557321409de9 |
|
MD5 | 902217eb2d8d8f4a9bdeeacdf25ebe8f |
|
BLAKE2b-256 | 3dd2bb2c8340248fd592372d301ee9b62257f1b4fdedbc295c32d9e1b31cc6dc |
Hashes for si_units-0.5.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059e8bf44a415481ad58bed774fb3da87472a0686c5a4126b3353e630f59b5cc |
|
MD5 | 22c2c97038c64c9dde61ebd2b48935d0 |
|
BLAKE2b-256 | 923a3302fa1a3f32df74c8bcd37c9f78911b9817f454f9890a85fb51c000b792 |
Hashes for si_units-0.5.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52dd9eab168b6e79718ad84af37542161314b9d182dcd2e9032953a6685d4f3e |
|
MD5 | a50b324e6cbf04116ce13f588a0bfe2b |
|
BLAKE2b-256 | 504c166f925c169f3b93107055f74a1c49c797ecc9e682a94397c432059c43ca |
Hashes for si_units-0.5.1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b272a16ea96103fe9754f2a61895a14e08d6401b14865881e8eca93329e43c9a |
|
MD5 | 11b11b745fcf586cbc3d26ea12fb1663 |
|
BLAKE2b-256 | 405f38d95176fd7beb250c0476f6f639bff6515ae951df013acbd7262e8de95a |