# si-units
[![documentation](https://img.shields.io/badge/docs-github--pages-blue)](https://itt-ustutt.github.io/quantity/index.html)
[![PyPI version](https://badge.fury.io/py/si_units.svg)](https://badge.fury.io/py/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.
```python
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:
```python
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](https://itt-ustutt.github.io/quantity/index.html).
Raw data
{
"_id": null,
"home_page": "https://github.com/itt-ustutt/quantity/tree/master/si-units",
"name": "si-units",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "physics, units, SI",
"author": "Philipp Rehner <prehner@ethz.ch>, Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"author_email": "Philipp Rehner <prehner@ethz.ch>, Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"download_url": null,
"platform": null,
"description": "# si-units\n\n[![documentation](https://img.shields.io/badge/docs-github--pages-blue)](https://itt-ustutt.github.io/quantity/index.html)\n[![PyPI version](https://badge.fury.io/py/si_units.svg)](https://badge.fury.io/py/si_units)\n\nRepresentation of quantities with SI units. \n\nThe package is written with flexibility in mind and is able to represent arbitrarily complex units.\nIn addition to simple scalar quantities, it can be used to decorate any complex data type (numpy arrays, PyTorch tensors) to provide unit checks.\n\n## Installation and Usage\n\nYou can install the python package from source (you need a rust compiler for that):\n\n```\npip install git+https://github.com/itt-ustutt/quantity\n```\n\nor get the compiled files from PyPI\n\n```\npip install si-units\n```\n\n## Examples\n\nCalculate the pressure of an ideal gas.\n\n```python\nfrom si_units import *\ntemperature = 25.0 * CELSIUS\nvolume = 1.5 * METER**3\nmoles = 75.0 * MOL\npressure = moles * RGAS * temperature / volume\nprint(pressure) # 123.94785148011941 kPa\n```\n\n`numpy` functions can be used with SI units:\n\n```python\nfrom si_units import *\nimport numpy as np\nms = np.linspace(2.0, 4.0, 3) * METER\nsqms = ms**2\nprint(sqms) # [4, 9, 16] m\u00b2\n```\n\n## Documentation\n\nFor the documentation, see [here](https://itt-ustutt.github.io/quantity/index.html).\n\n",
"bugtrack_url": null,
"license": "MIT OR Apache-2.0",
"summary": "Representation of SI unit valued scalars and arrays.",
"version": "0.9.0",
"project_urls": {
"Homepage": "https://github.com/itt-ustutt/quantity/tree/master/si-units",
"Source Code": "https://github.com/itt-ustutt/quantity"
},
"split_keywords": [
"physics",
" units",
" si"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fce1c84f86f7a8212069ef72ad5a6b60477c91e87cbbc50fe401c480ed1791bd",
"md5": "4bd5fd91d36f3a16cbb13a6e88a91bb6",
"sha256": "37ccadd0ce0615519941000df2dbcbfefd6163642c939a60b5fba6b7bc80b19d"
},
"downloads": -1,
"filename": "si_units-0.9.0-cp37-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "4bd5fd91d36f3a16cbb13a6e88a91bb6",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 947256,
"upload_time": "2024-10-24T11:33:59",
"upload_time_iso_8601": "2024-10-24T11:33:59.281142Z",
"url": "https://files.pythonhosted.org/packages/fc/e1/c84f86f7a8212069ef72ad5a6b60477c91e87cbbc50fe401c480ed1791bd/si_units-0.9.0-cp37-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d88f59138acc147fff047642429724bb0f88d33bd6eb68a95acd153a35d987fe",
"md5": "a766c49cdb3cb2fe2bb8e24db65b75e8",
"sha256": "24bab5349dcb1f6c2e32f497b1918fd69b5aee848640d973b50ec6fa5dcf02dd"
},
"downloads": -1,
"filename": "si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "a766c49cdb3cb2fe2bb8e24db65b75e8",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 892222,
"upload_time": "2024-10-24T11:34:00",
"upload_time_iso_8601": "2024-10-24T11:34:00.968391Z",
"url": "https://files.pythonhosted.org/packages/d8/8f/59138acc147fff047642429724bb0f88d33bd6eb68a95acd153a35d987fe/si_units-0.9.0-cp37-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bfe33073277ed8ff9969efed1af46719984c29f03406fee61792ed42211f2c9f",
"md5": "f506a0aedeb5c78c6cec0f514b7dfe73",
"sha256": "e02269bd418ac0bce96269dd041d5f13cefaf6e7bcbaf57085b44c84d41c7f56"
},
"downloads": -1,
"filename": "si_units-0.9.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "f506a0aedeb5c78c6cec0f514b7dfe73",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1080377,
"upload_time": "2024-10-24T11:34:02",
"upload_time_iso_8601": "2024-10-24T11:34:02.493137Z",
"url": "https://files.pythonhosted.org/packages/bf/e3/3073277ed8ff9969efed1af46719984c29f03406fee61792ed42211f2c9f/si_units-0.9.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef65101758d08f872024db7ed29b6617b6aa69ce77419c7d17d65e5338fa9ba9",
"md5": "4b897f7ac65cf347b0b6783406b1ddb6",
"sha256": "5e40d92b5917309a0d45394655cf82c5280c9e04267e94e2612fd6bb8442c96c"
},
"downloads": -1,
"filename": "si_units-0.9.0-cp37-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "4b897f7ac65cf347b0b6783406b1ddb6",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 798843,
"upload_time": "2024-10-24T11:34:04",
"upload_time_iso_8601": "2024-10-24T11:34:04.074933Z",
"url": "https://files.pythonhosted.org/packages/ef/65/101758d08f872024db7ed29b6617b6aa69ce77419c7d17d65e5338fa9ba9/si_units-0.9.0-cp37-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-24 11:33:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "itt-ustutt",
"github_project": "quantity",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "si-units"
}