Examples gallery¶
120 standalone scripts demonstrating tengri’s physics components and end-to-end use cases. Fitting and inference live in the tutorial notebooks (docs “Notebooks” section), not the gallery — every gallery script is a forward-model figure.
Run a script locally with python examples/quickstart/plot_model_summary_walkthrough.py. Physics examples (dust curves, SFH shapes, AGN spectra) require only core dependencies. Fetch an SSP grid via import tengri; tengri.download_ssp().
Quick Start¶
Model-summary walkthrough, SED dust anatomy, nebular-backend swap, and components-isolated anatomy tour. Fitting and inference examples live in the tutorial notebooks.
Understanding model structure through parameter provenance tags
Dust attenuation across the SED: intrinsic, attenuated, and absorbed
Swapping the nebular backend on, then off, on a young starburst
Recipes¶
Recipe comparison, introspection tour, and custom filter design.
Recipe introspection and SED morphology comparison
Stellar Population Synthesis¶
SSP grid and age/metallicity sweeps, IMF choice, mass-to-light band comparison, and library shootout.
Initial Mass Function choice and stellar mass-to-light ratio
Stellar mass-to-light ratios across bands: age sensitivity
Stellar Population Aging: SSP at Solar Metallicity
SSP Library Shootout: Comparing Spectral Predictions at 5 Gyr, Z=0
Star Formation Histories¶
Parametric forms (DPL, delayed-exponential, lognormal) and non-parametric (PSD-governed stochastic). Quenching pathways, burst observability, and SFH form comparison.
Continuity Prior vs PSD-Governed Prior: Stochastic Structure at Fixed Mean
Double power-law SFH parameter space: early growth α vs late quenching β
PSD parameter space: amplitude σ and timescale τ control burstiness
Quenching pathways: fast vs slow termination of star formation
sfh2exp: double declining exponential (old population + recent burst)
Stochastic SFH samples from GP-correlated fields with different burstiness
Correlation timescale τ sets how bursty a stochastic SFH looks at fixed σ
The outshining problem: young bursts eclipse ancient populations
Metallicity¶
Per-SSP-library Z☉ differs: MIST 0.0142, BC03/Padova 0.0190, PARSEC 0.0152, BASTI 0.0200. Cross-code comparisons must reason in absolute log(Z). Stellar and gas-phase Z are separate knobs. Age–metallicity degeneracy in broadband data. α-element enhancement.
Alpha-element enhancement suppresses iron absorption features
Metallicity shapes panchromatic SED with dust emission
Age-metallicity degeneracy in the stellar continuum
Chemical evolution: closed-box vs leaky-box enrichment histories
Nebular Emission¶
Emission lines are vacuum throughout: Hα is 6564.61 Å, not the 6562.8 Å air value. Mixing the two shifts every line centroid.
neb={'type': ...} takes ssp, cue, cb19, cloudy or none.
The default, ssp, uses the emission already baked into a with-nebular (wNE)
SSP grid. The live backends instead compute it, and expect a bare stellar grid.
Feed a bare grid to the baked-in path and both continuum and line fluxes come
out low, with no error raised.
Gas-phase metallicity is its own knob and does not follow the stellar one. Shock emission examples include line-ratio diagnostics and a composable shock-group sweep across shock parameters.
BPT diagram: star-forming galaxies, AGN, and shocks
Comprehensive 2D sweep of ionization parameter and metallicity (Cue)
Escape fraction reshapes the SED from the Lyman continuum to optical lines
Hα SFR calibration breaks at young ages, weakly dependent on metallicity
Lyman-alpha equivalent width peaks at young ages, varies with gas metallicity
Nebular backends: Cue, CloudyGrid, SSP-embedded, and BakedIn
Ionizing photon production rate Q_H peaks sharply with stellar age
MAPPINGS V shocks: velocity, density, and magnetic field effects
Shock-group sweep: composable shock contamination on the BPT diagram
Dust Attenuation¶
Two-component Charlot & Fall geometry: dust_tau_bc on the birth clouds,
dust_tau_diff on the diffuse ISM. dust_slope defaults to -0.7, the
diffuse-ISM value; -1.3 is the birth-cloud one. The 2175 Å bump is a separate
always-on modifier, dust_bump_strength, defaulting to 0.0 — Calzetti
carries no bump unless you ask for one.
Dust emission templates load from data/. There is no analytic fallback: a
missing template raises FileNotFoundError rather than quietly substituting
a worse model.
Birth-cloud vs diffuse-ISM dust: age dependence and parameter degeneracies
2175 Å bump × UV slope interaction in Kriek & Conroy attenuation
GRAHSP Fig. 7 reproduction: attenuation of the galaxy model
Rv and Av degeneracy in UV slope: the Calzetti trap
Witt & Gordon 2000: the attenuation shape greys with optical depth
Dust Emission¶
Dust emission templates auto-load from data/; analytic fallbacks are not suitable for science. PAH features in Draine & Li templates (q_PAH and U_min sweeps). Mid-IR PAH diagnostics distinguish star-forming, AGN, and composite systems. Temperature sweeps. Template libraries: BOSA, THEMIS, PAHspec, Astrodust (HD23).
BOSA library: PAH features and FIR peak depend on both sSFR and L_TIR
Casey 2012 dust model: temperature and pivot wavelength effects
CMB heating: dust temperature and infrared luminosity ratio across redshift
The q_PAH and U_min knobs move PAH amplitude and FIR peak independently
Graybody dust opacity: optically thin vs. general form across temperature
Dust IR-emission library comparison: models and templates
Mid-IR PAH features in star-forming, AGN, and composite galaxies
Draine+2021 PAHspec: starlight-spectrum sweep at fixed log U
Radiation field strength sets both dust peak temperature and L_IR
AGN Models¶
Torus models in components/agn/torus.py are toy models; SKIRTOR is the one for science. Disc continua (multicolor, KD18, relagn, qsogen), narrow-/broad-line and FeII emission, polar-dust and Type 1/2 attenuation. Cross-validated against CIGALE and AGNfitter.
AGN disc continuum: every registered model at fixed L_bol
AGN parameters are free-able now — and every one moves the SED
Building up an AGN SED: disc, then torus, then lines
QSOgen emission lines: Baldwin effect across AGN luminosity
AGN dusty torus: library comparison at fixed L_bol
Cumulative buildup of the GRAHSP AGN recipe, one sub-block at a time
Custom AGN torus model via SEDModelComponent and direct integration
Kubota & Done 2018 disc: Accretion state effects on continuum
Polar dust E(B-V) reddens Type 1 & 2 AGN differently
Black-hole spin hardens the UV slope through ISCO migration
SKIRTOR torus (full X-CIGALE grid): optical depth and inclination
Type 1 vs Type 2 AGN: Unified viewing-angle classification
ULIRG→QSO evolutionary sequence: dust-obscured starburst to bare quasar
Radio¶
Star formation (free-free and synchrotron) and AGN (radio-loud) components. Far-infrared–radio correlation and non-thermal spectral slopes. Model-family comparison included.
Synchrotron spectral index: steeper α_sf dims the high-frequency tail
Synchrotron / free-free balance vs synchrotron slope α_sf
FIR-radio correlation: L_IR × q_IR sets radio loudness scale
AGN radio loudness R: orders of magnitude in jet power
Radio blocks: which q_IR calibration, and which AGN synchrotron shape
X-ray Emission¶
X-ray binaries (HMXB, LMXB) scaled with SFR and stellar mass. AGN coronae: luminosity, photon index γ, exponential cutoff E_cut, UV-to-X-ray slope α_ox. Model-family comparison included.
Three empirical alpha_OX-L_2500 prescriptions diverge at the quasar peak
AGN UV-to-X-ray power-law slope alpha_OX controls X-ray normalization
N_H column density sweep: from unobscured to Compton-thick
Compton hump in obscured AGN: pexrav reflection across log N_H
X-ray binary luminosity scales with SFR (HMXB) and stellar mass (LMXB)
IGM¶
Intergalactic-medium absorption: Madau vs Inoue prescriptions, Lyα forest, damped Lyα systems. Lyman-break/dropout signature in high-z photometric selection. IGM igm_transmission(wave_obs, z) takes observed-frame wavelengths (not rest-frame).
DLA column density sculpts the Lyman alpha forest at z=3
DLA damping wing evolves with absorber redshift at fixed column density
Comparison of IGM absorption models at high redshift
IGM transmission curves evolve sharply with redshift as Lyman forest deepens
Lyman-alpha profile and IGM blue-wing absorption across redshift
Full galaxy SED with IGM absorption applied at multiple redshifts
Photometry¶
Broadband filter selection, cosmological dimming, color tracks and redshift evolution. Diagnostic planes: WISE/IRAC AGN wedges, red sequence/blue cloud. Photometric-redshift color degeneracies.
Balmer break (4000 Å) position in observed-frame filters vs redshift
HST+JWST+LSST+Spitzer Filter Overlay on Star-Forming SED at z=1
Photo-z degeneracy in color–color space: low-z dusty vs high-z quiescent
WISE W1–W2 vs W2–W3 Color-Color Diagram with Stern+2012 AGN Wedge
Spectroscopy¶
Absorption-line indices (D4000, Hδ) from stellar age and metallicity. Spectral indices vs age. Velocity dispersion, line broadening, and velocity offset. Instrumental resolution effects. High-redshift example: z ≈ 6 Lyα emitter.
Stellar absorption bandheads: age and metallicity anti-correlation
Lyman-alpha emitter spectrum at z=6: IGM absorption and Lyα escape
Instrumental resolution controls Hα + [N II] line blending
Emission-line velocity dispersion: narrow [NII] to broad Hα
Use Cases¶
Paper-style diagnostics: UVJ, JWST color-color, SFR indicators, age–dust degeneracy, main sequence evolution, dropout selection, spectral indices. Simulated-population Catalog examples.
Balmer Decrement Tests Dust Attenuation on Emission Lines
D_n(4000) – specific SFR: the Kauffmann+2003 sequence
z~3 Lyman-break galaxy U-dropout selection: color-color diagnosis
A morphological atlas: E, Sa, Sb, Sc, Im galaxy SEDs
JWST NIRCam color-color diagnostics for high-z galaxy classification
Star-forming main sequence: z = 0 → 2 cosmic evolution + recovery
SDSS Luminous Red Galaxy Stacked Template Spectrum
SFR calibrations: UV only vs UV+IR hybrid estimators vs dust optical depth
Predicting SEDs for a simulated population: what collapsing Z(t) costs
UV slope β degeneracy: dust optical depth and stellar age
UVJ diagram: rest-frame colors separate star-forming from quiescent
Advanced Topics¶
Extension-point demonstration (SEDModelComponent), Fisher degeneracy, and validation techniques: gradient vs finite-difference, mass conservation, redshift-frame invariance, WavePrecomp accuracy.
Authoring a new physics block with SEDModelComponent
Autodiff gradients vs. finite-difference derivatives: diagnostic verification
Mass conservation in SFH: manual integration vs predict_properties
WavePrecomp photometric accuracy across redshift grids
Showcase¶
Full-stack demonstrations: population forward modeling, gradient diagnostics, end-to-end workflows.
Automatic differentiation: parameter sensitivities via jax.grad