NumPy integrationΒΆ
Install the optional extra:
pip install unitflow[numpy]
Array-backed Quantity values participate in NumPy ufuncs where dimensions allow. Trigonometry and similar functions require dimensionless arguments in radians where applicable.
Example (from the project README pattern):
import numpy as np
from unitflow import Quantity, kg, m, s, rad
masses = Quantity(np.array([1.0, 2.0, 5.0, 10.0]), kg)
accels = Quantity(np.array([9.81, 9.81, 9.81, 9.81]), m / s**2)
forces = masses * accels
angles = Quantity(np.array([0, np.pi / 2, np.pi]), rad)
_ = np.sin(angles)
The semantic core imports without NumPy; keep optional imports in application code if you need to support environments without NumPy installed.
API: unitflow.backends.