Skip to main content

Representation of SI unit valued scalars and arrays.

Project description

si-units

crate documentation documentation PyPI version

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


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.6.0-cp37-abi3-win_amd64.whl (742.9 kB view hashes)

Uploaded CPython 3.7+ Windows x86-64

si_units-0.6.0-cp37-abi3-win32.whl (648.7 kB view hashes)

Uploaded CPython 3.7+ Windows x86

si_units-0.6.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view hashes)

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

si_units-0.6.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.8 MB view hashes)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

si_units-0.6.0-cp37-abi3-macosx_10_7_x86_64.whl (942.6 kB view hashes)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

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