Skip to main content

physical quantities (numbers with units)

Project description

https://pepy.tech/badge/unit_propagation/month https://github.com/KenKundert/unit_propagation/actions/workflows/build.yaml/badge.svg https://coveralls.io/repos/github/KenKundert/unit_propagation/badge.svg?branch=main https://img.shields.io/pypi/v/unit_propagation.svg https://img.shields.io/pypi/pyversions/unit_propagation.svg
Author: Ken Kundert
Version: 0.2
Released: 2026-06-27

This is a package used to experiment with adding unit propagation to QuantiPhy. It currently employs simple-minded simplification rules that handle many common cases but not all. Also, there is a strong emphasis on simple electrical unit scenarios. Even so, it shows promise for use in well controlled settings.

Here is simple example:

>>> from unit_propagation import UnitPropagatingQuantity as Quantity, QuantiPhyError

>>> try:
...     v = Quantity("2.5V")
...     i = Quantity("100nA")
...     print(v/i)
... except QuantiPhyError as e:
...     print(f"error: {e!s}")
25 MΩ

Operations can also involve integers, floats and strings:

>>> Kvco = Quantity(500e6, "Hz") / "500mV"
>>> print(Kvco)
1 GHz/V

>>> Vdd = Quantity("2.5V")
>>> halfVdd = Vdd / 2
>>> print(halfVdd)
1.25 V

Included in the package is a simple RPN calculator that allows you to explore the capabilities and limitations of unit propagation.

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

unit_propagation-0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unit_propagation-0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file unit_propagation-0.2.tar.gz.

File metadata

  • Download URL: unit_propagation-0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for unit_propagation-0.2.tar.gz
Algorithm Hash digest
SHA256 0d60d261546688922d30786d38ec73a246ee48b6faedecb7d5f4c73ab376d92b
MD5 369a67dd6067ecf9bf3f1f8407cd61b1
BLAKE2b-256 05acb92cfd8338cf1ff53cab5f00556ab3f578d7639e7fed56deed635460f35b

See more details on using hashes here.

File details

Details for the file unit_propagation-0.2-py3-none-any.whl.

File metadata

  • Download URL: unit_propagation-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for unit_propagation-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54e37a754a2e2e98518dc9b9b8eb1aad7bc178b1be2eff53c97d16246b6ef1c2
MD5 32055cc7f2e088073a33f9db7c38071f
BLAKE2b-256 c1573308f78a063ace132f7fc110077439d02a6ae98fa517627523403b34a08e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page