Skip to main content

coordinax

Coordinates in JAX

PyPI: coordinax PyPI versions: coordinax ReadTheDocs coordinax license

CI status ReadTheDocs codecov ruff ruff pre-commit


Coordinax enables calculations with coordinates in JAX. Built on Equinox and Quax.

Installation

PyPI platforms PyPI version

pip install coordinax

Documentation

Read The Docs

Quick example

import jax.numpy as jnp
import unxt as u
import coordinax as cx

q = cx.CartesianPos3D(
    x=u.Q(jnp.arange(0, 10.0), "kpc"),
    y=u.Q(jnp.arange(5, 15.0), "kpc"),
    z=u.Q(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.Q(jnp.arange(0, 10.0), "km/s"),
    y=u.Q(jnp.arange(5, 15.0), "km/s"),
    z=u.Q(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 / (kpc s)], phi[km rad / (kpc s)])
#     [[ 1.118e+01  2.980e-08  0.000e+00]
#      [ 1.257e+01  1.192e-07  1.490e-08]
#      ...
#      [ 2.360e+01  8.941e-08  0.000e+00]
#      [ 2.526e+01  2.086e-07  2.980e-08]]>


# Transforming between frames
icrs_frame = cx.frames.ICRS()
gc_frame = cx.frames.Galactocentric()
op = cx.frames.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(
#   {
#     '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(
#   {
#     '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

DOI

If you found this library to be useful in academic work, then please cite.

Development

Actions Status Documentation Status codecov SPEC 0 — Minimum Supported Dependencies pre-commit ruff

We welcome contributions!

Metadata

Release files for coordinax 0.24.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coordinax 0.24.0
File Size Uploaded
coordinax-0.24.0.tar.gz 729.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coordinax 0.24.0
File Interpreter ABI Platform
coordinax-0.24.0-py3-none-any.whl Python 3 none any Details

Total release size: 924.7 kB

Release files / coordinax-0.24.0.tar.gz

Download URL coordinax-0.24.0.tar.gz
Size 729.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0d0cf1f4ea807129bc4194834a736206cfa89d825510947c7f9a025b28fdc3e9
BLAKE2b-256 checksum
How to use checksums
89f28564d8d367b47a4dd5b6ab6273a052059e7781bd642bd5cb192c7acbf04c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / coordinax-0.24.0-py3-none-any.whl

Download URL coordinax-0.24.0-py3-none-any.whl
Size 195.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fad1e28f9e1e18018f516d0f00950f17e0b95a9dfc62a860c2d0ac1113f7b6b5
BLAKE2b-256 checksum
How to use checksums
bdfbb542d17b9987b8aaffd24574ea66e501ee1028394e9d570f5adb5b2ae329
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.24.3

2 release files

0.24.2

2 release files

This release

0.24.0 This release

2 release files

0.23.5

2 release files

0.23.4

2 release files

0.23.2

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.22

2 release files

0.18.3

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.14.0

2 release files

0.13.4

2 release files

0.13.3

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.3

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page