Skip to content

Units

Physical quantity types for type-safe unit handling.

Available Units

Angle

Constant Value
rad 1 radian
deg π/180 radians

Distance

Constant Value
m 1 meter
km 1000 meters
au 1 astronomical unit

Frequency

Constant Value
hz 1 Hz
khz 1 kHz
mhz 1 MHz
ghz 1 GHz
thz 1 THz

Velocity

Constant Value
ms 1 m/s
kms 1 km/s

Quick Example

import lox_space as lox

# Use unit constants for readable code
angle = 45 * lox.deg
distance = 100 * lox.km
frequency = 2.4 * lox.ghz
velocity = 7.8 * lox.kms

# Convert to float
angle_rad = float(angle)
distance_m = float(distance)

Angle

Angle type for type-safe angular values.

Use with unit constants: 45 * lox.deg or 1.5 * lox.rad Convert to float with float(angle).


Distance

Distance type for type-safe length values.

Use with unit constants: 100 * lox.km or 1.5 * lox.au Convert to float with float(distance).


Frequency

Frequency type for type-safe frequency values.

Use with unit constants: 2.4 * lox.ghz or 100 * lox.mhz Convert to float with float(frequency).


Velocity

Velocity type for type-safe speed values.

Use with unit constants: 7.8 * lox.kms or 100 * lox.ms Convert to float with float(velocity).