Skip to main content

Coordinates in JAX

Project description

coordinax

Coordinates in JAX

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

Installation

PyPI platforms PyPI version

pip install coordinax

Documentation

Documentation Status

Coming soon. In the meantime, if you've used astropy.coordinates, then coordinax should be fairly intuitive.

Quick example

import coordinax as cx
import jax.numpy as jnp
from unxt import Quantity

q = cx.CartesianPosition3D(
    x=Quantity(jnp.arange(0, 10.0), "km"),
    y=Quantity(jnp.arange(5, 15.0), "km"),
    z=Quantity(jnp.arange(10, 20.0), "km"),
)
print(q)
# <CartesianPosition3D (x[km], y[km], z[km])
#     [[ 0.  5. 10.]
#      [ 1.  6. 11.]
#      ...
#      [ 8. 13. 18.]
#      [ 9. 14. 19.]]>

q2 = cx.represent_as(q, cx.SphericalPosition)
print(q2)
# <SphericalPosition (r[km], 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.CartesianVelocity3D(
    d_x=Quantity(jnp.arange(0, 10.0), "m/s"),
    d_y=Quantity(jnp.arange(5, 15.0), "m/s"),
    d_z=Quantity(jnp.arange(10, 20.0), "m/s"),
)
print(p)
# <CartesianVelocity3D (d_x[m / s], d_y[m / s], d_z[m / s])
#     [[ 0.  5. 10.]
#      [ 1.  6. 11.]
#      ...
#      [ 8. 13. 18.]
#      [ 9. 14. 19.]]>

p2 = cx.represent_as(p, cx.SphericalVelocity, q)
print(p2)
# <SphericalVelocity (d_r[m / s], d_theta[m rad / (km s)], d_phi[m 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]]>

Citation

DOI

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

Development

Actions Status

We welcome contributions!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coordinax-0.7.1.tar.gz (61.4 kB view details)

Uploaded Source

Built Distribution

coordinax-0.7.1-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

Details for the file coordinax-0.7.1.tar.gz.

File metadata

  • Download URL: coordinax-0.7.1.tar.gz
  • Upload date:
  • Size: 61.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for coordinax-0.7.1.tar.gz
Algorithm Hash digest
SHA256 435724f49337ecc50a0c405e20cd216a6e3e8beffc9b879df673d6d9b4f8d9cc
MD5 ca15aee3d23e9b261dd8854f3f2b3c66
BLAKE2b-256 27297fea5d9301bd8288595c27b7cd56cb64bdf2144ba01a505748c38f2a1e16

See more details on using hashes here.

File details

Details for the file coordinax-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: coordinax-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 77.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for coordinax-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f837b545af333657aa7c703e21e20da59c8b34730f6db7a57f49a063120dd20
MD5 dd379ceddca9ec4cc84f185cf5714ef0
BLAKE2b-256 f74fd1bf8a918bdcb55f631c12531f6330e5be5c2d39ed075a039f025a2ee9ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page