qunits logo qunits logo

A performant, verbose and generic physical unit system.

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qunits.prefix. Context[source]

The context of a unit distinguishes quantities of the same dimension that must not be mixed. Quantities can only be added, subtracted or converted into each other if their units have the same context.

A product of a unit with a context and a unit without one keeps the context, e.g. u.pi * u.kHz, and so does the quotient of a unit with a context by a unit without one, e.g. u.rad / u.s. Other products, quotients and powers have the context I.

Attributes:
I0

No context.

ANGLE1

Angles, e.g. u.rad and u.pi. np.sin, np.cos and np.tan require this context.