DSPS: a python package for stellar population synthesis

The jellyfish galaxy JO206. Source: ESA/Hubble & NASA, M. Gullieuszik and the GASP team

Stellar population synthesis (SPS) is the prevailing framework for predicting the spectral energy distribution of a galaxy (SED) from its fundamental physical properties. SPS is a mature subfield with a long history dating back to the seventies of the last century. Applications of SPS range from inferring the physical properties of individual galaxies, to forward modelling the galaxy distribution across cosmic time. In reflection of the scientific breadth of this topic, there are by now many publicly available libraries that can be used to carry out SPS-related calculations.

A wide range of theoretical models and techniques are considered to be components of SPS, from the specialized interpolation algorithms used to transform the outputs of stellar evolution codes into isochrones and stellar evolution tracks, to the modelling of a galaxy’s chemical evolution history, to the computation of the observed photometry of a galaxy from its composite stellar population. These and other related predictions of SPS models can be computationally intensive, which can create a significant limitation on the level of physical realism that is achievable in a practical analysis.

Recently, artificial intelligence algorithms such as a neural network have become more widely deployed as surrogate functions in cosmology and astrophysics, including applications to stellar population synthesis. When making a computationally expensive prediction, using an artificial intelligence/machine learning-based surrogate function not only reduces the runtime of any particular model evaluation, but has the additional benefit of being an exactly differentiable function of its parameters, a highly advantageous feature in likelihood analyses.

These performance benefits become increasingly dramatic in analyses of models with larger numbers of free parameters. As an alternative to emulating the predictions of a model, the benefits of differentiability can also be reaped by directly implementing the model in a software library that supports automatic differentiation.

Now, a team of researchers presents 1 DSPS: a python package for stellar population synthesis, implemented in JAX. Although code written in JAX is very much like standard Numpy-based python, JAX has been specifically designed to target GPUs and other accelerator devices, and so there are numerous kinds of computations that require a specialized implementation.

All of the functionality in DSPS is implemented natively in the JAX library for automatic differentiation, and so the researchers’ predictions for galaxy photometry are fully differentiable, and directly inherit the performance benefits of JAX, including portability onto GPUs.

DSPS also implements several novel features, such as a flexible empirical model for stellar metallicity that incorporates correlations with stellar age, support for the Diffstar model that provides a physically-motivated connection between the star formation history of a galaxy and the mass assembly of its underlying dark matter halo.

The scientists detail a set of theoretical techniques for using autodiff (an algorithm for evaluating the derivative of a function defined by a computer program, and is a distinct algorithm from numerically estimating a derivative via finite differencing methods) to calculate gradients of predictions for galaxy SEDs with respect to SPS parameters that control a range of physical effects, including star formation history, stellar metallicity, nebular emission, and dust attenuation.

When forward modelling the colours of a synthetic galaxy population, DSPS can provide a factor of 5 speedup over standard SPS codes on a CPU, and a factor of 300-400 on a modern GPU. When coupled with gradient-based techniques for optimization and inference, DSPS makes it practical to conduct expansive likelihood analyses of simulation-based models of the galaxy–halo connection that fully forward model galaxy spectra and photometry.

Author: César Tomé López is a science writer and the editor of Mapping Ignorance

Disclaimer: Parts of this article may have been copied verbatim or almost verbatim from the referenced research paper/s.


  1. Andrew P Hearin, Jonás Chaves-Montero, Alex Alarcon, Matthew R Becker, Andrew Benson (2023) DSPS: Differentiable stellar population synthesis, Monthly Notices of the Royal Astronomical Society doi: 10.1093/mnras/stad456

Written by

Leave a Reply

Your email address will not be published.Required fields are marked *