Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 3.79 KB

README.md

File metadata and controls

116 lines (90 loc) · 3.79 KB

galax

Galactic and Gravitational Dynamics

Installation

PyPI platforms PyPI version

pip install galax

Documentation

Documentation Status

Coming soon. In the meantime, if you've used gala, then galax should be familiar!

Quick example

Let's compute an orbit!

import coordinax as cx
import galax.coordinates as gc
import galax.dynamics as gd
import galax.potential as gp
import jax.numpy as jnp
from unxt import Quantity

w = gc.PhaseSpacePosition(
    q=Quantity([8, 0, 0], "kpc"),
    p=Quantity([0, 220, 0], "km/s"),
    t=Quantity(0, "Myr"),
)

pot = gp.MilkyWayPotential()

orbit = gd.evaluate_orbit(pot, w, Quantity(jnp.linspace(0, 1, 100), "Gyr"))
print(orbit)
# Orbit(
#     q=<CartesianPosition3D (x[kpc], y[kpc], z[kpc])
#         [[ 8.     0.     0.   ]
#          ...
#          [ 7.804 -0.106  0.   ]]>,
#     p=<CartesianVelocity3D (d_x[kpc / Myr], d_y[kpc / Myr], d_z[kpc / Myr])
#         [[ 0.     0.225  0.   ]
#          ...
#          [ 0.018  0.23   0.   ]]>,
#     t=Quantity['time'](Array([0., ..., 1000.], dtype=float64), unit='Myr'),
#     potential=MilkyWayPotential(...)
# )

orbit_sph = orbit.represent_as(cx.LonLatSphericalPosition)
print(orbit_sph)
# Orbit(
#     q=<LonLatSphericalPosition (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 (d_lon[rad / Myr], d_lat[deg / Myr], d_distance[kpc / Myr])
#         [[ 0.028  0.     0.   ]
#          ...
#          [ 0.03   0.     0.015]]>,
#     t=Quantity['time'](Array([0., ..., 1000.], dtype=float64), unit='Myr'),
#     potential=MilkyWayPotential(...})
# )

Citation

DOI

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

Development

Actions Status

We welcome contributions!

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.