Skip to main content

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.

pypi version Build status

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.

Author

quantities was originally written by Darren Dale, and has received contributions from many people.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantities-0.16.0.tar.gz (100.7 kB view details)

Uploaded Source

Built Distribution

quantities-0.16.0-py3-none-any.whl (102.1 kB view details)

Uploaded Python 3

File details

Details for the file quantities-0.16.0.tar.gz.

File metadata

  • Download URL: quantities-0.16.0.tar.gz
  • Upload date:
  • Size: 100.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for quantities-0.16.0.tar.gz
Algorithm Hash digest
SHA256 211cce2d268da7e202abab5c2533ce3200ff619dd8ac2a3cd98f861b8a57c6eb
MD5 b5e1ce4609083d723f0dbdf29b60331f
BLAKE2b-256 72c0558372afa9b0bb485e56d15eacee7a099cac7fb744c0b2ac17734b4d5468

See more details on using hashes here.

Provenance

File details

Details for the file quantities-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: quantities-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 102.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for quantities-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 189e573953e7864d8c303a3472f6ad39fbe0698c3d75c17059b70bc457c7c66d
MD5 4d6a2f7b5da6a37c3b08304b756ba25e
BLAKE2b-256 8039d28abebdaac6f455109bae1cd6a40caca1f7ff8e877cbbe69ddad8ae0af2

See more details on using hashes here.

Provenance

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