A package for handling numpy arrays with units
Project description
unyt
A package for handling numpy arrays with units.
Often writing code that deals with data that has units can be confusing. A function might return an array but at least with plain NumPy arrays, there is no way to easily tell what the units of the data are without somehow knowing a priori.
The unyt package (pronounced like “unit”) provides a subclass of NumPy’s ndarray class that knows about units. For example, one could do:
>>> import unyt as u >>> distance_traveled = [3.4, 5.8, 7.2] * u.mile >>> print(distance_traveled.to('km')) [ 5.4717696 9.3341952 11.5872768] km
And a whole lot more! See the documentation for installation instructions, more examples, and full API reference.
This package only depends on numpy, sympy, six and, on Python 2.7, backports.functools_lru_cache (a backport of functools.lru_cache). Notably, it does not depend on yt and it is written in pure Python.
Code of Conduct
The unyt package is part of The yt Project. Participating in unyt development therefore happens under the auspices of the yt community code of conduct. If for any reason you feel that the code of conduct has been violated, please send an e-mail to confidential@yt-project.org with details describing the incident. All emails sent to this address will be treated with the strictest confidence by an individual who does not normally participate in yt development.
License
The unyt package is licensed under the BSD 3-clause license.
Citation
If you make use of unyt in a publication we would appreciate a mention in the text of the paper or in the acknowledgements.
We have submitted a paper to the Journal of Open Source Software. A preprint is available on the arxiv. We would appreciate a citation (BibTeX) to the paper if you make use of unyt for work that leads to a publication.
History
unyt began life as a submodule of yt named yt.units.
It was separated from yt.units as its own package in 2018.
1.0.7 (2018-08-13)
Trigger zenodo archiving.
1.0.6 (2018-08-13)
Minor paper updates to finalize JOSS submission.
1.0.5 (2018-08-03)
unyt 1.0.5 includes changes that reflect the peew review process for the JOSS method paper. The peer reviewers were Stuart Mumfork (@cadair), Trevor Bekolay (@tbekolay), and Yan Grange (@ygrange). The editor was Kyle Niemeyer (@kyleniemeyer). The` unyt` development team thank our reviewers and editor for their help getting the unyt paper out the door as well as for the numerous comments and suggestions that improved the paper and package as a whole.
In addition we’d like to thank Mike Zingale, Meagan Lang, Maksin Ratkin, DougAJ4, Ma Jianjun, Paul Ivanov, and Stephan Hoyer for reporting issues.
Added docstrings for the custom exception classes defined by unyt. See PR #44.
Added improved documentation to the contributor guide on how to run the tests and what the PR review guidelines are. See PR #43.
Updates to the text of the method paper in response to reviewer suggestions. See PR #42.
It is now possible to run the tests on an installed copy of unyt by executing unyt.test(). See PR #41.
Minor edit to LICENSE file so GitHub recognizes it. See PR #40. Thank you to Kyle Sunden (@ksunden) for the contribution.
Add spatial frequency as a dimension and added support in the spectral equivalence for the spatial frequency dimension. See PR #38 Thank you to Kyle Sunden (@ksunden) for the contribution.
Add support for Python 3.7. See PR #37.
Importing unyt will now fail if numpy and sympy are not installed. See PR #35
Testing whether a unit name is contained in a unit registry using the Python in keyword will now work correctly for all unit names. See PR #31.
The aliases for megagram in the top-level unyt namespace were incorrectly set to reference kilogram and now have the correct value. See PR #29.
Make it possible to take scalars to dimensionless array powers with a properly broadcasted result without raising an error about units. See PR #23.
Whether or not a unit is allowed to be SI-prefixable (for example, meter is SI-prefixable to form centimeter, kilometer, and many other units) is now stored as metadata in the unit registry rather than as global state inside unyt. See PR #21.
Made adjustments to the rules for converting between CGS and MKS E&M units so that errors are only raised when going between unit systems and not merely when doing a complicated unit conversion invoving E&M units. See PR #20.
round(q) where q is a unyt_quantity instance will no longer raise an error and will now return the nearest rounded float. See PR #19.
Fixed a typo in the readme. Thank you to Paul Ivanov (@ivanov) for the fix.
Added smoot as a unit. See PR #14.
1.0.4 (2018-06-08)
Expand installation instructions
Mention paper and arxiv submission in the readme.
1.0.3 (2018-06-06)
Fix readme rendering on pypi
1.0.2 (2018-06-06)
Added a paper to be submitted to the Journal of Open Source Software.
Tweaks for the readme
1.0.1 (2018-05-24)
Don’t use setup_requires in setup.py
1.0.0 (2018-05-24)
First release on PyPI.
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 unyt-1.0.7.tar.gz
.
File metadata
- Download URL: unyt-1.0.7.tar.gz
- Upload date:
- Size: 323.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d616e9db66f21520cbf6a2a44c9994ea781b5c0774e463f71c41a6660fe15cfd |
|
MD5 | 83e18babb11fc602e37de9f655ebeae8 |
|
BLAKE2b-256 | ad72efa48eb9625c9706dabaad6cf6a26a975e128bcbba424389c7184faa6886 |
File details
Details for the file unyt-1.0.7-py2.py3-none-any.whl
.
File metadata
- Download URL: unyt-1.0.7-py2.py3-none-any.whl
- Upload date:
- Size: 72.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed63dafab49b57fa64cab3e97092c8f0d68233cc7726b25910b53aceb17f48b1 |
|
MD5 | c33f86060a9df0ce787e7f7d663a7772 |
|
BLAKE2b-256 | 4b9eea77ac8c003a1345efcb877190003a374cf544fae58f1a503522e41a1a91 |