Support for physical quantities with units, based on numpy
Project description
Quantities is designed to handle arithmetic and conversions of physical quantities, which have a magnitude, dimensionality specified by various units, and possibly an uncertainty. See the tutorial for examples. Quantities builds on the popular numpy library and is designed to work with numpy ufuncs, many of which are already supported. Quantities is actively developed, and while the current features and API are stable, test coverage is incomplete so the package is not suggested for mission-critical applications.
A Python package for handling physical quantities. The source code and issue tracker are hosted on GitHub:
https://www.github.com/python-quantities/python-quantities
Download
Get the latest version of quantities from https://pypi-hypernode.com/pypi/quantities/
To get the Git version do:
$ git clone git://github.com/python-quantities/python-quantities.git
Documentation and usage
You can find the official documentation at:
http://python-quantities.readthedocs.io/
Here is a simple example:
>>> import quantities as pq
>>> distance = 42*pq.metre
>>> time = 17*pq.second
>>> velocity = distance / time
>>> "%.3f %s" % (velocity.magnitude, velocity.dimensionality)
'2.471 m/s'
>>> velocity + 3
Traceback (most recent call last):
...
ValueError: Unable to convert between units of "dimensionless" and "m/s"
Installation
quantities has a hard dependency on the NumPy library. You should install it first, please refer to the NumPy installation guide:
http://docs.scipy.org/doc/numpy/user/install.html
To install quantities itself, then simply run:
$ pip install quantities
Tests
To execute all tests, install pytest:
$ python -m pip install pytest
And run:
$ pytest
in the current directory. The master branch is automatically tested by GitHub Actions.
License
Quantities only uses BSD compatible code. See the Open Source Initiative licenses page for details on individual licenses.
See doc/user/license.rst for further details on the license of quantities
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 Distribution
Built Distribution
File details
Details for the file quantities-0.15.0.tar.gz
.
File metadata
- Download URL: quantities-0.15.0.tar.gz
- Upload date:
- Size: 99.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ea31e2a0d7517cf24d546b14146def9292639993a616cca61b875ef796b4b2b |
|
MD5 | ae0abd7801a73e5b7769a6354dcda0e6 |
|
BLAKE2b-256 | 061ad7288e6293d6ca10b0dd7a94a9ee9462cd2f2031ee52e135ff7efc04cfef |
Provenance
File details
Details for the file quantities-0.15.0-py3-none-any.whl
.
File metadata
- Download URL: quantities-0.15.0-py3-none-any.whl
- Upload date:
- Size: 101.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 589bdadcbbdc1c10950120c6d197f7e71ac145512a4b4ac5fd40d4946709d6ec |
|
MD5 | 2840b57e8c263f4309cd38b13057834a |
|
BLAKE2b-256 | 3aaa2d37dc5a180585b8b10aac671529625b72c8a6908b6b8b8bf0b1f8e35101 |