Search arXiv⌕ Search

arXiv · 2611.14614

galpy with differentiable, accelerated backends: galactic dynamics in jax and PyTorch

Abstract

We describe an extension of galpy, the Python library for galactic dynamics, that adds jax and PyTorch as computational backends alongside its existing numpy and C implementation. With it, galpy's gravitational potentials, orbit integration, action-angle transformations and their inverses, and distribution functions, including those for tidal streams, run on GPUs, can be compiled as part of a user's program, and can be differentiated with respect to their inputs and parameters, from the force at a point to the samples drawn from a distribution function. The user-facing design is kept simple: the active backend follows from the type of the arrays that are passed in, the galpy interface is unchanged, and the numpy path gives the same results as before. We describe the design of the backend framework and its implementation in each of galpy's modules, with examples of use, and we discuss its limitations. On a GPU, batches of orbits, samples from distribution functions, and stream models run one to five orders of magnitude faster than on a single CPU core. To illustrate the new capabilities, we present simple examples of fitting the Galactic potential with a hypervelocity star and of learning the inverse action-angle transformation with a neural network trained through galpy. An AI coding agent wrote essentially all of the code under the detailed direction and review of the human author, and we describe how we organized this work and how we established the correctness of the result. This work is the start of galpy's version 2, which is available at https://github.com/jobovy/galpy and documented at https://docs.galpy.org/en/v2/ .

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Jo Bovy. 2026-11-10. galpy with differentiable, accelerated backends: galactic dynamics in jax and PyTorch. https://searcharxiv.org/abs/2611.14614

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Search arXiv by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

gevolution 2.0: GPU-accelerated relativistic N-body simulations for cosmology

High-performance computing is increasingly dominated by hardware acceleration using Graphics Processing Units (GPUs). To take advantage of this long-term trend, we implement a major overhaul of the parallelisation approach in the relativistic particle-mesh N-body code gevolution. The new version 2.0 of gevolution employs three layers of parallelisation: MPI for scalability on a distributed memory system, shared memory parallelisation on each MPI rank using OpenMP, and offloading all compute intensive tasks to GPUs using CUDA. The code also includes many new features that have been developed over the past years. We provide an overview of the code structure and show key performance benchmarks. This publication is accompanied by the simultaneous public release of gevolution 2.0 and of a GPU-ready version of the LATfield2 library which provides the parallelisation backend.

astro-ph.IM↗

Euclid Data Release 1 (DR1): The MERge processing

The ESA satellite mission \Euclid was launched in July 2023 and started its regular observing mode in February 2024. The data from the \Euclid instruments Visible Camera (VIS) and the Near IR Spectrometer and Photometer (NISP) are complemented by ground-based imaging data in the $u$, $g$ $r$, $i$, and $z$ bands to enable the determination of photometric redshifts and other galaxy properties. This paper describes the MERge processing function (MER PF) that has been developed and run for the Euclid Data Release 1 (DR1). The aim of the MER PF is to detect objects in the \Euclid imaging data, measure their properties, and combine them into a single multi-wavelength catalogue. In this paper we illustrate the design of the MER PF and introduce the different photometric methods applied to the data, which are Kron total flux, aperture photometry on Point Spread Functions (PSF) -matched images, template fitting photometry, and Sérsic fitting photometry. We also present the various morphological measurements and quality flags that improve the scientific content of the output catalogues and better characterize the detected sources. We illustrate the processing and measurements that help to validate the MER PF results, which is an essential step to qualify the output for the public DR1 release. We discuss the global assessment of the photometric homogeneity and provide an internal comparison of our processing results. In addition, we give an extensive overview of the DR1 output data and the various processing scenarios

astro-ph.IM↗

SlotFlow-GB: A Neural Framework for Trans-Dimensional Inference of Overlapping Galactic Binaries

The Laser Interferometer Space Antenna (LISA) will observe the millihertz gravitational-wave sky, including millions of long-lived Galactic binaries (GBs), tens of thousands of which are expected to be individually resolvable throughout the mission's lifetime. Extracting these sources requires jointly determining their number and physical parameters from strongly overlapping signals, posing a computationally demanding trans-dimensional inference problem. We introduce SlotFlow-GB, a neural framework that constructs a learned approximation to the trans-dimensional posterior, producing a probability distribution over source multiplicity and parameter densities for individual binaries in a single evaluation, without requiring their number to be specified in advance. We demonstrate this framework using year-long LISA simulations containing up to ten binaries within a 2 $μ$Hz frequency interval, focusing on a high-SNR regime in which source overlap, rather than individual-source detectability, is the primary challenge. The inferred source count differs from the true count by at most one in 94% of cases, while the model identifies individual binaries even when their signals overlap strongly in frequency. A complete evaluation, including parameter sampling, takes just 41 ms per band on one NVIDIA GH200 GPU, or 530 ms on eight laptop CPU threads. We further demonstrate that these distributions can be used to initialize subsequent likelihood-based inference, connecting fast amortized predictions with joint parameter estimation.

astro-ph.IM↗