Natural units in Python
Project description
Natural units in Python
natu is a free, open-source package to represent physical quantities. There are many Python packages that deal with units and quantities, but natu is uniquely system-independent. The units are derived from physical constants with adjustable values and dimensions. The value of a unit is factored into a quantity so that the quantity is not “in” any particular unit. This has the following advantages:
Flexibility: Different unit systems, including natural units (hence the name “natu”), can be represented by simply adjusting the physical constants.
Simplicity: Unit conversion is inherent. This results in quick computations and a small code base. By default, dimensions and display units are tracked to catch errors and for string formatting, respectively. However, this can be turned off to reduce the computational overhead to nearly zero while still providing the core features.
Scalability: The values of the base physical constants can scaled to prevent exponent overflow, regardless of the units used.
Intuitive: Each unit is a fixed quantity which can be treated as a mathematical entity. A variable quantity is expressed as the product of a number and a unit, as stated by BIPM.
Representative: The structure of the package reflects the way modern units are defined: standards organizations such as NIST assign values to universal physical constants so that the values of units can be determined by physical experiments instead of prototypes.
For example, you can do this:
>>> from natu.units import degC, K >>> print(0*degC + 100*K) 100.0 degC
Please see the tutorial for more examples. For the full documentation, please visit the main website.
Installation
The easiest way to install natu is to use pip:
> pip install natu
On Linux, it may be necessary to have root privileges:
$ sudo pip install natu
License terms and development
natu is published under a BSD-compatible license. Please share any improvements you make, preferably as a pull request to the master branch of the GitHub repository. There are useful development scripts in the hooks folder. If you find a bug, have a suggestion, or just want to leave a comment, please open an issue.
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
File details
Details for the file natu-0.1.0-a4.tar.gz
.
File metadata
- Download URL: natu-0.1.0-a4.tar.gz
- Upload date:
- Size: 153.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 656c399452704ea4634a421034ea70a0805c5d20d72bfa443eb50ec50b97ff5c |
|
MD5 | a8fe7b72fd8f1ac4b9c2ac7cbfc78bb9 |
|
BLAKE2b-256 | 3e50ea1c1a0877f642f4fb9e84a597d28261be67b9c866437387f6b320f15c40 |