Skip to main content
QUICK REVIEW

[Paper Review] pysersic: A Python package for determining galaxy structural properties via Bayesian inference, accelerated with jax

Imad Pasha, Tim B. Miller|arXiv (Cornell University)|Jun 8, 2023
Galaxies: Formation, Evolution, PhenomenaPhysics and Astronomy4 citations
TL;DR

pysersic is a Python package for fitting Sérsic profiles to galaxy images using Bayesian inference accelerated via JAX, enabling fast, scalable, and accurate structural parameter estimation with GPU/TPU support. It leverages NUTS sampling and variational inference for robust posterior estimation, while offering multiple high-accuracy rendering methods including real-space and Fourier-based algorithms.

ABSTRACT

A standard practice in extragalactic population studies is the fitting of parametric models to galaxy images. From such fits, key structural parameters of galaxies such as total flux and effective radius (size) can be extracted. One of the most popular parametric forms is that of the Sérsic profile, which is flexible enough to reasonably fit the light distribution of nearly all galaxies. Here we present pysersic, a Bayesian framework created to facilitate the inference of structural parameters from galaxy images. Pysersic is written in pure Python, and is built using the jax framework, allowing for just-in-time compilation, auto-differentiation and seamless execution on CPUs, GPUs or TPUs. Inference is performed with the numpyro package using gradient based methods, e.g., No U-Turn Sampling, for efficient and robust posterior estimation in only a few minutes on a modern laptop. Pysersic is designed to have a user-friendly interface, allowing users to fit single or multiple sources in a few lines of code, while also being flexible enough for integration into current and future analysis pipelines. In addition to sampling, pysersic can produce point estimates of the best model via optimization in several seconds, and approximate the posterior via stochastic variational inference. The use of the numpyro probabilistic language provides future extensibility to arbitrary models beyond the Sérsic.

Motivation & Objective

  • To develop a fully Bayesian framework for fitting Sérsic profiles to galaxy images with high computational efficiency.
  • To accelerate Bayesian inference for galaxy structural parameters using JAX's JIT compilation and hardware acceleration (CPU/GPU/TPU).
  • To provide a user-friendly, extensible API that supports both novice users and advanced workflows in large-scale surveys.
  • To implement accurate and flexible rendering algorithms for Sérsic profiles, especially for high Sersic indices (n ≳ 3).
  • To integrate seamlessly with probabilistic programming tools like NumPyro for full control over priors and inference methods.

Proposed method

  • Uses JAX for JIT compilation, automatic differentiation, and hardware acceleration to speed up likelihood evaluations and sampling.
  • Employs NumPyro for gradient-based inference, including No-U-Turn Sampling (NUTS) and normalizing flow-based variational inference.
  • Offers three distinct rendering algorithms: real-space oversampling, fully Fourier-space, and hybrid real-Fourier Gaussian mixture methods.
  • Automatically generates priors based on image characteristics, while allowing manual override for expert control.
  • Separates the rendering module from the inference pipeline to allow plug-and-play testing of new algorithms.
  • Supports single- and multi-source fitting with a minimal, intuitive API for quick deployment.

Experimental results

Research questions

  • RQ1Can Bayesian inference for Sérsic profile fitting be made both accurate and efficient enough for large-scale galaxy surveys?
  • RQ2How does JAX acceleration impact runtime performance of MCMC and variational inference in galaxy photometry?
  • RQ3What are the most accurate and stable rendering techniques for high-Sersic-index profiles (n ≳ 3)?
  • RQ4Can a unified, user-friendly interface be built that supports both quick analysis and complex, survey-scale pipelines?
  • RQ5How do different inference methods (NUTS vs. normalizing flows) compare in terms of convergence speed and posterior accuracy?

Key findings

  • pysersic enables posterior estimation in minutes on standard laptops due to JAX's JIT compilation and efficient gradient-based sampling.
  • The use of NUTS and normalizing flows reduces the number of likelihood evaluations required, significantly improving sampling efficiency.
  • The hybrid real-Fourier rendering method effectively mitigates aliasing artifacts while maintaining accuracy for peaked Sérsic profiles.
  • The package supports high-accuracy fitting of high-index Sérsic profiles (n ≳ 3) through specialized numerical algorithms.
  • Users can achieve robust, reproducible inference with full control over priors and sampling methods via integration with the NumPyro ecosystem.
  • The modular design allows for easy benchmarking and replacement of rendering algorithms, promoting methodological innovation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.