physipy¶
physipy lets you manipulate physical quantities in Python — the association
of a value (a scalar, a numpy.ndarray, and more) with a physical unit (such as
meter or joule). Dimensional consistency is enforced automatically.
from physipy import units, constants
nm = units["nm"] # nanometer
hp = constants["h"] # Planck's constant
c = constants["c"] # speed of light
E_ph = hp * c / (500 * nm) # energy of a 500 nm photon
print(E_ph) # 3.9728917142978567e-19 kg*m**2/s**2
E_ph.favunit = units["J"] # choose a display ("favourite") unit
print(E_ph) # 3.9728917142978567e-19 J
Where to go next¶
- Installation — install from PyPI, including the optional extras.
- Quickstart — a guided tour of physipy by example.
- Scientific stack — integration with numpy, matplotlib, pandas, scipy, and the standard math module.
- API reference —
Dimension,Quantity, units, constants, plotting. - Comparison with other packages — how physipy compares to pint, astropy.units, unyt and others, plus benchmarks.
- Development — contributing, benchmarking, and performance.
At a glance¶
- Light-weight — two core classes,
DimensionandQuantity. - numpy-friendly — 150+ functions and ufuncs work transparently on quantities.
- Lean by default — only numpy is required; scipy, matplotlib and sympy are optional extras.
- Typed — ships inline type hints (PEP 561).
Source code and issues live on GitHub; releases are on PyPI.