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.3

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.3
File Size Uploaded
coordinax-0.24.3.tar.gz 729.9 kB Details

Built distribution (wheel)

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

Total release size: 925.3 kB

Release files / coordinax-0.24.3.tar.gz

Download URL coordinax-0.24.3.tar.gz
Size 729.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b0e3b4815904a3ac49e8e79b8a77d9f8fcbbb2ad551715ced216ab2e1a326b9b
BLAKE2b-256 checksum
How to use checksums
0be9368bb23a25fc71a45dbab647abb94abe2fd1ea1cf75b5e1a7b84ed658e99
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 16, 2026.

Transparency log

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

Download URL coordinax-0.24.3-py3-none-any.whl
Size 195.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b458f0b14d709dc9f14224bfeca80f35fbd247d08079449fe0f65e603b6b0bc1
BLAKE2b-256 checksum
How to use checksums
cf373c5f0e03c0ef69cbea3245c17cde4466328193ba9f8a32c58839c4fc7a26
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 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.24.3 This release

2 release files

0.24.2

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