Plotting¶
Publication-quality plotting utilities for SED fits, SFH recovery, corner plot comparisons, convergence diagnostics, and parameter sweeps. Designed for ApJ/MNRAS figures.
Style setup¶
- tengri.analysis.plotting.setup_style(style='tengri')[source]¶
Configure matplotlib for publication-quality astronomy figures.
Defaults to a single cohesive style across every tengri notebook and example, built on top of the scienceplots
sciencepreset: the standard Nature/PRL/ApJ-compatible look (serif fonts, thin inward ticks on all four sides, frameless legends, no grid).- Parameters:
style (str) –
Which composite style to apply. One of:
"tengri"(default);scienceplots.science+no-latex+ tengri-specific tick and font-size overrides. Safe everywhere (no system LaTeX required)."tengri-nature": Nature-journal variant (single-column width, sans-serif Arial). Use for slide decks."tengri-minimal": same tengri overrides but skip scienceplots so the style works whenscienceplotsis unavailable. Keeps the BAGPIPES-inspired look as a fallback.
- Return type:
None
Examples
>>> from tengri.analysis.plotting import setup_style >>> setup_style() # default: science + tengri overrides >>> setup_style("tengri-minimal") # fallback if scienceplots absent
Posterior visualization¶
- tengri.analysis.plotting.plot_1d_posterior(posterior, param_name: str, *, ax=None, bins: int = 40, color: str | None = None, prior: bool = False, show_summary: bool = True)[source]¶
Plot the marginal posterior of a single parameter.
BAGPIPES-style: a normalized histogram with the median and 16/84 percentiles marked, and (optionally) the prior overlaid.
- Parameters:
posterior (Posterior) – Output of
Fitter.run(). Must expose.samplesas a dict{name: array, ...}of MCMC/VI draws.param_name (str) – Free-parameter name (e.g.
"redshift","dust_tau_diff").ax (matplotlib.axes.Axes, optional) – Axes to draw on. Creates a new figure if
None.bins (int, optional) – Number of histogram bins. Default
40.color (str, optional) – Histogram color. Defaults to the project’s primary color.
prior (bool, optional) – If
Trueandposteriorexposes a.model.spec.distributionsregistry for this parameter, sample the prior 10000× and overlay it as a dashed black curve. DefaultFalse.show_summary (bool, optional) – If
True(default), annotate the panel withmedian +Δ_upper / -Δ_lower.
- Return type:
- tengri.analysis.plotting.plot_autocorrelation(result, params=None, max_lag=None, figsize=None)[source]¶
Plot autocorrelation function and mark Sokal window for each parameter.
- Parameters:
result (Posterior) – Inference result with samples.
params (list of str, optional) – Parameters to plot. Default: all scalar params (excluding psd_xi).
max_lag (int, optional) – Maximum lag to display. Default: min(500, n_samples // 2).
figsize (tuple, optional) – Figure size. Default auto-scaled from number of parameters.
- Returns:
fig
- Return type:
matplotlib Figure
Examples
from tengri import plot_autocorrelation fig = plot_autocorrelation(posterior, params=["sfh_dpl_alpha", "dust_tau_bc"]) fig.savefig("autocorr.pdf")
- tengri.analysis.plotting.posterior_plot_sed(result, mock=None, ax=None)[source]¶
Plot SED posterior with optional mock data.
Convenience function for Posterior.plot_sed(): creates a two-panel figure showing the posterior SED band and the star formation history over lookback time.
- Parameters:
- Returns:
fig (matplotlib Figure)
axes (array of matplotlib Axes)
- Raises:
RuntimeError – If model reference is not available.
- tengri.analysis.plotting.posterior_plot_sfh(result, truth_sfh=None, ax=None)[source]¶
Plot SFH posterior with optional truth.
Convenience function for Posterior.plot_sfh(): shows posterior median and 68% credible band over lookback time.
- Parameters:
- Returns:
fig (matplotlib Figure)
ax (matplotlib Axes)
- Raises:
RuntimeError – If model reference is not available.
SFH plots¶
- tengri.analysis.plotting.plot_sfh(model, posterior, true_params=None, ax=None, color=None, label='Posterior', method='RT', show_draws=True, n_draws=30, ci_levels=(16, 84), xlim=(0, 13.5), show_mean_sfh=True, xscale='linear')[source]¶
Plot SFH posterior with uncertainty band: BAGPIPES/Prospector style.
Features:
Filled 68% credible interval (not sample spaghetti)
Optional faint sample draws underneath
Truth as solid black line
Mean SFH backbone as dashed line
Clean axis labels with proper units
- Parameters:
model (SEDModel) – Fitted model instance.
posterior (Posterior) – Posterior from
Fitter.run().true_params (dict, optional) – Ground truth parameters for mock recovery plots.
ax (matplotlib Axes, optional) – Axes to plot on. Creates new figure if None.
color (str, optional) – Line color. Defaults to sampler-specific color from style sheet.
label (str) – Legend label. Default
"Posterior".method (str) – Sampler name for auto-coloring (
"RT","geoVI","NUTS","MAP").show_draws (bool) – If True, draw faint individual SFH samples. Default True.
n_draws (int) – Number of sample draws to plot. Default 30.
ci_levels (tuple of float) – Percentile levels for the filled credible interval. Default
(16, 84).xlim (tuple of float) – x-axis limits in lookback time. [Gyr]
show_mean_sfh (bool) – If True, overplot the smooth mean SFH backbone as a dashed line. Default True.
xscale ({"linear", "log"}) – Lookback-time axis scale. Default
"linear"(BAGPIPES convention: present at right)."log"resolves the recent, bursty SFH that a linear axis compresses into a sliver near the present; the lower limit is clamped off zero tomax(xlim[0], 1e-3)Gyr (~1 Myr, the youngest SFH grid point) and the axis runs ascending (recent at left).
- Returns:
ax
- Return type:
matplotlib Axes
- Raises:
ValueError – If
xscaleis not"linear"or"log".
Examples
from tengri import plot_sfh ax = plot_sfh(model, posterior, true_params=true_params, method="NUTS") ax.figure.savefig("sfh_recovery.pdf")
- tengri.analysis.plotting.plot_sfh_comparison(model, results, true_params=None, methods=None, figsize=(15, 4))[source]¶
Side-by-side SFH recovery for multiple methods.
BAGPIPES-style multi-panel layout.
- Parameters:
model (SEDModel) – Fitted model instance.
results (dict) – Mapping from method name to
Posterior(e.g.{"NUTS": post, "VI": post2}).true_params (dict, optional) – Ground truth parameters for mock recovery plots.
methods (list of str, optional) – Panel order. Defaults to
list(results.keys()).figsize (tuple of float) – Figure size in inches. Default
(15, 4).
- Returns:
fig (matplotlib Figure)
axes (list of matplotlib Axes)
Examples
from tengri import plot_sfh_comparison results = {"NUTS": posterior_nuts, "VI": posterior_vi} fig, axes = plot_sfh_comparison(model, results, true_params=true_params) fig.savefig("sfh_comparison.pdf")
- tengri.analysis.plotting.sfh_sed_comparison(model, param_name: str, values, *, cmap: str = 'plasma', n_stochastic: int = 0, key=None) Figure[source]¶
Two-panel figure: SFH realizations (left) + corresponding SEDs (right).
Essential for the SFH gallery and burstiness story.
- Parameters:
model (tengri.SEDModel)
param_name (str) – Parameter to sweep across
values.values (sequence) – Parameter values.
cmap (str) – Colormap for the sweep.
n_stochastic (int) – If > 0, draw this many stochastic SFH samples per value (thin, alpha=0.2).
key (jax.random.PRNGKey, optional) – Required when n_stochastic > 0.
- Returns:
fig
- Return type:
Figure (two-panel, figsize=(12, 4))
- tengri.analysis.plotting.add_sfh_inset(ax, t_gyr, sfr, inset_range_myr=200, **kwargs)[source]¶
Add a zoom inset showing recent SFH (last 200 Myr by default).
- Parameters:
ax (matplotlib Axes) – Parent axes to attach the inset to.
t_gyr (array_like) – Lookback time in Gyr. [Gyr]
sfr (array_like) – Star formation rate. [Msun/yr]
inset_range_myr (float, optional) – Maximum lookback time to show in the inset. [Myr] Default 200 Myr.
**kwargs – Passed to ax_in.plot() (e.g.,
color,lw).
- Returns:
ax_in – The inset axes (for further customization).
- Return type:
matplotlib Axes
Examples
from tengri import add_sfh_inset ax_in = add_sfh_inset(ax, t_gyr, sfr_median, color="blue", lw=1.5)
SED plots¶
- tengri.analysis.plotting.plot_sed_fit(wave_eff, flux_obs, noise, flux_true=None, posterior_draws=None, ax=None, band_names=None, show_residuals=True)[source]¶
Plot observed photometry with model fit: Prospector style.
- Parameters:
wave_eff (array_like, shape (n_bands,)) – Effective filter wavelengths. [Angstrom]
flux_obs (array_like, shape (n_bands,)) – Observed photometric fluxes. [erg/s/cm²/Hz]
noise (array_like, shape (n_bands,)) – 1-sigma photometric uncertainties. [erg/s/cm²/Hz]
flux_true (array_like, shape (n_bands,), optional) – True (noiseless) fluxes for mock recovery plots.
posterior_draws (array_like, shape (n_draws, n_bands), optional) – Posterior predictive flux draws for uncertainty shading.
ax (matplotlib Axes, optional) – Axes to plot on. Creates new figure if None.
band_names (list of str, optional) – Filter names for axis labels.
show_residuals (bool) – If True, adds a residual panel below the main SED panel. Default True.
- Returns:
fig
- Return type:
matplotlib Figure
Examples
from tengri import plot_sed_fit import numpy as np wave = np.array([4800.0, 6200.0, 7700.0, 9000.0]) flux = np.array([1.2e-18, 1.8e-18, 2.1e-18, 1.9e-18]) noise = flux * 0.05 fig = plot_sed_fit(wave, flux, noise, show_residuals=False)
- tengri.analysis.plotting.plot_spectrum_fit(wave_obs, spec_obs, noise, spec_true=None, spec_draws=None, features=None, z=0.1)[source]¶
Plot spectroscopic fit with residuals: CIGALE style.
- Parameters:
wave_obs (array_like, shape (n_pix,)) – Observed-frame wavelength grid. [Angstrom]
spec_obs (array_like, shape (n_pix,)) – Observed spectrum flux density. [erg/s/cm²/Hz]
noise (array_like, shape (n_pix,)) – 1-sigma per-pixel uncertainties. [erg/s/cm²/Hz]
spec_true (array_like, shape (n_pix,), optional) – True (noiseless) spectrum for mock recovery plots.
spec_draws (array_like, shape (n_draws, n_pix), optional) – Posterior predictive spectrum draws for uncertainty shading.
features (dict, optional) – Rest-frame line/feature wavelengths to annotate, e.g.
{"Hα": 6564.61}.z (float) – Redshift for shifting feature wavelengths to observed frame. Default 0.1.
- Returns:
fig
- Return type:
matplotlib Figure
Examples
from tengri import plot_spectrum_fit fig = plot_spectrum_fit( wave_obs, spec_obs, noise, spec_draws=posterior_spec_draws, features={"Hα": 6564.61, "Hβ": 4862.68}, z=0.5, ) fig.savefig("spectrum_fit.pdf")
- tengri.analysis.plotting.plot_calibration(posterior, *, ax=None, wave_aa: ndarray | None = None, color: str | None = None, ci_levels: tuple[float, float] = (16, 84), show_median: bool = True)[source]¶
Plot the Chebyshev calibration polynomial with its credible band.
The calibration polynomial \(C(\lambda)\) rescales the observed spectrum to absorb instrumental flux-calibration drifts. When the posterior includes Chebyshev coefficients (
cal_c1,cal_c2, …), we evaluate the polynomial for every draw and plot the median + the 16/84 percentile band.- Parameters:
posterior (Posterior) – Posterior with calibration coefficient samples.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. Creates a new figure if
None.wave_aa (ndarray, optional) – Observed-frame wavelength grid [Å]. Defaults to
posterior.observation.spectroscopy.wave_obsif available, otherwise raises.color (str, optional) – Line/band color.
ci_levels (tuple of float, optional) – Percentiles for the filled credible band. Default
(16, 84).show_median (bool, optional) – If
True(default), overlay the median polynomial as a solid line.
- Return type:
Filters¶
- tengri.analysis.plotting.plot_filter_curves(names: list[str], *, ax=None, show_eff_wave: bool = True, normalize: bool = False, label_filters: bool = True, alpha: float = 0.7)[source]¶
Plot one or more filter transmission curves.
- Parameters:
names (list of str) – Short filter names from
FILTER_REGISTRY.ax (matplotlib.axes.Axes, optional) – Axes to draw on. Created if
None.show_eff_wave (bool) – Mark each filter’s effective wavelength with a vertical line.
normalize (bool) – Normalize each curve to unit peak before plotting.
label_filters (bool) – Add filter name labels to the legend.
alpha (float) – Curve transparency.
- Return type:
- tengri.analysis.plotting.plot_filter_coverage(names: list[str], *, ax=None, color_by_facility: bool = True, show_labels: bool = True)[source]¶
Horizontal bar chart of wavelength coverage per filter.
Each filter is a horizontal bar spanning its FWHM, centered on its effective wavelength. Useful for visualizing spectral coverage of a photometric survey.
- Parameters:
names (list of str) – Short filter names from
FILTER_REGISTRY.ax (matplotlib.axes.Axes, optional) – Axes to draw on. Created if
None.color_by_facility (bool) – Color bars by facility.
show_labels (bool) – Annotate bars with filter name.
- Return type:
- tengri.analysis.plotting.compare_filter_sets(set_a: list[str], set_b: list[str], *, ax=None, labels: tuple[str, str] = ('Set A', 'Set B'), normalize: bool = True)[source]¶
Overlay two filter sets for visual comparison.
Useful for comparing, e.g., original vs. recalibrated JWST curves, or CANDELS vs. JADES filter coverage.
- Parameters:
- Return type:
Corner plots¶
- tengri.analysis.plotting.safe_corner(posterior, **kwargs)[source]¶
Wrapper around Posterior.plot_corner that handles degenerate posteriors.
- Parameters:
posterior (Posterior) – Fitted posterior object with a
plot_cornermethod.**kwargs – Additional keyword arguments passed to
posterior.plot_corner.
- Returns:
fig – Corner plot figure, or None if generation failed.
- Return type:
matplotlib.figure.Figure or None
Examples
from tengri import safe_corner fig = safe_corner(posterior, params=["sfh_dpl_alpha", "dust_tau_bc"]) if fig is not None: fig.savefig("corner.pdf")
- tengri.analysis.plotting.plot_corner_comparison(posteriors, labels, colors=None, truths=None, params=None)[source]¶
Overlay multiple posteriors on a single corner plot.
- Parameters:
posteriors (list of Posterior) – Posterior objects to overlay.
labels (list of str) – Legend labels for each posterior (e.g.
["NUTS", "VI", "MAP"]).colors (list of str, optional) – Colors for each posterior. Defaults to sampler palette.
truths (dict, optional) – True parameter values for recovery plots.
params (list of str, optional) – Parameter names to include. Defaults to all free parameters.
- Returns:
fig – Combined corner plot, or None if all posteriors failed.
- Return type:
matplotlib Figure or None
Examples
from tengri import plot_corner_comparison fig = plot_corner_comparison( [post_nuts, post_vi], labels=["NUTS", "VI"], truths=true_params, params=["sfh_dpl_alpha", "dust_tau_bc"], ) if fig is not None: fig.savefig("corner_comparison.pdf")
Convergence diagnostics¶
- tengri.analysis.plotting.convergence_check(result, method_name='', verbose=True)[source]¶
Run industry-standard convergence diagnostics on a Posterior result.
Checks ESS, acceptance rate, and divergences against standard thresholds (Vehtari et al. 2021; Stan/ArviZ conventions).
- Parameters:
- Returns:
Keys: ‘converged’ (bool), ‘warnings’ (list of str), ‘ess_min’, ‘ess_median’, ‘n_params_low_ess’.
- Return type:
Examples
from tengri import convergence_check info = convergence_check(posterior, method_name="NUTS", verbose=True) if not info["converged"]: print("Warnings:", info["warnings"])
- tengri.analysis.plotting.convergence_table(results_dict, verbose=True)[source]¶
Run convergence checks on multiple results, print comparison table.
- Parameters:
- Returns:
Mapping from method name to convergence_check info dict.
- Return type:
Examples
from tengri import convergence_table results = {"NUTS": posterior_nuts, "VI": posterior_vi} info = convergence_table(results, verbose=True)
Parameter sweeps and mock data¶
- tengri.analysis.plotting.sweep_parameter(model, param_name: str, values, *, ax=None, cmap: str = 'viridis', label_fmt: str = '{:.2f}', unit: str = '', log_scale: bool = False, components: bool = False, reference_idx: int | None = None, wave_range: tuple[float, float] | None = None, normalize_at: float | None = 5500.0) tuple[source]¶
Sweep one parameter across values, plot resulting SEDs colormapped low→high.
- Parameters:
model (tengri.SEDModel) – Model instance with a
predictorsedcallable.param_name (str) – Full parameter name (e.g.
"dust_tau_bc"). The parameter must be free inmodel.spec(a call-time override of a Fixed parameter is refused).values (sequence of float) – Parameter values to sweep.
ax (Axes, optional) – Existing axes to plot into. Creates new figure if None.
cmap (str) – Matplotlib colormap name. Use SWEEP_CMAPS[key] for standard sweeps.
label_fmt (str) – Format string for legend labels, e.g.
"τ_BC = {:.1f}".unit (str) – Unit string appended to label, e.g.
"K".log_scale (bool) – If True, log-scale the y-axis.
components (bool) – If True, also overplot individual SED components as dashed lines.
reference_idx (int or None) – Index into
valuesto plot in REFERENCE_STYLE (gray). Others in cmap.wave_range ((lo, hi) or None) – Wavelength range in Å to plot. Defaults to SED_XLIM.
normalize_at (float or None) – Normalize SEDs at this rest-frame wavelength (Å). None = no normalization.
- Returns:
fig, ax
- Return type:
Figure, Axes
- tengri.analysis.plotting.parameter_gallery(model, param_sweep_specs: list[dict], *, ncols: int = 3, figsize_per_panel: tuple[float, float] = (4, 3)) Figure[source]¶
Multi-panel gallery: one panel per entry in param_sweep_specs.
- Parameters:
model (tengri.SEDModel)
param_sweep_specs (list of dict) – Each dict:
{"param": "dust_tau_bc", "values": [...], "label": "τ_BC", "cmap": "YlOrRd", "label_fmt": "{:.1f}"}.ncols (int) – Number of columns in the grid.
figsize_per_panel ((w, h)) – Size per panel in inches.
- Returns:
fig
- Return type:
Figure
- tengri.analysis.plotting.mock_plot(mock, ax=None)[source]¶
Plot mock photometry and true SED.
Convenience function for MockData.plot(): shows observed photometry with errorbars and the true noiseless SED as a line.
- Parameters:
mock (MockData) – Mock observation from model.mock().
ax (matplotlib Axes, optional) – Axes to plot on. If None, creates a new figure.
- Returns:
fig (matplotlib Figure)
ax (matplotlib Axes)
Diagnostics¶
- tengri.analysis.plotting.diagnostics_table(results, names=None)[source]¶
Print a formatted diagnostics comparison table.
- Parameters:
- Return type:
None
Examples
from tengri import diagnostics_table results = {"NUTS": posterior_nuts, "VI": posterior_vi} diagnostics_table(results) # Method Wall time ESS (min) ESS (med) Accept % # ---------------------------------------------------------------- # NUTS 42.3s 812 934 82.4% # VI 3.1s — — —
Constants¶
- tengri.analysis.plotting.styles.COLORS = {'data': '#333333', 'g': '#008837', 'geovi': '#ff7f0e', 'i': '#fc8d59', 'map': '#888888', 'mcmc_nuts': '#2ca02c', 'mcmc_raytrace': '#1f77b4', 'mgvi': '#9467bd', 'model': '#d62728', 'nuts': '#2ca02c', 'r': '#d73027', 'rt': '#1f77b4', 'seq': ['#d4d4d4', '#a8a8a8', '#1f77b4', '#2ca02c', '#d62728'], 'sfh_full': '#ff7f0e', 'sfh_gp': '#2ca02c', 'sfh_mean': '#1f77b4', 'truth': '#1a1a1a', 'u': '#7b3294', 'vi': '#ff7f0e', 'vi_linear': '#9467bd', 'z': '#4575b4'}¶
colorblind-safe and print-friendly. Keys are sampler names (
'map','rt','nuts', …) and photometric bands ('u','g','r','i','z'); values are hex colors. Use these rather than matplotlib’s cycle so figures stay consistent across notebooks, the gallery, and the paper.- Type:
The shared plotting palette
- tengri.analysis.plotting.styles.SDSS_WAVE_EFF = array([3551, 4686, 6166, 7480, 8932])¶
the x-axis for a five-band photometry plot.
- Type:
SDSS effective wavelengths [Angstrom] as an array in
ugrizorder
- tengri.analysis.plotting.styles.SDSS_BANDS = {'g': 4686, 'i': 7480, 'r': 6166, 'u': 3551, 'z': 8932}¶
SDSS effective wavelengths [Angstrom], keyed by band name.
- tengri.analysis.plotting.styles.SDSS_BAND_COLORS = ['#7b3294', '#008837', '#d73027', '#fc8d59', '#4575b4']¶
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- tengri.analysis.plotting.styles.SDSS_BAND_NAMES = ['u', 'g', 'r', 'i', 'z']¶
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- tengri.analysis.plotting.styles.SED_XLABEL = 'Rest-frame wavelength (Å)'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- tengri.analysis.plotting.styles.SED_XLIM = (912, 10000000.0)¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- tengri.analysis.plotting.styles.SED_XSCALE = 'log'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- tengri.analysis.plotting.styles.SED_YLABEL = '$\\lambda F_\\lambda$ (normalized at 5500 Å)'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- tengri.analysis.plotting.styles.SFH_XLABEL = 'Lookback time (Gyr)'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- tengri.analysis.plotting.styles.SFH_YLABEL = 'SFR (M$_\\odot$ yr$^{-1}$)'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- tengri.analysis.plotting.styles.SPECTRAL_FEATURES = {'D4000': 4000.0, 'H$\\alpha$': 6564.61, 'H$\\beta$': 4862.68, 'H$\\delta$': 4102.89, 'H$\\gamma$': 4341.68, 'Ly$\\alpha$': 1215.67, 'Mg b': 5175.0, 'Na D': 5893.0, '[O III]': 5008.24}¶
Rest-frame wavelengths [Angstrom] of the spectral features worth annotating on an SED plot, keyed by a matplotlib-ready mathtext label. Vacuum wavelengths, matching the rest of the package.
- tengri.analysis.plotting.styles.SWEEP_CMAPS = {'agn': 'viridis', 'dust': 'viridis', 'metallicity': 'cividis', 'nebular': 'viridis', 'radio': 'viridis', 'redshift': 'viridis', 'sfh': 'viridis', 'stellar_age': 'cividis'}¶
Matplotlib colormaps for parameter sweep plots, keyed by sweep parameter name. Maps
'dust','agn','sfh','nebular','radio','redshift','metallicity','stellar_age'to colormap names. Defaults are perceptually-uniform and colorblind-safe; seeSWEEP_VMINandSWEEP_VMAXfor value clamping.
- tengri.analysis.plotting.styles.SAMPLER_STYLE = {'MAP': {'alpha': 1.0, 'color': '#888888', 'ls': '--', 'lw': 2.0}, 'MCMC_NUTS': {'alpha': 1.0, 'color': '#2ca02c', 'ls': '-', 'lw': 2.0}, 'MGVI': {'alpha': 1.0, 'color': '#9467bd', 'ls': '-', 'lw': 2.0}, 'NUTS': {'alpha': 1.0, 'color': '#2ca02c', 'ls': '-', 'lw': 2.0}, 'RT': {'alpha': 1.0, 'color': '#1f77b4', 'ls': '-', 'lw': 2.0}, 'VI': {'alpha': 1.0, 'color': '#ff7f0e', 'ls': '-', 'lw': 2.0}, 'VI_Linear': {'alpha': 1.0, 'color': '#9467bd', 'ls': '-', 'lw': 2.0}, 'geoVI': {'alpha': 1.0, 'color': '#ff7f0e', 'ls': '-', 'lw': 2.0}}¶
Matplotlib line and color styles for consistent sampler legends across plots. Keys are sampler names (
'MAP','RT','VI','MCMC_NUTS', etc.); values are dicts with'color','ls'(line style),'lw'(line width), and'alpha'(opacity). Use these for consistency across the gallery and papers.
- tengri.analysis.plotting.styles.REFERENCE_STYLE = {'color': '0.55', 'label': 'reference', 'lw': 2.0, 'zorder': 0}¶
Matplotlib style dict for reference curves in comparison plots. Contains
'color'(mid-gray),'lw'(line width),'zorder'(stacking), and'label'for use withmatplotlib.pyplot.plot()and legend.
- tengri.analysis.plotting.styles.GALAXY_ANNOTATIONS = {(0, 0): 'Dead elliptical', (0, 2): 'Secular disk', (1, 1): 'Normal SF galaxy', (2, 0): 'Extreme dwarf', (2, 2): 'Post-starburst'}¶
Galaxy type labels for the burstiness plane (sigma-tau grid). Keys are tuples
(sigma_bin, tau_bin)representing position on the grid; values are descriptive galaxy type names. Use for annotating parameter space plots.
- tengri.analysis.plotting.convergence.CONVERGENCE_THRESHOLDS = {'accept_nuts_target': 0.8, 'accept_rt_hi': 0.9, 'accept_rt_lo': 0.2, 'divergence_fail_pct': 5, 'divergence_warn': 0, 'ess_bulk_min': 100, 'ess_total_target': 400}¶
Industry-standard convergence diagnostic thresholds, following Vehtari et al. (2021) and Stan/ArviZ conventions. Keys are threshold names (
'ess_bulk_min','ess_total_target','divergence_warn','divergence_fail_pct','accept_rt_lo','accept_rt_hi','accept_nuts_target'); values are numeric thresholds. Used byconvergence_check()andconvergence_table().