|
| 1 | +--- |
| 2 | +title: 'Gala: A Python package for galactic dynamics' |
| 3 | +tags: |
| 4 | + - Python |
| 5 | + - astronomy |
| 6 | + - dynamics |
| 7 | + - galactic dynamics |
| 8 | + - milky way |
| 9 | +authors: |
| 10 | + - name: Adrian M. Price-Whelan |
| 11 | + orcid: 0000-0000-0000-0000 |
| 12 | + equal-contrib: true |
| 13 | + affiliation: "1, 2" # (Multiple affiliations must be quoted) |
| 14 | + - name: Author Without ORCID |
| 15 | + equal-contrib: true # (This is how you can denote equal contributions between multiple authors) |
| 16 | + affiliation: 2 |
| 17 | + - name: Author with no affiliation |
| 18 | + corresponding: true # (This is how to denote the corresponding author) |
| 19 | + affiliation: 3 |
| 20 | + - given-names: Ludwig |
| 21 | + dropping-particle: van |
| 22 | + surname: Beethoven |
| 23 | + affiliation: 3 |
| 24 | +affiliations: |
| 25 | + - name: Lyman Spitzer, Jr. Fellow, Princeton University, United States |
| 26 | + index: 1 |
| 27 | + ror: 00hx57361 |
| 28 | + - name: Institution Name, Country |
| 29 | + index: 2 |
| 30 | + - name: Independent Researcher, Country |
| 31 | + index: 3 |
| 32 | +date: 13 August 2017 |
| 33 | +bibliography: paper.bib |
| 34 | + |
| 35 | +# Optional fields if submitting to a AAS journal too, see this blog post: |
| 36 | +# https://blog.joss.theoj.org/2018/12/a-new-collaboration-with-aas-publishing |
| 37 | +aas-doi: 10.3847/xxxxx <- update this with the DOI from AAS once you know it. |
| 38 | +aas-journal: Astrophysical Journal <- The name of the AAS journal. |
| 39 | +--- |
| 40 | + |
| 41 | +# Summary |
| 42 | + |
| 43 | +The forces on stars, galaxies, and dark matter under external gravitational |
| 44 | +fields lead to the dynamical evolution of structures in the universe. The orbits |
| 45 | +of these bodies are therefore key to understanding the formation, history, and |
| 46 | +future state of galaxies. The field of "galactic dynamics," which aims to model |
| 47 | +the gravitating components of galaxies to study their structure and evolution, |
| 48 | +is now well-established, commonly taught, and frequently used in astronomy. |
| 49 | +Aside from toy problems and demonstrations, the majority of problems require |
| 50 | +efficient numerical tools, many of which require the same base code (e.g., for |
| 51 | +performing numerical orbit integration). |
| 52 | + |
| 53 | +# Statement of need |
| 54 | + |
| 55 | +`Gala` is an Astropy-affiliated Python package for galactic dynamics. Python |
| 56 | +enables wrapping low-level languages (e.g., C) for speed without losing |
| 57 | +flexibility or ease-of-use in the user-interface. The API for `Gala` was |
| 58 | +designed to provide a class-based and user-friendly interface to fast (C or |
| 59 | +Cython-optimized) implementations of common operations such as gravitational |
| 60 | +potential and force evaluation, orbit integration, dynamical transformations, |
| 61 | +and chaos indicators for nonlinear dynamics. `Gala` also relies heavily on and |
| 62 | +interfaces well with the implementations of physical units and astronomical |
| 63 | +coordinate systems in the `Astropy` package [@astropy] (`astropy.units` and |
| 64 | +`astropy.coordinates`). |
| 65 | + |
| 66 | +`Gala` was designed to be used by both astronomical researchers and by |
| 67 | +students in courses on gravitational dynamics or astronomy. It has already been |
| 68 | +used in a number of scientific publications [@Pearson:2017] and has also been |
| 69 | +used in graduate courses on Galactic dynamics to, e.g., provide interactive |
| 70 | +visualizations of textbook material [@Binney:2008]. The combination of speed, |
| 71 | +design, and support for Astropy functionality in `Gala` will enable exciting |
| 72 | +scientific explorations of forthcoming data releases from the *Gaia* mission |
| 73 | +[@gaia] by students and experts alike. |
| 74 | + |
| 75 | +# State of the field |
| 76 | + |
| 77 | +Several tools exist for galactic dynamics computations: |
| 78 | +`galpy` [@Bovy:2015] is a Python package with similar goals, |
| 79 | +providing orbit integration and potential classes for galactic dynamics. |
| 80 | +`NEMO` [@Teuben:1995] is a well-established, comprehensive stellar dynamics |
| 81 | +toolbox written primarily in C, offering extensive functionality but with a |
| 82 | +steeper learning curve and less integration with modern Python workflows. |
| 83 | +Other tools like `GalPot` provide specific Milky Way potential models but lack |
| 84 | +the broader dynamical analysis capabilities. |
| 85 | + |
| 86 | +`Gala` was built rather than contributing to existing projects for several |
| 87 | +reasons. First, `Gala` was designed from the ground up to integrate seamlessly |
| 88 | +with the Astropy ecosystem, using `astropy.units` and `astropy.coordinates` |
| 89 | +as core dependencies rather than optional features. This tight integration |
| 90 | +enables natural workflows for astronomers already using Astropy. Second, |
| 91 | +`Gala`'s object-oriented API with consistent interfaces across subpackages |
| 92 | +(potentials, integrators, dynamics) provides a more modular and extensible |
| 93 | +design than alternatives available at the time. Third, `Gala` fills a specific |
| 94 | +niche between simple demonstration codes and full N-body simulation packages |
| 95 | +like `Gadget` [@Springel:2005] – it focuses on the common tasks in galactic |
| 96 | +dynamics research (orbit integration, potential evaluation, coordinate |
| 97 | +transformations) while maintaining both performance through C implementations |
| 98 | +and usability through its Python interface. |
| 99 | + |
| 100 | +# Software design |
| 101 | + |
| 102 | +`Gala`'s design philosophy is based on three core principles: (1) to provide a |
| 103 | +user-friendly, modular, object-oriented API, (2) to use community tools and |
| 104 | +standards (e.g., Astropy for coordinates and units handling), and (3) to use |
| 105 | +low-level code (C/C++/Cython) for performance while keeping the user interface |
| 106 | +in Python. Within each of the main subpackages in `gala` (`gala.potential`, |
| 107 | +`gala.dynamics`, `gala.integrate`, etc.), we try to maintain a consistent API |
| 108 | +for classes and functions. For example, all potential classes share a common |
| 109 | +base class and implement methods for computing the potential, forces, density, |
| 110 | +and other derived quantities at given positions. This also works for |
| 111 | +compositions of potentials (i.e., multi-component potential models), which |
| 112 | +share the potential base class but also act as a dictionary-like container for |
| 113 | +different potential components. As another example, all integrators implement a |
| 114 | +common interface for numerically integrating orbits. The integrators and core |
| 115 | +potential functions are all implemented in C without support for units, but the |
| 116 | +Python layer handles unit conversions and prepares data to dispatch to the C |
| 117 | +layer appropriately.Within the coordinates subpackage, we extend Astropy's |
| 118 | +coordinate classes to add more specialized coordinate frames and |
| 119 | +transformations that are relevant for Galactic dynamics and Milky Way research. |
| 120 | + |
| 121 | +# Research impact statement |
| 122 | + |
| 123 | +`Gala` has demonstrated significant research impact and grown both its user base |
| 124 | +and contributor community since its initial release. The package has evolved |
| 125 | +through contributions from over 18 developers beyond the original core developer |
| 126 | +(@adrn), with community members adding new features, reporting bugs, and |
| 127 | +suggesting new features. |
| 128 | + |
| 129 | +While `Gala` started as a tool primarily to support the core developer's |
| 130 | +research, it has expanded organically to support a range of applications across |
| 131 | +domains in astrophysics related to Milky Way and galactic dynamics. The package |
| 132 | +has been used in over 400 publications (according to Google Scholar) spanning |
| 133 | +topics in galactic dynamics such as modeling stellar streams [@Pearson:2017], |
| 134 | +Milky Way mass modeling, and interpreting kinematic and stellar population |
| 135 | +trends in the Galaxy. `Gala` is integrated within the Astropy ecosystem as an |
| 136 | +affiliated package and has built functionality that extends the widely-used |
| 137 | +`astropy.units` and `astropy.coordinates` subpackages. `Gala`'s impact extends |
| 138 | +beyond citations in research: Because of its focus on usability and user |
| 139 | +interface design, `Gala` has also been incorporated into graduate-level galactic |
| 140 | +dynamics curricula at multiple institutions. |
| 141 | + |
| 142 | +`Gala` has been downloaded over 100,000 times from PyPI and conda-forge yearly |
| 143 | +(or ~2,000 downloads per week) over the past few years, demonstrating a broad |
| 144 | +and active user community. Users span career stages from graduate students to |
| 145 | +faculty and other established researchers and represent institutions around the |
| 146 | +world. This broad adoption and active participation validate `Gala`'s role as |
| 147 | +core community infrastructure for galactic dynamics research. |
| 148 | + |
| 149 | +# Mathematics |
| 150 | + |
| 151 | +Single dollars ($) are required for inline mathematics e.g. $f(x) = e^{\pi/x}$ |
| 152 | + |
| 153 | +Double dollars make self-standing equations: |
| 154 | + |
| 155 | +$$\Theta(x) = \left\{\begin{array}{l} |
| 156 | +0\textrm{ if } x < 0\cr |
| 157 | +1\textrm{ else} |
| 158 | +\end{array}\right.$$ |
| 159 | + |
| 160 | +You can also use plain \LaTeX for equations |
| 161 | +\begin{equation}\label{eq:fourier} |
| 162 | +\hat f(\omega) = \int_{-\infty}^{\infty} f(x) e^{i\omega x} dx |
| 163 | +\end{equation} |
| 164 | +and refer to \autoref{eq:fourier} from text. |
| 165 | + |
| 166 | +# Citations |
| 167 | + |
| 168 | +Citations to entries in paper.bib should be in |
| 169 | +[rMarkdown](http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html) |
| 170 | +format. |
| 171 | + |
| 172 | +If you want to cite a software repository URL (e.g. something on GitHub without a preferred |
| 173 | +citation) then you can do it with the example BibTeX entry below for @fidgit. |
| 174 | + |
| 175 | +For a quick reference, the following citation commands can be used: |
| 176 | +- `@author:2001` -> "Author et al. (2001)" |
| 177 | +- `[@author:2001]` -> "(Author et al., 2001)" |
| 178 | +- `[@author1:2001; @author2:2001]` -> "(Author1 et al., 2001; Author2 et al., 2002)" |
| 179 | + |
| 180 | +# Figures |
| 181 | + |
| 182 | +Figures can be included like this: |
| 183 | + |
| 184 | +and referenced from text using \autoref{fig:example}. |
| 185 | + |
| 186 | +Figure sizes can be customized by adding an optional second parameter: |
| 187 | +{ width=20% } |
| 188 | + |
| 189 | +# AI usage disclosure |
| 190 | + |
| 191 | +No generative AI tools were used in the development of this software, the writing |
| 192 | +of this manuscript, or the preparation of supporting materials. |
| 193 | + |
| 194 | +# Acknowledgements |
| 195 | + |
| 196 | +We acknowledge contributions from Brigitta Sipocz, Syrtis Major, and Semyeong |
| 197 | +Oh, and support from Kathryn Johnston during the genesis of this project. |
| 198 | + |
| 199 | +# References |
0 commit comments