Skip to main content

Representation of SI unit valued scalars and arrays.

Project description

si-units

documentation PyPI version

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


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

si_units-0.9.0-cp37-abi3-win_amd64.whl (798.8 kB view details)

Uploaded CPython 3.7+ Windows x86-64

si_units-0.9.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl (892.2 kB view details)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

si_units-0.9.0-cp37-abi3-macosx_10_12_x86_64.whl (947.3 kB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

File details

Details for the file si_units-0.9.0-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: si_units-0.9.0-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 798.8 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for si_units-0.9.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5e40d92b5917309a0d45394655cf82c5280c9e04267e94e2612fd6bb8442c96c
MD5 4b897f7ac65cf347b0b6783406b1ddb6
BLAKE2b-256 ef65101758d08f872024db7ed29b6617b6aa69ce77419c7d17d65e5338fa9ba9

See more details on using hashes here.

File details

Details for the file si_units-0.9.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24bab5349dcb1f6c2e32f497b1918fd69b5aee848640d973b50ec6fa5dcf02dd
MD5 a766c49cdb3cb2fe2bb8e24db65b75e8
BLAKE2b-256 d88f59138acc147fff047642429724bb0f88d33bd6eb68a95acd153a35d987fe

See more details on using hashes here.

File details

Details for the file si_units-0.9.0-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page