How-to guides#
Directions for getting a specific job done. These pages assume you already know what you want and are looking for the shortest route to it.
If you are new to unxt, work through Your first calculation with units first โ these guides will not teach you the basics.
Getting set up#
How to install unxt โ install
unxtand its optional packages.How to migrate to v2 โ upgrade from
unxtv1.
Working with quantities#
How to convert between units โ
uconvert,ustripanduconvert_value.How to compare quantities โ
is_unit_convertible,equivalentand==.How to wrap angles to a range โ map an angle onto a branch cut.
How to pass a quantity as a jax.jit static argument โ
StaticQuantityandStaticValueunderjax.jit.How to use JAX functions with quantities โ
quaxify,quaxed,jit, autodiff and functional updates.How to control how quantities are displayed โ change how quantities render, for a call, a block, a process or a project.
Units and unit systems#
How to define a unit system โ write your own
AbstractUnitSystemsubclass.How to build a unit system where G = 1 โ a system where \(G = 1\), for dynamics codes.
How to work in natural units โ worked examples in HEP, geometrized, atomic and Planck units.
Correctness and speed#
How to check quantity types at runtime โ enforce dtype and shape annotations at runtime.
How to optimize performance with unitful quantities โ keep wrapper overhead off your hot path.
How to teach JAX a new primitive rule โ teach JAX a primitive rule of your own.
How to interoperate with astropy โ move values between
astropyandunxtsafely.