API#

This is the full API documentation for Exo_Skryer.

Reference/API#

exo_skryer.aux_functions Module#

aux_functions.py#

Functions#

pchip_1d(x, x_nodes, y_nodes)

Piecewise Cubic Hermite Interpolating Polynomial (PCHIP).

latin_hypercube(key, n_samples, n_dim, *, ...)

Generate Latin hypercube samples in the unit hypercube [0, 1)^n_dim.

simpson(y, *[, x, dx, axis, even])

JAX-compatible composite Simpson integrator, similar to scipy.integrate.simpson.

simpson_padded(y, x, n_valid, *[, axis, even])

Composite Simpson integration for padded arrays with non-uniform spacing.

exo_skryer.build_chem Module#

build_chem.py#

Functions#

infer_trace_species(cfg, ...)

infer_log10_vmr_keys(trace_species)

infer_clr_keys(trace_species)

Return CLR parameter keys for each trace species.

validate_log10_vmr_params(cfg, trace_species)

validate_clr_params(cfg, trace_species)

Validate that abundance parameters are present for CLR mode.

clr_samples_to_vmr(samples_dict, species)

Convert CLR posterior samples to physical VMR (and log10 VMR) columns.

prepare_chemistry_kernel(cfg, ...)

Prepare and validate chemistry kernel with inferred species.

load_nasa9_if_needed(cfg, exp_dir)

Load NASA-9 thermo coefficients if RateJAX chemistry requires it.

init_fastchem_grid_if_needed(cfg, exp_dir)

Initialise and cache the FastChem 5D grid chemistry backend if required.

init_element_potentials_if_needed(cfg, exp_dir)

Initialise and cache the element-potentials chemistry backend if required.

init_atmodeller_if_needed(cfg, exp_dir)

Initialise the global atmodeller EquilibriumModel if required.

init_quench_approx_if_needed(cfg, exp_dir)

Initialise the FastChem 5D grid and quench species list for quench_approx.

exo_skryer.build_model Module#

build_model.py#

Functions#

build_forward_model(cfg, obs[, ...])

Build a JIT-compiled forward model for atmospheric retrieval.

exo_skryer.build_opacities Module#

build_opacities.py#

Functions#

build_opacities(cfg, obs[, exp_dir])

read_master_wl(cfg, obs[, exp_dir])

master_wavelength()

master_wavelength_cut()

has_line_data()

has_ck_data()

has_cia_data()

has_ray_data()

line_master_wavelength()

line_pressure_grid()

line_log10_pressure_grid()

line_temperature_grid()

line_temperature_grids()

line_log10_temperature_grids()

line_sigma_cube()

line_species_names()

line_runtime_species_order()

load_line_registry(cfg, obs[, lam_master, ...])

ck_master_wavelength()

ck_pressure_grid()

ck_log10_pressure_grid()

ck_temperature_grid()

ck_temperature_grids()

ck_log10_temperature_grids()

ck_sigma_cube()

ck_species_names()

ck_g_points()

ck_g_weights()

ck_runtime_species_order()

ck_g_points_1d()

ck_g_weights_1d()

load_ck_registry(cfg, obs[, lam_master, ...])

load_cia_registry(cfg, obs[, lam_master, ...])

load_ray_registry(cfg, obs[, lam_master])

cia_master_wavelength()

cia_temperature_grid()

cia_temperature_grids()

cia_log10_temperature_grids()

cia_sigma_cube()

cia_species_names()

cia_runtime_species_order()

cia_kept_pair_indices()

cia_pair_species_i()

cia_pair_species_j()

cia_retained_sigma_cube()

cia_retained_temperature_grids()

cia_retained_log10_temperature_grids()

ray_master_wavelength()

ray_sigma_table()

ray_nm1_table()

ray_nd_ref()

ray_species_names()

ray_runtime_species_order()

ray_sigma_linear_table()

ray_refractivity_coeff_table()

ray_pick_arrays()

has_special_data()

special_master_wavelength()

hminus_temperature_grid()

hminus_log10_temperature_grid()

hminus_bf_log10_sigma_table()

hminus_ff_log10_sigma_table()

has_cloud_nk_data()

Return True if cloud n,k arrays have been cached.

cloud_nk_wavelength()

cloud_nk_n()

cloud_nk_k()

Classes#

LineRegistryEntry(name, idx, pressures, ...)

CKRegistryEntry(name, idx, pressures, ...)

CiaRegistryEntry(name, idx, temperatures, ...)

RayRegistryEntry(name, idx, wavelengths, ...)

exo_skryer.data_constants Module#

data_constants.py#

exo_skryer.ck_mix_PRAS Module#

ck_mix_PRAS.py#

Functions#

mix_k_tables_pras(sigma_values_log, ...)

exo_skryer.ck_mix_RORR Module#

ck_mix_RORR.py#

Functions#

mix_k_tables_rorr(sigma_values, ...)

Mix correlated-k tables across species using RORR.

exo_skryer.help_io Module#

help_io.py#

Functions#

to_inferencedata(samples_dict, cfg[, ...])

Convert {param: array} mapping into ArviZ InferenceData.

save_inferencedata(idata, outdir[, stem, ...])

Save an InferenceData object to NetCDF (and optionally summary CSV + evidence JSON).

save_observed_data_csv(outdir, lam, dlam, y, dy)

Save observed data as CSV with columns: lam,dlam,y,dy,response_mode,offset_group Values are written with full float precision; NaNs are allowed.

exo_skryer.help_print Module#

help_print.py#

Functions#

format_duration(seconds)

Format a duration in seconds into a human-readable string.

print_cfg(cfg)

Pretty-print the entire configuration (SimpleNamespace tree) in a compact, table-like format.

exo_skryer.help_runtime Module#

help_runtime.py#

Functions#

apply_runtime_env(rc)

Apply optional rc.runtime settings before importing JAX / NumPyro.

exo_skryer.instru_convolve Module#

instru_convolve.py#

Functions#

apply_response_functions(spectrum)

Apply instrument response functions to convolve spectrum onto observational bins.

get_bandpass_cache()

Materialize bandpass registry arrays into a single PyTree cache (outside jit).

apply_response_functions_cached(spectrum, cache)

Convolve spectrum using a provided bandpass cache (jit-friendly).

exo_skryer.kernel_registry Module#

kernel_registry.py#

Central registry mapping YAML physics-scheme names to their Python kernel functions.

Adding a new module is a two-step process:

  1. Implement the function in the appropriate vert_*.py or opacity_*.py file and make sure it is exported in that module’s __all__.

  2. Import it below and add one entry to the relevant registry dict.

  3. Use the new key string in your YAML config — done!

Aliases (multiple keys that map to the same function) are marked with # alias.

Registry layout#

VERT_TP : temperature-pressure profile kernels VERT_ALT : altitude / hydrostatic-structure kernels VERT_CHEM : chemistry / VMR-profile kernels VERT_MU : mean-molecular-weight kernels VERT_CLOUD : cloud vertical-profile kernels OPAC_CLOUD : cloud opacity kernels (None entry = disabled)

Functions#

resolve(name, registry, cfg_key)

Return the kernel for name from registry, raising a clear error on failure.

exo_skryer.kk_schemes Module#

kk_schemes.py#

Kramers-Kronig transform functions for computing real refractive index from imaginary part using causality relations.

Functions#

kk_n_from_k_wavenumber_cached(nu, k_nu, ...)

Compute n(ν) from k(ν) via a singly-subtracted Kramers–Kronig relation.

kk_n_from_k_wavenumber_fast(nu, k_nu, ...[, ...])

Optimized KK relation using precomputed grid quantities.

kk_n_from_k_wavenumber(nu, k_nu, nu_ref, n_ref)

Compute n(ν) from k(ν) via a singly-subtracted KK relation.

kk_n_from_k_wavelength_um(wl_um, k_wl, ...)

Compute n(λ) from k(λ) via KK, using wavelength inputs in microns.

exo_skryer.lxmie_mod Module#

lxmie_mod.py#

LX-MIE Mie code refactored into JAX (Kitzmann et al. 2018).

Functions#

lxmie_jax(ri, x, *[, nmax, cf_max_terms, cf_eps])

JIT-safe LX-MIE Mie solver.

lxmie_jax_vmap(ri, x, *[, nmax, ...])

Batched wrapper around lxmie_jax with static args bound.

exo_skryer.mie_schemes Module#

mie_schemes.py#

Modular implementations of Mie scattering approximations and exact solutions. All schemes take the same inputs: real refractive index n, imaginary refractive index k, and size parameter x.

Functions#

rayleigh(n, k, x)

Compute extinction and scattering efficiencies using Rayleigh approximation.

madt(n, k, x)

Compute extinction and scattering efficiencies using Modified Anomalous Diffraction Theory (MADT.

lxmie(n, k, x[, nmax, cf_max_terms, cf_eps])

Compute extinction and scattering efficiencies using exact Mie theory.

exo_skryer.opacity_cia Module#

opacity_cia.py#

Functions#

compute_cia_opacity(state, opac, params)

Compute collision-induced absorption (CIA) mass opacity for all molecular pairs.

zero_cia_opacity(state, params)

Return a zero CIA opacity array.

exo_skryer.opacity_ck Module#

opacity_ck.py#

Functions#

zero_ck_opacity(state, opac, params)

Return a zero correlated-k opacity array.

compute_ck_opacity(state, opac, params)

Compute correlated-k opacity with multi-species mixing.

compute_ck_opacity_perspecies(state, opac, ...)

Compute per-species correlated-k opacities WITHOUT mixing.

exo_skryer.opacity_cloud Module#

opacity_cloud.py#

Functions#

compute_cloud_efficiencies(wl, r_cm, params, ...)

Second-stage landing function for (Q_ext, Q_sca, g).

compute_cloud_opacity(state, params[, ...])

Main landing function for cloud opacity calculation.

zero_cloud_opacity(state, params)

Return zero-valued cloud optical properties.

grey_const_cloud(state, params)

Compute a globally constant grey cloud opacity.

grey_profile_cloud(state, params)

Compute grey cloud opacity masked by the vertical cloud profile.

deck_and_powerlaw(state, params)

F18_cloud(wl, r_cm, params)

Fisher & Heng (2018) extinction-efficiency model (optics only).

direct_nk(state, params)

Compute cloud optical properties from retrieved refractive-index nodes.

nk_f18_blend(state, params)

Additive combination of direct_nk and F18 cloud opacity.

f18_skew_cloud(state, params)

F18 continuum plus a skew-normal spectral feature with a Rayleigh size window.

exo_skryer.opacity_line Module#

opacity_line.py#

Functions#

zero_line_opacity(state, params)

Return a zero opacity-sampling opacity array.

compute_line_opacity(state, opac, params)

Compute opacity-sampling mass opacity for all molecular/atomic absorbers.

exo_skryer.opacity_ray Module#

opacity_ray.py#

Functions#

zero_ray_opacity(state, params)

Return a zero Rayleigh scattering opacity array.

compute_ray_opacity(state, opac, params)

Compute Rayleigh scattering mass opacity for the configured scatterers.

exo_skryer.opacity_special Module#

opacity_special.py#

Functions#

zero_special_opacity(state, params)

Return a zero special-opacity array.

compute_hminus_bf_opacity(state, opac, params)

Compute H⁻ bound-free continuum mass opacity from the special registry.

compute_hminus_ff_opacity(state, opac, params)

Compute H⁻ free-free continuum mass opacity from the special registry.

compute_special_opacity(state, opac, params)

Compute the summed special-opacity contribution.

exo_skryer.rate_jax Module#

rate_jax.py#

Functions#

load_nasa9_cache(nasa9_dir)

Load NASA-9 polynomial coefficient files into the global NASA-9 cache.

get_nasa9_cache()

Return the cached NASA-9 thermo table.

clear_nasa9_cache()

Clear the cached NASA-9 thermo table.

is_nasa9_cache_loaded()

Return True if the NASA-9 cache is loaded.

Classes#

NASA9ThermoJAX(data)

JAX-friendly NASA-9 thermo evaluator.

RateJAX(thermo[, C, N, O, fHe])

RATE-style thermochemical equilibrium solver implemented in JAX.

exo_skryer.read_obs Module#

read_obs.py#

Functions#

resolve_obs_path(cfg)

Resolve the observational data path from configuration.

read_obs_data(path[, base_dir])

Input: path to observational data file Output: Dictionary containing observational data

exo_skryer.read_stellar Module#

read_stellar.py#

Functions#

read_stellar_spectrum(cfg, lam_master, ck_mode)

Read and interpolate the stellar spectrum onto the master grid.

exo_skryer.read_yaml Module#

read_yaml.py#

Functions#

read_yaml(path)

Input: path to YAML configuration file.

exo_skryer.registry_bandpass Module#

instru_bandpass.py#

Functions#

reset_bandpass_registry()

Reset all bandpass-related registries and caches.

has_bandpass_data()

Returns True if the bandpass registry has been initialised.

load_bandpass_registry(obs, full_grid, cut_grid)

Build the bandpass registry and JAX-ready padded arrays for each observational bin.

bandpass_num_bins()

Number of observational bins in the bandpass registry.

bandpass_bin_edges()

Bin edges as an array of shape (n_bins, 2): [λ_low, λ_high] for each bin.

bandpass_wavelengths_padded()

Padded wavelength grid for each bin, shape (n_bins, max_len).

bandpass_weights_padded()

Padded weights for each bin, shape (n_bins, max_len).

bandpass_indices_padded()

Padded index array into the high-res spectrum grid, shape (n_bins, max_len).

bandpass_coefficients_padded()

Padded linear convolution coefficients, shape (n_bins, max_len).

bandpass_norms()

Normalisation constants for each bin, shape (n_bins,).

bandpass_valid_lengths()

Valid (non-padded) length for each bin, shape (n_bins,).

bandpass_is_boxcar()

Boxcar detection flags for each bin, shape (n_bins,).

Classes#

BinConvolutionEntry(method, wavelengths, ...)

Holds information needed to convolve a single observational bin at runtime.

exo_skryer.registry_cia Module#

registry_cia.py#

Functions#

Classes#

CiaRegistryEntry(name, idx, temperatures, ...)

exo_skryer.registry_ck Module#

registry_ck.py#

Functions#

Classes#

CKRegistryEntry(name, idx, pressures, ...)

exo_skryer.registry_cloud Module#

registry_cloud.py#

Functions#

compute_kk_grid_cache(nu)

Precompute grid-dependent quantities for Kramers-Kronig relation.

get_or_create_kk_cache(nu)

Retrieve cached KK grid data or compute if not exists.

clear_kk_cache()

Clear all cached KK grid data.

get_kk_cache_stats()

Get statistics about the current KK cache state.

set_cloud_nk_data(wl, n, k)

Store cloud refractive index data in the global registry.

get_cloud_nk_data()

Retrieve cached cloud refractive index data.

clear_cloud_nk_data()

Clear cached cloud refractive index data.

has_cloud_nk_data()

Return True if cloud n,k arrays have been cached.

cloud_nk_wavelength()

cloud_nk_n()

cloud_nk_k()

load_cloud_nk_data(path, wl_master)

Load a refractive index table from disk, interpolate to wl_master, and cache.

exo_skryer.registry_line Module#

registry_line.py#

Functions#

Classes#

LineRegistryEntry(name, idx, pressures, ...)

exo_skryer.registry_ray Module#

registry_ray.py#

Functions#

Classes#

RayRegistryEntry(name, idx, wavelengths, ...)

exo_skryer.RT_alb_1D Module#

RT_alb_1D.py#

Functions#

compute_albedo_spectrum_1d(state, params, ...)

Placeholder shortwave albedo RT kernel.

exo_skryer.RT_em_1D_ck Module#

RT_em_1D_ck.py#

Functions#

exo_skryer.RT_em_1D_os Module#

RT_em_1D_os.py#

Functions#

exo_skryer.RT_em_schemes Module#

RT_em_schemes.py#

Emission radiative transfer solvers for thermal emission calculations.

This module provides multiple methods for solving the radiative transfer equation in thermal emission mode:

  1. Alpha-EAA (solve_alpha_eaa): - Single-angle approximation with alpha-EAA scaling - Fast and accurate for most cases - Supports contribution function calculation

  2. Toon89 (solve_toon89_picaso): - Full multi-stream Toon et al. (1989) method - 8-stream Gaussian quadrature integration - More accurate for optically thick, scattering atmospheres - Higher computational cost than EAA

All solvers use the same interface and can be selected via configuration using the em_scheme parameter in the physics section.

Functions#

solve_alpha_eaa(be_levels, dtau_layers, ssa, ...)

solve_toon89_picaso(be_levels, dtau_layers, ...)

Toon et al. (1989) thermal emission solver with multi-stream quadrature.

get_emission_solver(name)

Get emission RT solver function by name.

exo_skryer.RT_trans_1D_ck Module#

RT_trans_1D_ck.py#

Functions#

compute_transit_depth_1d_ck(state, params, ...)

exo_skryer.RT_trans_1D_ck_trans Module#

RT_trans_1D_ck_trans.py#

Transit transmission spectrum calculation using the transmission multiplication random overlap method for correlated-k species mixing.

This module differs from RT_trans_1D_ck.py in that species are combined by multiplying their mean transmissions under the random-overlap assumption:

T_total = exp(-tau_cont) * Π_s [ Σ_g w_g exp(-tau_s(g)) ]

This avoids ROM sorting / k-distribution mixing entirely and is intended as a fast transmission-only approximation.

Functions#

compute_transit_depth_1d_ck_trans(state, ...)

Compute 1D transit depth using transmission multiplication random overlap.

exo_skryer.RT_trans_1D_os Module#

RT_trans_1D_os.py#

Functions#

compute_transit_depth_1d_os(state, params, ...)

exo_skryer.refraction Module#

refraction.py#

Approximate refraction support for transmission spectroscopy.

Current implementation: “cutoff” mode (option A) that applies a refractive boundary (fully opaque below a wavelength-dependent impact parameter) without curved-ray optical-depth integration.

Functions#

refraction_cutoff_mask(state, params, opac)

Return a boolean mask for impact parameters blocked by refraction.

maybe_refraction_cutoff_mask(state, params, opac)

Return a JAX-safe refraction mask or an all-false mask.

exo_skryer.registry_special Module#

registry_special.py#

Special (non-line, non-Rayleigh, non-CIA) opacity registries.

Currently supported: - H- bound-free (bf) continuum cross-sections σ_bf(λ, T) - H- free-free (ff) continuum cross-sections σ_ff(λ, T)

Tables are precomputed on the forward-model master wavelength grid and a fixed temperature grid, then cached as device arrays for JAX kernels.

Functions#

exo_skryer.run_retrieval Module#

run_retrieval.py#

Functions#

main()

Run a retrieval defined by a YAML configuration.

format_duration(seconds)

Format a duration in seconds into a human-readable string.

exo_skryer.vert_alt Module#

vert_alt.py#

Functions#

hypsometric(p_lev, T_lay, mu_lay, params)

Compute an altitude profile using the hypsometric equation (constant gravity).

g_at_z(R0, z, g_ref)

Compute gravity as a function of altitude assuming spherical geometry.

hypsometric_variable_g(p_lev, T_lay, mu_lay, ...)

Compute an altitude profile with altitude-dependent gravity.

hypsometric_variable_g_pref(p_lev, T_lay, ...)

Compute an altitude profile with altitude-dependent gravity anchored at p_ref.

exo_skryer.vert_chem Module#

vert_chem.py#

Functions#

constant_vmr(species_order)

Build a JIT-optimized function for constant VMR profiles.

constant_vmr_clr(species_order[, use_log10_vmr])

Build a JIT-optimized function for constant VMR profiles using centered-log-ratio (CLR) parameterization.

build_constant_vmr_kernel(species_order)

Build a constant-VMR chemistry kernel for an explicit species ordering.

CE_fastchem_jax(p_lay, T_lay, params, nlay)

Compatibility alias for FastChem-grid interpolation backend.

CE_fastchem_grid_jax(p_lay, T_lay, params, nlay)

Interpolate FastChem 5D grid over (T, P, M/H, C/O).

CE_rate_jax(p_lay, T_lay, params, nlay)

Compute chemical equilibrium profiles using the RateJAX solver.

CE_easychem_jax(p_lay, T_lay, params, nlay)

Compute equilibrium profiles using the production CE JAX backend.

quench_approx(p_lay, T_lay, params, nlay)

Compute quenched chemical abundance profiles using the FastChem 5D grid.

CE_atmodeller(p_lay, T_lay, params, nlay)

Compute chemical equilibrium profiles using the atmodeller backend.

load_element_potentials_cache(species_list, ...)

Build and cache the production CE model for retrieval use.

is_element_potentials_cache_loaded()

Return True if the global element-potentials cache is initialised.

load_atmodeller_cache(species_list, nlay[, ...])

Build an atmodeller.EquilibriumModel from species_list and cache it globally.

is_atmodeller_cache_loaded()

Return True if the global atmodeller cache has been initialised.

load_fastchem_grid_cache(grid_path, ...[, ...])

Load and cache a FastChem 5D interpolation grid.

is_fastchem_grid_cache_loaded()

Return True if FastChem grid interpolation cache is initialised.

get_fastchem_grid_cache_info()

Return lightweight diagnostics for the cached FastChem grid backend.

load_quench_approx_cache(quench_species)

Store the list of species to quench for the quench_approx kernel.

is_quench_approx_cache_loaded()

Return True if the quench species list has been configured.

exo_skryer.vert_cloud Module#

Vertical cloud profile kernels.

This module contains functions that compute the vertical distribution of cloud mass mixing ratio (q_c_lay) as a function of pressure and atmospheric conditions.

Functions#

no_cloud(p_lay, T_lay, mu_lay, rho_lay, ...)

Return zero cloud mass mixing ratio (no clouds).

exponential_decay_profile(p_lay, T_lay, ...)

Exponential decay cloud profile with hard base cutoff.

slab_profile(p_lay, T_lay, mu_lay, rho_lay, ...)

Uniform slab cloud profile with hard pressure cutoffs.

const_profile(p_lay, T_lay, mu_lay, rho_lay, ...)

Constant cloud mass mixing ratio throughout the entire atmosphere.

exo_skryer.vert_mu Module#

vert_mu.py#

Functions#

constant_mu(params, nlay)

Return a constant mean molecular weight (μ) profile.

compute_mu(vmr_lay)

Compute mean molecular weight from volume mixing ratios.

build_compute_mu(species_order)

Build a mean-molecular-weight kernel with a fixed species ordering.

exo_skryer.vert_Tp Module#

vert_Tp.py#

Functions#

hopf_function(tau)

Compute the Hopf function for radiative transfer.

isothermal(p_lev, params)

Generate an isothermal temperature profile.

Barstow(p_lev, params)

Generate a Barstow et al. (2020) temperature profile.

Milne(p_lev, params)

Generate a Milne temperature profile for an internally heated atmosphere.

Modified_Milne(p_lev, params)

Generate a modified Milne temperature profile with stretched exponential transition.

Guillot(p_lev, params)

Generate a Guillot (2010) analytical temperature profile.

Modified_Guillot(p_lev, params)

Generate a modified Guillot profile with a flexible irradiated Hopf term.

MandS(p_lev, params)

Generate a Madhusudhan & Seager (2009) three-region T-P profile.

picket_fence(p_lev, params)

Generate a Parmentier & Guillot (2014,2015) picket fence T-P profile.

dry_convective_adjustment(T_lay, p_lay, ...)

Apply dry convective adjustment to a temperature profile.