[[ 8. 0. 0. ]
June 3, 2025 ยท View on GitHub
galax
Galactic and Gravitational Dynamics
Installation
pip install galax
Documentation
Coming soon. In the meantime, if you've used gala, then galax should be
familiar!
Quick example
Let's compute an orbit!
import jax.numpy as jnp
import unxt as u
import coordinax as cx
import galax.coordinates as gc
import galax.dynamics as gd
import galax.potential as gp
w = gc.PhaseSpaceCoordinate(
q=u.Quantity([8, 0, 0], "kpc"),
p=u.Quantity([0, 220, 0], "km/s"),
t=u.Quantity(0, "Myr"),
)
pot = gp.MilkyWayPotential()
orbit = gd.evaluate_orbit(pot, w, u.Quantity(jnp.linspace(0, 1, 100), "Gyr"))
print(orbit)
# Orbit(
# q=<CartesianPos3D: (x, y, z) [kpc]
# [[ 8. 0. 0. ]
# ...
# [ 7.804 -0.106 0. ]]>,
# p=<CartesianVel3D: (x, y, z) [kpc / Myr]
# [[ 0. 0.225 0. ]
# ...
# [ 0.018 0.23 0. ]]>,
# t=Quantity(Array([0., ..., 1000.], dtype=float64), unit='Myr')
# )
orbit_sph = orbit.vconvert(cx.vecs.LonLatSphericalPos)
print(orbit_sph)
# Orbit(
# q=<LonLatSphericalPos: (lon[rad], lat[deg], distance[kpc])
# [[0.000e+00 3.858e-16 8.000e+00]
# ...
# [6.270e+00 3.858e-16 7.805e+00]]>,
# p=<LonLatSphericalVelocity (lon[rad / Myr], lat[deg / Myr], distance[kpc / Myr])
# [[ 0.028 0. 0. ]
# ...
# [ 0.03 0. 0.015]]>,
# t=Quantity(Array([0., ..., 1000.], dtype=float64), unit='Myr')
# )
Citation
If you found this library to be useful in academic work, then please cite.
Development
We welcome contributions!
Galax uses uv for development dependency
management (make sure you have uv version >=0.4.27 installed). For example, to
run the test suite, install the test group and run pytest with:
uv sync --group test
uv run pytest src docs tests
Contributors
See the AUTHORS.rst file for a complete list of contributors to the project.
The GalacticDynamics/galax
maintainers would like to thank
@Michael Anckaert for transferring the
galax project domain on PyPI for use by this package. Without
his generosity this package would have had a worse name.