coordinax
Coordinates in JAX
Coordinax enables calculations with coordinates in JAX. Built on Equinox and Quax.
Installation
pip install coordinax
Documentation
Quick example
import jax.numpy as jnp
import unxt as u
import coordinax as cx
q = cx.CartesianPos3D(
x=u.Quantity(jnp.arange(0, 10.0), "kpc"),
y=u.Quantity(jnp.arange(5, 15.0), "kpc"),
z=u.Quantity(jnp.arange(10, 20.0), "kpc"),
)
print(q)
# <CartesianPos3D: (x, y, z) [kpc]
# [[ 0. 5. 10.]
# [ 1. 6. 11.]
# ...
# [ 8. 13. 18.]
# [ 9. 14. 19.]]>
q2 = cx.vconvert(cx.SphericalPos, q)
print(q2)
# <SphericalPos: (r[kpc], theta[rad], phi[rad])
# [[11.18 0.464 1.571]
# [12.57 0.505 1.406]
# ...
# [23.601 0.703 1.019]
# [25.259 0.719 0.999]]>
p = cx.CartesianVel3D(
x=u.Quantity(jnp.arange(0, 10.0), "km/s"),
y=u.Quantity(jnp.arange(5, 15.0), "km/s"),
z=u.Quantity(jnp.arange(10, 20.0), "km/s"),
)
print(p)
# <CartesianVel3D: (x, y, z) [km / s]
# [[ 0. 5. 10.]
# [ 1. 6. 11.]
# ...
# [ 8. 13. 18.]
# [ 9. 14. 19.]]>
p2 = cx.vconvert(cx.SphericalVel, p, q)
print(p2)
# <SphericalVel: (r[km / s], theta[km rad / (km s)], phi[km rad / (km s)])
# [[ 1.118e+01 -3.886e-16 0.000e+00]
# [ 1.257e+01 -1.110e-16 0.000e+00]
# ...
# [ 2.360e+01 0.000e+00 0.000e+00]
# [ 2.526e+01 -2.776e-16 0.000e+00]]>
# Transforming between frames
icrs_frame = cx.frames.ICRS()
gc_frame = cx.frames.Galactocentric()
op = cxf.frame_transform_op(icrs_frame, gc_frame)
q_gc, p_gc = op(q, p)
print(q_gc, p_gc, sep="\n")
# <CartesianPos3D: (x, y, z) [kpc]
# [[-1.732e+01 5.246e+00 3.614e+00]
# ...
# [-3.004e+01 1.241e+01 -1.841e+00]]>
# <CartesianVel3D: (x, y, z) [km / s]
# [[ 3.704 250.846 11.373]
# ...
# [ -9.02 258.012 5.918]]>
coord = cx.Coordinate({"length": q, "speed": p}, frame=icrs_frame)
print(coord)
# Coordinate(
# KinematicSpace({
# 'length': <CartesianPos3D: (x, y, z) [kpc]
# [[ 0. 5. 10.]
# ...
# [ 9. 14. 19.]]>,
# 'speed': <CartesianVel3D: (x, y, z) [km / s]
# [[ 0. 5. 10.]
# ...
# [ 9. 14. 19.]]>
# }),
# frame=ICRS()
# )
print(coord.to_frame(gc_frame))
# Coordinate(
# KinematicSpace({
# 'length': <CartesianPos3D: (x, y, z) [kpc]
# [[-1.732e+01 5.246e+00 3.614e+00]
# ...
# [-3.004e+01 1.241e+01 -1.841e+00]]>,
# 'speed': <CartesianVel3D: (x, y, z) [km / s]
# [[ 3.704 250.846 11.373]
# ...
# [ -9.02 258.012 5.918]]>
# }),
# frame=Galactocentric( ... )
# )
Citation
If you found this library to be useful in academic work, then please cite.
Development
We welcome contributions!
Metadata
Release files for coordinax 0.23.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| coordinax-0.23.3.tar.gz | 757.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coordinax-0.23.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 952.5 kB
Release files / coordinax-0.23.3.tar.gz
| Download URL | coordinax-0.23.3.tar.gz |
|---|---|
| Size | 757.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48eb3f63a5bd7475039e9562c22c51318435e4a8e3c0d29192137f00e66f94e5
|
|
BLAKE2b-256 checksum How to use checksums |
ad0099c32e07b37624384d5515f2d4cbdf9f1ff46ee6746cd402f6883fb2df94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2026.
Transparency logRelease files / coordinax-0.23.3-py3-none-any.whl
| Download URL | coordinax-0.23.3-py3-none-any.whl |
|---|---|
| Size | 195.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
115d411963f907728ae25528c69e490937657aa9e787e130c0c97458df5ab8dd
|
|
BLAKE2b-256 checksum How to use checksums |
47b26e655239636458e9ff363e0c1a3caddefaddea2990ed8f32f82e156bd664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2026.
Transparency log