The qunits Python package provides a performant, verbose and generic physical unit system. Tutorials and the API documentation are available on the Homepage. Additional example scripts can be found in the example folder on GitHub.
from qunits import u
q = 2 * u.e # >>> 2.0 e
v = 2e5 * u.m / u.s # >>> 200000.0 m/s
B = 0.42 * u.mT # >>> 0.42 mT
F = q * v * B # >>> 168000.0 e⋅m⋅mT/s
F = F.to_base_units() # >>> 2.6916567451199998e-17 N
F = F.to(u.e * u.V / u.m) # >>> 168.0 e⋅V/m- dimension: Contains the dimension definitions.
- prefix: Contains resources for prefix handling.
- registry: Contains the unit registry
u. - unit: Contains the
Unitand theQuantityclasses.