Physities Documentation¶
Physities is a high-performance Python library for representing and working with physical quantities and units. It features dimensional analysis, unit conversion, and mathematical operations on physical measurements, powered by a Rust core for optimal performance.
Features¶
Type-safe operations: Automatic dimensional analysis prevents unit errors
Elegant syntax: Create composite units with operators (
Meter / Second)Unit conversion: Convert between compatible units with dimension checking
High performance: Rust backend using ndarray for linear algebra
NumPy interoperability: Works seamlessly with NumPy arrays
Quick Example¶
from physities.src.unit import Meter, Second, Kilometer, Hour
# Create composite unit types
MetersPerSecond = Meter / Second
KilometersPerHour = Kilometer / Hour
# Create values
v1 = MetersPerSecond(40) # 40 m/s
v2 = KilometersPerHour(144) # 144 km/h
# Convert between units
v3 = v2.convert(MetersPerSecond) # 40 m/s
# Comparison works across compatible units
assert v1 == v2 # True: 40 m/s == 144 km/h
Contents¶
Getting Started
Tutorials
API Reference
Performance