Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Quantities package for the python programming language

NotificationsYou must be signed in to change notification settings

python-quantities/python-quantities

Repository files navigation

Quantities is designed to handle arithmetic andconversions of physical quantities, which have a magnitude, dimensionalityspecified by various units, and possibly an uncertainty. See thetutorialfor examples. Quantities builds on the popular numpy library and isdesigned to work with numpy ufuncs, many of which are alreadysupported. Quantities is actively developed, and while the current featuresand API are stable, test coverage is incomplete so the package is notsuggested for mission-critical applications.

pypi versionBuild status

A Python package for handling physical quantities. The source code and issuetracker are hosted on GitHub:

https://www.github.com/python-quantities/python-quantities

Download

Get the latest version of quantities fromhttps://pypi.python.org/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:

>>>importquantitiesaspq>>>distance=42*pq.metre>>>time=17*pq.second>>>velocity=distance/time>>>"%.3f %s"% (velocity.magnitude,velocity.dimensionality)'2.471 m/s'>>>velocity+3Traceback (mostrecentcalllast):  ...ValueError:Unabletoconvertbetweenunitsof"dimensionless"and"m/s"

Installation

quantities has a hard dependency on theNumPy 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 byGitHub Actions.

Author

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

License

Quantities only uses BSD compatible code. See the Open SourceInitiativelicenses pagefor details on individual licenses.

Seedoc/user/license.rst for further details on the license of quantities

About

Quantities package for the python programming language

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors33

Languages


[8]ページ先頭

©2009-2025 Movatter.jp