tengri

A differentiable framework for high-dimensional Bayesian inference from galaxy spectral energy distributions.

Tengri is a panchromatic galaxy SED inference library in JAX. One forward model covers stellar populations, dust, nebular emission, AGN, and IGM, from X-rays to radio. Inference backends plug in as registrations: optimizers from optax, samplers from BlackJAX, variational inference from NIFTy.re. Gradients are exact.

Pre-1.0, developed as a community effort, with the public API still moving in places. The repository will move to the tengri-project GitHub organization shortly.


The name Tengri comes from the all-encompassing God of Heaven in traditional Turkic, Mongolic, and other Central Asian nomadic religions. A fitting name for a code that models the light of galaxies across cosmic time. This name is chosen with respect for the cultural and spiritual traditions it originates from; no religious claim or appropriation is intended.


At a glance

One object manages everything: all components (stellar, dust, nebular, AGN, IGM, radio, X-ray) register into a single SED chain. Pure JAX means JIT, vmap, and autodiff work from SSP grid to log-likelihood, with one code path serving both grid exploration and Bayesian inference.

Build via recipe: SEDModel.build(sfh={...}, dust_attenuation={...}, neb={...}). The tengri.recipes module covers standard cases.

import jax
import tengri
from tengri import (
    SEDModel, Fixed, ForwardModel,
    Observation, Photometry, load_ssp_data, recipes,
)

# Downloads a stellar-population grid on first use, then caches it locally.
ssp = load_ssp_data(tengri.download_ssp("fsps_prsc_miles_chabrier"))
obs = Observation(photometry=Photometry.from_names(
    ["sdss_u", "sdss_g", "sdss_r", "sdss_i", "sdss_z"]
))

# Known-z mock: fixing redshift builds a single-z photometry table in
# seconds (leave the recipe's free z for real catalogs).
config  = recipes.star_forming_photometry()
config["redshift"] = Fixed(0.05)
sed     = SEDModel.build(ssp_data=ssp, observation=obs, **config)
forward = ForwardModel.build(sed=sed, observation=obs)

key  = jax.random.PRNGKey(0)
mock = sed.mock(sed.spec.sample(key), key=key)

result = forward.fit(mock.flux_obs, mock.noise, method="mcmc_nuts")
print(result.summary_table())

Discover what’s installed

import tengri

tengri.summary()            # live counts across every registry
tengri.help()               # curated cheat-sheet
tengri.list_sfh_models()    # also list_nebular_backends, list_dust_laws, ...
tengri.describe("skirtor")  # paper, parameters, units, citation
tengri.search("torus")      # full-text across the registry
tengri.doctor()             # install + JAX backend + SSP files

Available from the CLI: python -m tengri summary. Nothing updates by hand: a model registered through @register_agn_model shows up in the registries without a documentation edit.

Citation

Component-level citation: every model, SSP grid, and backend carries its own cite.

tengri.print_components_bibtex(result)   # BibTeX for components that ran

While Paper I is in preparation, cite tengri as:

Cooray et al., tengri: A Differentiable Framework for High-Dimensional Bayesian Inference from Galaxy Spectral Energy Distributions, in prep. (2026).

How this was built

Built in close collaboration between a human author and AI agents. Components are verified against established codes; the development trail is kept open in the repository.

Get involved

Contributors at every level are welcome. If a science case you care about is not yet supported (a new emission mechanism, an observation mode, a sampler from a paper you read last week), that is the conversation we want to have.

Contribute via the issue tracker at github.com/suchethac/tengri, or write astro.tengri@gmail.com for anything that does not fit in an issue (collaborations, the org move, joining the project).

License

BSD-3-Clause. See LICENSE and NOTICE.