Gala: A Python package for galactic dynamics


The forces on stars, galaxies, and dark matter under external gravitational fields lead to the dynamical evolution of structures in the universe. The orbits of these bodies are therefore key to understanding the formation, history, and future state of galaxies. The field of "galactic dynamics," which aims to model the gravitating components of galaxies to study their structure and evolution, is now well-established, commonly taught, and frequently used in astronomy. Aside from toy problems and demonstrations, the majority of problems require efficient numerical tools, many of which require the same base code (e.g., for performing numerical orbit integration).

Gala is an Astropy-affiliated Python package for galactic dynamics. Python enables wrapping low-level languages (e.g., C) for speed without losing flexibility or ease-of-use in the user-interface. The API for Gala was designed to provide a class-based and user-friendly interface to fast (C or Cython-optimized) implementations of common operations such as gravitational potential and force evaluation, orbit integration, dynamical transformations, and chaos indicators for nonlinear dynamics. Gala also relies heavily on and interfaces well with the implementations of physical units and astronomical coordinate systems in the Astropy package (Astropy Collaboration et al. 2013) (astropy.units and astropy.coordinates).

Gala was designed to be used by both astronomical researchers and by students in courses on gravitational dynamics or astronomy. It has already been used in a number of scientific publications (Pearson, Price-Whelan, and Johnston 2017) and has also been used in graduate courses on Galactic dynamics to, e.g., provide interactive visualizations of textbook material (Binney and Tremaine 2008). The combination of speed, design, and support for Astropy functionality in Gala will enable exciting scientific explorations of forthcoming data releases from the Gaia mission (Gaia Collaboration et al. 2016) by students and experts alike. The source code for Gala has been archived to Zenodo with the linked DOI: (Price-Whelan et al. 2017)


We acknowledge contributions from Brigitta Sipocz, Syrtis Major, and Semyeong Oh, and support from Kathryn Johnston during the genesis of this project.


Astropy Collaboration, T. P. Robitaille, E. J. Tollerud, P. Greenfield, M. Droettboom, E. Bray, T. Aldcroft, et al. 2013. “Astropy: A community Python package for astronomy” 558 (October): A33. doi:10.1051/0004-6361/201322068.

Binney, J., and S. Tremaine. 2008. Galactic Dynamics: Second Edition. Princeton University Press.

Gaia Collaboration, T. Prusti, J. H. J. de Bruijne, A. G. A. Brown, A. Vallenari, C. Babusiaux, C. A. L. Bailer-Jones, et al. 2016. “The Gaia mission” 595 (November): A1. doi:10.1051/0004-6361/201629272.

Pearson, S., A. M. Price-Whelan, and K. V. Johnston. 2017. “Gaps in Globular Cluster Streams: Pal 5 and the Galactic Bar.” ArXiv E-Prints, March.

Price-Whelan, Adrian, Brigitta Sipocz, Syrtis Major, and Semyeong Oh. 2017. “Adrn/Gala: V0.2.1,” July. Zenodo. doi:10.5281/zenodo.833339.