Opacity, Atmospheres & Photometry (kap, atm, colors)¶
This reference page covers the radiative and conductive opacity subpackage (flexmesa.kap), the surface boundary condition and model atmosphere subpackage (flexmesa.atm), and the synthetic spectral energy distribution and filter photometry subpackage (flexmesa.colors).
For physical derivations and diagnostic plots, see Opacity, Atmospheres & Photometry.
Quick Usage Example¶
import numpy as np
import flexmesa.atm as atm
import flexmesa.colors as colors
import flexmesa.kap as kap
from flexmesa import constants
# 1. Total Rosseland mean opacity (radiative + electron conduction)
k_res = kap.kap_get_results(
z=0.02,
x=0.70,
zbase=0.02,
log_rho=-5.0,
log_t=5.0,
lnfree_e=20.0,
zbar=1.10,
)
# 2. Tabulated photospheric surface boundary (P_surf, T_surf)
a_res = atm.eval_table(
luminosity=constants.LSUN,
r=constants.RSUN,
m=constants.MSUN,
cgrav=constants.STANDARD_CGRAV,
table_id=atm.ATM_TABLE_PHOTOSPHERE,
z=0.02,
skip_partials=False,
teff=5777.0,
)
# 3. Synthetic Johnson-Cousins colors at Teff = 5777 K, log g = 4.44, [M/H] = 0.0
phot = colors.eval_colors(
teff=5777.0, log_g=4.44, metallicity=0.0, r=constants.RSUN
)
print(
f"kappa={k_res.kap:.4f} cm^2/g, T_surf={np.exp(a_res.ln_t):.1f} K, "
f"M_bol={float(phot[0]):.3f} mag"
)
Radiative, Conductive & Compton Opacities (flexmesa.kap)¶
flexmesa.kap combines low-temperature molecular (Ferguson/AESOPUS/kapCN) and high-temperature atomic (OPAL Type 1/Type 2 and Opacity Project) Rosseland mean radiative opacities \(\kappa_{\mathrm{rad}}(\log_{10} R, \log_{10} T, X, Z)\) with Poutanen (2017) relativistic Compton scattering and Cassisi et al. (2007) / Blouin et al. (2020) degenerate electron thermal conduction \(\kappa_{\mathrm{cond}}\) via harmonic blending \(\kappa^{-1} = \kappa_{\mathrm{rad}}^{-1} + \kappa_{\mathrm{cond}}^{-1}\). Matching MESA 26.4.1 kap.defaults and kap_eval.f90 (#149, #161), kap_get_results and kap_get_results_jax default to use_type2_opacities=True, use_zbase_for_type1=True, use_blouin_conductive_opacities=True, kap_co_option="gs98_co", and kap_type2_full_off_x=1.0e-3 / kap_type2_full_on_x=1.0e-6, derive Compton and low-\(T\)/high-\(T\) blend boundaries dynamically from the loaded table headers (7.99 on OP_a09 vs. 8.69 on gs98/a09/OP_gs98), and require an explicit zbase >= 0.0 whenever Type 2, kapCN, or AESOPUS opacities are active.
flexmesa.kap.core
¶
Radiative, conductive, and Compton opacity (kap) kernels for FlexMESA.
Ports upstream Fortran MESA's kap module (kap_def.f90, kap_lib.f90,
kap_eval.f90, kap_eval_fixed.f90, kap_eval_co.f90, condint.f90,
kap_aesopus.f90, and kapcn.f90) with Safe Rust execution via
flexmesa._rust and native @jax.jit / jax.custom_jvp differentiable
kernels.
KapEvalOutput
dataclass
¶
Single-zone opacity evaluation output (kap_get / Get_kap_Results).
Attributes:
| Name | Type | Description |
|---|---|---|
kap |
float
|
Total Rosseland mean opacity in |
log10_kap |
float
|
Base-10 logarithm of total opacity |
dlnkap_dln_rho |
float
|
Partial derivative |
dlnkap_dln_t |
float
|
Partial derivative |
kap_fracs |
ndarray
|
4-element |
kap_get_results
¶
kap_get_results(
z,
x,
zbase,
xc=0.0,
xn=0.0,
xo=0.0,
xne=0.0,
log_rho=0.0,
log_t=6.0,
lnfree_e=0.0,
d_lnfree_e_dln_rho=0.0,
d_lnfree_e_dln_t=0.0,
eta=0.0,
d_eta_dln_rho=0.0,
d_eta_dln_t=0.0,
zbar=1.0,
*,
kap_option="gs98",
kap_co_option="gs98_co",
kap_low_t_option="lowT_fa05_gs98",
kap_blend_log_t_upper_bdy=3.88,
kap_blend_log_t_lower_bdy=3.8,
cubic_interpolation_in_x=False,
cubic_interpolation_in_z=False,
include_electron_conduction=True,
use_blouin_conductive_opacities=True,
use_zbase_for_type1=True,
use_type2_opacities=True,
kap_type2_full_off_x=0.001,
kap_type2_full_on_x=1e-06,
kap_type2_full_off_dz=0.001,
kap_type2_full_on_dz=0.01,
backend="auto",
)
Evaluate single-zone radiative + conductive + Compton opacity.
Mirrors Get_kap_Results in kap/private/kap_eval.f90.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float | Array
|
Total metal mass fraction |
required |
x
|
float | Array
|
Hydrogen mass fraction |
required |
zbase
|
float | Array
|
Base metallicity |
required |
xc
|
float | Array
|
Carbon mass fraction |
0.0
|
xn
|
float | Array
|
Nitrogen mass fraction |
0.0
|
xo
|
float | Array
|
Oxygen mass fraction |
0.0
|
xne
|
float | Array
|
Neon mass fraction |
0.0
|
log_rho
|
float | Array
|
Base-10 log mass density |
0.0
|
log_t
|
float | Array
|
Base-10 log temperature |
6.0
|
lnfree_e
|
float | Array
|
Natural log of free electrons per nucleon. |
0.0
|
d_lnfree_e_dln_rho
|
float | Array
|
Partial |
0.0
|
d_lnfree_e_dln_t
|
float | Array
|
Partial |
0.0
|
eta
|
float | Array
|
Electron degeneracy parameter. |
0.0
|
d_eta_dln_rho
|
float | Array
|
Partial |
0.0
|
d_eta_dln_t
|
float | Array
|
Partial |
0.0
|
zbar
|
float | Array
|
Mean ionic charge |
1.0
|
kap_option
|
str
|
High-T Type 1 table prefix ( |
'gs98'
|
kap_co_option
|
str
|
High-T Type 2 table prefix ( |
'gs98_co'
|
kap_low_t_option
|
str
|
Low-T table prefix ( |
'lowT_fa05_gs98'
|
kap_blend_log_t_upper_bdy
|
float
|
Upper |
3.88
|
kap_blend_log_t_lower_bdy
|
float
|
Lower |
3.8
|
cubic_interpolation_in_x
|
bool
|
Use cubic interpolation in |
False
|
cubic_interpolation_in_z
|
bool
|
Use cubic interpolation in |
False
|
include_electron_conduction
|
bool
|
Include electron thermal conduction. |
True
|
use_blouin_conductive_opacities
|
bool
|
Use Blouin et al. (2020) H/He conduction. |
True
|
use_zbase_for_type1
|
bool
|
Use |
True
|
use_type2_opacities
|
bool
|
Enable Type 2 C/O-enhanced tables. |
True
|
kap_type2_full_off_x
|
float
|
|
0.001
|
kap_type2_full_on_x
|
float
|
|
1e-06
|
kap_type2_full_off_dz
|
float
|
|
0.001
|
kap_type2_full_on_dz
|
float
|
|
0.01
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
KapEvalOutput
|
[ |
KapEvalOutput
|
|
kap_get
¶
kap_get(
chem_id,
xa,
log_rho,
log_t,
lnfree_e=0.0,
d_lnfree_e_dln_rho=0.0,
d_lnfree_e_dln_t=0.0,
eta=0.0,
d_eta_dln_rho=0.0,
d_eta_dln_t=0.0,
zbase=-1.0,
**kwargs,
)
Evaluate kap_get from 1-based chem_id and mass-fraction vector xa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chem_id
|
ndarray
|
1-based nuclide indices, shape |
required |
xa
|
ndarray
|
Mass fractions, shape |
required |
log_rho
|
float
|
Base-10 log mass density |
required |
log_t
|
float
|
Base-10 log temperature |
required |
lnfree_e
|
float
|
Natural log of free electrons per nucleon. |
0.0
|
d_lnfree_e_dln_rho
|
float
|
Partial |
0.0
|
d_lnfree_e_dln_t
|
float
|
Partial |
0.0
|
eta
|
float
|
Electron degeneracy parameter. |
0.0
|
d_eta_dln_rho
|
float
|
Partial |
0.0
|
d_eta_dln_t
|
float
|
Partial |
0.0
|
zbase
|
float
|
Base metallicity |
-1.0
|
**kwargs
|
Any
|
Optional |
{}
|
Returns:
| Type | Description |
|---|---|
KapEvalOutput
|
[ |
kap_get_zones
¶
kap_get_zones(
chem_id,
xa_zones,
log_rho_zones,
log_t_zones,
lnfree_e_zones,
d_lnfree_e_dln_rho_zones,
d_lnfree_e_dln_t_zones,
eta_zones,
d_eta_dln_rho_zones,
d_eta_dln_t_zones,
zbase=-1.0,
*,
parallel=True,
**kwargs,
)
Evaluate kap_get across N_zones zones in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chem_id
|
ndarray
|
1-based nuclide indices, shape |
required |
xa_zones
|
ndarray
|
Zone mass fractions, shape |
required |
log_rho_zones
|
ndarray
|
Zone |
required |
log_t_zones
|
ndarray
|
Zone |
required |
lnfree_e_zones
|
ndarray
|
Zone |
required |
d_lnfree_e_dln_rho_zones
|
ndarray
|
Zone |
required |
d_lnfree_e_dln_t_zones
|
ndarray
|
Zone |
required |
eta_zones
|
ndarray
|
Zone electron degeneracy parameter, shape |
required |
d_eta_dln_rho_zones
|
ndarray
|
Zone |
required |
d_eta_dln_t_zones
|
ndarray
|
Zone |
required |
zbase
|
float
|
Base metallicity |
-1.0
|
parallel
|
bool
|
Dispatch across the persistent 4-thread worker pool. |
True
|
**kwargs
|
Any
|
Optional |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of shape |
ndarray
|
dlnkap_dlnT, frac_lowT, frac_highT, frac_Type2, frac_Compton]`. |
flexmesa.kap.submodels
¶
Sub-model opacity evaluation wrappers (flexmesa.kap.submodels).
Exposes direct access to Type 1 fixed-metal tables (kap_get_fixed_metal),
Type 2 C/O-enhanced tables (kap_get_co), Marigo & Aringer (2009) AESOPUS
low-temperature molecular tables (kap_get_aesopus), Lederer & Aringer (2009)
kapCN C/N-varying molecular tables (kap_get_kapcn), Potekhin/Blouin
electron thermal conduction (kap_get_elect_cond_opacity), and Poutanen (2017)
relativistic/degenerate Compton scattering (kap_get_compton_opacity).
kap_get_elect_cond_opacity
¶
Evaluate Potekhin / Blouin electron thermal conduction opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zbar
|
Array | float
|
Mean ionic charge |
required |
log_rho
|
Array | float
|
Base-10 log mass density |
required |
log_t
|
Array | float
|
Base-10 log temperature |
required |
use_blouin
|
bool
|
Apply Blouin et al. (2020) H/He moderate-coupling correction. |
True
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
Array | float
|
Tuple |
Array | float
|
|
kap_get_compton_opacity
¶
kap_get_compton_opacity(
rho,
t,
lnfree_e,
d_lnfree_e_dln_rho,
d_lnfree_e_dln_t,
eta,
d_eta_dln_rho,
d_eta_dln_t,
*,
backend="auto",
)
Evaluate Poutanen (2017) relativistic/degenerate Compton opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
Array | float
|
Mass density in |
required |
t
|
Array | float
|
Temperature in |
required |
lnfree_e
|
Array | float
|
Natural log of free electrons per nucleon, shape |
required |
d_lnfree_e_dln_rho
|
Array | float
|
Partial |
required |
d_lnfree_e_dln_t
|
Array | float
|
Partial |
required |
eta
|
Array | float
|
Electron degeneracy parameter. |
required |
d_eta_dln_rho
|
Array | float
|
Partial |
required |
d_eta_dln_t
|
Array | float
|
Partial |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
Array | float
|
Tuple |
Array | float
|
outputs when any input is a |
Array | float
|
JAX tracing, and Python |
kap_get_fixed_metal
¶
kap_get_fixed_metal(
z,
x,
log_rho,
log_t,
*,
prefix="gs98",
cubic_x=False,
cubic_z=False,
backend="auto",
)
Evaluate Type 1 fixed-metal opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
Array | float
|
Total metal mass fraction |
required |
x
|
Array | float
|
Hydrogen mass fraction |
required |
log_rho
|
Array | float
|
Base-10 log mass density |
required |
log_t
|
Array | float
|
Base-10 log temperature |
required |
prefix
|
str
|
Fixed-metal table prefix ( |
'gs98'
|
cubic_x
|
bool
|
Use cubic interpolation in |
False
|
cubic_z
|
bool
|
Use cubic interpolation in |
False
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[Array | float, Array | float, Array | float]
|
Tuple |
kap_get_co
¶
kap_get_co(
zbase,
x,
dxc,
dxo,
log_rho,
log_t,
*,
kap_co_option="gn93_co",
cubic_x=False,
cubic_z=False,
backend="auto",
)
Evaluate Type 2 C/O-enhanced opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zbase
|
Array | float
|
Base metallicity |
required |
x
|
Array | float
|
Hydrogen mass fraction |
required |
dxc
|
Array | float
|
Carbon enhancement |
required |
dxo
|
Array | float
|
Oxygen enhancement |
required |
log_rho
|
Array | float
|
Base-10 log mass density |
required |
log_t
|
Array | float
|
Base-10 log temperature |
required |
kap_co_option
|
str
|
Type 2 table prefix ( |
'gn93_co'
|
cubic_x
|
bool
|
Use cubic interpolation in |
False
|
cubic_z
|
bool
|
Use cubic interpolation in |
False
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[Array | float, Array | float, Array | float]
|
Tuple |
kap_get_aesopus
¶
Evaluate Marigo & Aringer (2009) AESOPUS_AGSS09 low-T opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zbase
|
Array | float
|
Reference metallicity |
required |
x
|
Array | float
|
Hydrogen mass fraction |
required |
xc
|
Array | float
|
Carbon mass fraction |
required |
xn
|
Array | float
|
Nitrogen mass fraction |
required |
xo
|
Array | float
|
Oxygen mass fraction |
required |
log_rho
|
Array | float
|
Base-10 log mass density |
required |
log_t
|
Array | float
|
Base-10 log temperature |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[Array | float, Array | float, Array | float]
|
Tuple |
kap_get_kapcn
¶
Evaluate Lederer & Aringer (2009) kapCN low-T opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zbase
|
Array | float
|
Base metallicity |
required |
x
|
Array | float
|
Hydrogen mass fraction |
required |
fc
|
Array | float
|
Dimensionless carbon enhancement factor
|
required |
fn_val
|
Array | float
|
Dimensionless nitrogen enhancement factor
|
required |
log_rho
|
Array | float
|
Base-10 log mass density |
required |
log_t
|
Array | float
|
Base-10 log temperature |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[Array | float, Array | float, Array | float]
|
Tuple |
flexmesa.kap.jax_kernels
¶
Native @jax.jit (float64) opacity kernels for flexmesa.kap.
Implements Poutanen (2017) relativistic/degenerate Compton scattering,
Potekhin (1999) / Cassisi et al. (2007) + Blouin et al. (2020) electron thermal
conduction (condtabl.data bicubic spline), low-T/high-T/Type-2/Compton
regime blending (kap_eval.f90), and make_differentiable_kap in pure JAX
with zero host callbacks.
compton_opacity_jax
¶
compton_opacity_jax(
rho,
t,
lnfree_e,
d_lnfree_e_dln_rho,
d_lnfree_e_dln_t,
eta,
d_eta_dln_rho,
d_eta_dln_t,
)
Evaluate Poutanen (2017) relativistic/degenerate Compton opacity.
combine_rad_with_conduction_jax
¶
combine_rad_with_conduction_jax(
kap_rad,
dlnkap_rad_dln_rho,
dlnkap_rad_dln_t,
kap_cond,
dlnkap_cond_dln_rho,
dlnkap_cond_dln_t,
)
Harmonic combination of radiative and conductive opacities in JAX.
electron_conduction_potekhin_jax
¶
Evaluate Potekhin (condtabl.data) electron conduction opacity.
electron_conduction_jax
¶
Evaluate Potekhin / Blouin electron thermal conduction opacity in JAX.
kap_get_results_jax
¶
kap_get_results_jax(
z,
x,
zbase,
xc=0.0,
xn=0.0,
xo=0.0,
xne=0.0,
log_rho=0.0,
log_t=6.0,
lnfree_e=0.0,
d_lnfree_e_dln_rho=0.0,
d_lnfree_e_dln_t=0.0,
eta=0.0,
d_eta_dln_rho=0.0,
d_eta_dln_t=0.0,
zbar=1.0,
*,
kap_option="gs98",
kap_co_option="gs98_co",
kap_low_t_option="lowT_fa05_gs98",
kap_blend_log_t_upper_bdy=3.88,
kap_blend_log_t_lower_bdy=3.8,
cubic_interpolation_in_x=False,
cubic_interpolation_in_z=False,
include_electron_conduction=True,
use_blouin_conductive_opacities=True,
use_zbase_for_type1=True,
use_type2_opacities=True,
kap_type2_full_off_x=0.001,
kap_type2_full_on_x=1e-06,
kap_type2_full_off_dz=0.001,
kap_type2_full_on_dz=0.01,
)
Evaluate Get_kap_Results in native JAX.
make_differentiable_kap
¶
make_differentiable_kap(
z,
x,
zbase,
xc=0.0,
xn=0.0,
xo=0.0,
xne=0.0,
lnfree_e=0.0,
d_lnfree_e_dln_rho=0.0,
d_lnfree_e_dln_t=0.0,
eta=0.0,
d_eta_dln_rho=0.0,
d_eta_dln_t=0.0,
zbar=1.0,
**kwargs,
)
Create a pure @jax.jit / jax.custom_jvp callable.
flexmesa.kap.jax_interp
¶
Pure @jax.jit opacity table interpolators (flexmesa.kap.jax_interp).
Implements 2D PSPLINE bicubic evaluation (do_kap_interpolations,
interp_evbicub_prevalidated_db), 1D Steffen (1990) piecewise-monotonic cubic
interpolation (interp_pm), Type 1 fixed-metal (kap_eval_fixed.f90), Type 2
C/O-enhanced (kap_eval_co.f90), AESOPUS (kap_aesopus.f90), and kapCN
(kapcn.f90) kernels in float64 JAX.
do_kap_interpolations_jax
¶
Evaluate PSPLINE bicubic cell (i, j) and partials.
interp_evbicub_jax
¶
Evaluate interp_evbicub_prevalidated_db at (xget, yget) in JAX.
interp_pm_1d_jax
¶
Evaluate 1D Steffen (1990) piecewise-monotonic cubic at x_new.
interp_pm_4pt_with_partials_jax
¶
Evaluate 4-point Steffen cubic and propagate (dr, dt) tangents.
eval_fixed_metal_jax
¶
Evaluate Type 1 fixed-metal or Ferguson/Freedman low-T table in JAX.
flexmesa.kap.jax_co_lowt
¶
Pure @jax.jit evaluators for Type 2 CO, AESOPUS, and kapCN tables.
eval_co_kap_jax
¶
eval_co_kap_jax(
zbase,
x,
dxc,
dxo,
log_rho,
log_t,
*,
kap_co_option="gn93_co",
cubic_x=False,
cubic_z=False,
)
Evaluate Type 2 C/O-enhanced opacity in JAX.
eval_aesopus_jax
¶
Evaluate Marigo & Aringer (2009) AESOPUS_AGSS09 in JAX.
eval_kapcn_jax
¶
Evaluate Lederer & Aringer (2009) kapCN in JAX.
flexmesa.kap.tables_jax
¶
On-demand binary opacity table loader and bicubic spline cache for JAX.
Reads the immutable FMKAP001 binary payload from
$FLEXMESA_DATA_DIR/kap_full/kap_tables_full.bin (installed by
flexmesa data fetch without invoking any runtime table builder) and fits 2D
PSPLINE bicubic spline coefficients [f, f_xx, f_yy, f_xxyy] on demand for
native @jax.jit evaluation.
fit_bicubic_batch
¶
Fit 2D PSPLINE [f, f_xx, f_yy, f_xxyy] on (B, ny, nx) tables.
reset_index_cache
¶
Release FMKAP001 mmap handles and clear parsed index caches.
get_kap_blend_bounds_jax
¶
Return (high_t_min, low_t_max, log_t_compton_hi, log_r_compton_lo).
get_fixed_set_jax
¶
Load and spline-fit a fixed-metal or low-T table set for JAX.
get_potekhin_jax
¶
Parse and spline-fit condtabl.data with ZeroFirstDeriv (bc=3).
flexmesa.kap.tables_co_lowt_jax
¶
Type 2 CO, AESOPUS, and kapCN table loaders and spline caches for JAX.
get_co_meta_jax
¶
Load Type 2 CO metadata (zbase, xs, co_table_numbers, etc.).
get_co_z_coeffs_jax
¶
Fit and cache (nx=5, 60, nlr, nlt, 4) CO splines for (prefix, iz).
get_co_all_z_coeffs_jax
¶
Return (8, 5, 60, 37, 138, 4) CO spline array for prefix.
get_aesopus_z_coeffs_jax
¶
Fit and cache (total_slices, nlr, nlt, 4) AESOPUS splines for iz.
get_aesopus_all_z_coeffs_jax
¶
Return (13, 1125, 19, 42, 4) AESOPUS spline array across all Z.
Model Atmospheres & Outer Boundary Conditions (flexmesa.atm)¶
flexmesa.atm evaluates outer photospheric boundary conditions \((\ln P_{\mathrm{surf}}, \ln T_{\mathrm{surf}})\) and their exact \((L, \ln R, \ln M, \ln \kappa)\) partial derivatives using grey \(T(\tau)\) relations (Eddington, solar_Hopf, Krishna_Swamy, Trampedach_solar via get_t_tau_id and eval_t_tau_atm across 'fixed', 'iterated', and 'varying' opacity modes with pextra_factor), Guillot (2010) irradiated planetary atmospheres (eval_irradiated), adaptive Dormand-Prince 5(4) (dopri5) optical-depth integration (eval_t_tau_varying), and pre-validated 2D bicubic spline atmosphere tables (photosphere, tau_100, tau_10, tau_1, tau_1m1, WD_tau_25, DB_WD_tau_25 via get_table_id, eval_table, and off-table 'T_tau' boundary blending in eval_table_atm using get_table_alfa_beta).
flexmesa.atm._core
¶
Surface boundary conditions and model atmosphere evaluators (atm).
AtmEvalOutput
dataclass
¶
Surface boundary condition evaluation output (AtmEvalOutput).
Attributes:
| Name | Type | Description |
|---|---|---|
ln_t |
float
|
Natural logarithm of surface temperature \(\ln(T / \mathrm{K})\). |
dln_t_dl |
float
|
Partial derivative \(\partial \ln T / \partial L\) (\(\mathrm{erg^{-1}\,s}\)). |
dln_t_dln_r |
float
|
Partial derivative \(\partial \ln T / \partial \ln R\). |
dln_t_dln_m |
float
|
Partial derivative \(\partial \ln T / \partial \ln M\). |
dln_t_dln_kap |
float
|
Partial derivative \(\partial \ln T / \partial \ln \kappa\). |
ln_p |
float
|
Natural logarithm of surface pressure \(\ln(P / \mathrm{dyn\,cm^{-2}})\). |
dln_p_dl |
float
|
Partial derivative \(\partial \ln P / \partial L\) (\(\mathrm{erg^{-1}\,s}\)). |
dln_p_dln_r |
float
|
Partial derivative \(\partial \ln P / \partial \ln R\). |
dln_p_dln_m |
float
|
Partial derivative \(\partial \ln P / \partial \ln M\). |
dln_p_dln_kap |
float
|
Partial derivative \(\partial \ln P / \partial \ln \kappa\). |
kap |
float
|
Converged surface opacity \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
AtmIrradiatedOutput
dataclass
¶
Irradiated grey atmosphere evaluation output (AtmIrradiatedOutput).
Attributes:
| Name | Type | Description |
|---|---|---|
kap |
float
|
Converged thermal opacity \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
tau |
float
|
Surface optical depth \(\tau = P_{\mathrm{surf}}\,\kappa / g\). |
ln_t |
float
|
Natural logarithm of surface temperature \(\ln(T / \mathrm{K})\). |
dln_t_dl |
float
|
Partial derivative \(\partial \ln T / \partial L\) (\(\mathrm{erg^{-1}\,s}\)). |
dln_t_dln_r |
float
|
Partial derivative \(\partial \ln T / \partial \ln R\). |
dln_t_dln_m |
float
|
Partial derivative \(\partial \ln T / \partial \ln M\). |
dln_t_dln_kap |
float
|
Partial derivative \(\partial \ln T / \partial \ln \kappa\). |
eval_t_tau
¶
Evaluate \(\ln T(\tau, T_{\mathrm{eff}})\) for a \(T(\tau)\) relation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
tau
|
float
|
Optical depth \(\tau\) (dimensionless). |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Natural logarithm of temperature \(\ln(T / \mathrm{K})\). |
eval_t_tau_dq_dtau
¶
Evaluate Hopf-function derivative \(dq/d\tau\) at optical depth \(\tau\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
tau
|
float
|
Optical depth \(\tau\) (dimensionless). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Derivative \(dq/d\tau\) (dimensionless). |
get_t_tau_base
¶
Return base optical depth \(\tau_{\mathrm{base}}\) of a \(T(\tau)\) law.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
Returns:
| Type | Description |
|---|---|
float
|
Base optical depth \(\tau_{\mathrm{base}}\) (dimensionless). |
get_t_tau_id
¶
Map an atm_T_tau_relation string to its integer relation identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Upstream \(T(\tau)\) relation name ( |
required |
Returns:
| Type | Description |
|---|---|
int
|
Integer \(T(\tau)\) relation identifier ( |
get_table_id
¶
Map an atm_table string to its integer table identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Upstream atmosphere table name ( |
required |
Returns:
| Type | Description |
|---|---|
int
|
Integer atmosphere table identifier ( |
eval_e2
¶
Evaluate the second exponential integral \((E_2(x), dE_2/dx)\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Non-negative optical-depth argument \(x \in [0, 10]\). |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
Tuple |
eval_paczynski_gradr
¶
Evaluate the Paczynski (1969) diluted radiative temperature gradient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Temperature \(T\) (\(\mathrm{K}\)). |
required |
p
|
float
|
Total pressure \(P\) (\(\mathrm{dyn\,cm^{-2}}\)). |
required |
rho
|
float
|
Mass density \(\rho\) (\(\mathrm{g\,cm^{-3}}\)). |
required |
tau
|
float
|
Optical depth \(\tau\) (dimensionless). |
required |
kap
|
float
|
Rosseland mean opacity \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
m
|
float
|
Enclosed mass \(M\) (\(\mathrm{g}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Diluted radiative gradient \(\nabla_{\mathrm{rad}}\) (dimensionless). |
eval_table
¶
Evaluate surface \((\ln T, \ln P)\) from a tabulated model atmosphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Photospheric radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Stellar mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
table_id
|
int
|
Atmosphere table identifier ( |
required |
z
|
float
|
Metallicity mass fraction \(Z\). |
required |
skip_partials
|
bool
|
If |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
Returns:
| Type | Description |
|---|---|
AtmEvalOutput
|
Populated |
get_table_alfa_beta
¶
Evaluate blending weights \((\alpha, \beta)\) near table boundaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
table_id
|
int
|
Atmosphere table identifier ( |
required |
Returns:
| Type | Description |
|---|---|
float
|
Tuple |
float
|
weights the atmosphere table. |
get_table_base
¶
Return base optical depth \(\tau_{\mathrm{base}}\) of a table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_id
|
int
|
Atmosphere table identifier ( |
required |
Returns:
| Type | Description |
|---|---|
float
|
Base optical depth \(\tau_{\mathrm{base}}\) (dimensionless). |
eval_t_tau_uniform
¶
eval_t_tau_uniform(
tau_surf,
luminosity,
r,
m,
cgrav,
kap_guess,
pextra_factor,
t_tau_id,
errtol,
max_iters,
skip_partials,
teff,
chem_id=None,
xa=None,
zbase=0.02,
low_t_option="low_t_fa05_gs98",
)
Evaluate a grey \(T(\tau)\) atmosphere with uniform opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau_surf
|
float
|
Surface optical depth \(\tau_{\mathrm{surf}}\). |
required |
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
kap_guess
|
float
|
Initial opacity guess \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
pextra_factor
|
float
|
Radiation pressure enhancement factor. |
required |
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
errtol
|
float
|
Relative convergence tolerance on \(\kappa\). |
required |
max_iters
|
int
|
Maximum opacity fixed-point iterations ( |
required |
skip_partials
|
bool
|
If |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
chem_id
|
Sequence[int] | None
|
Optional species catalog IDs ( |
None
|
xa
|
ArrayLike | None
|
Optional species mass fractions ( |
None
|
zbase
|
float
|
Base metallicity \(Z_{\mathrm{base}}\) for |
0.02
|
low_t_option
|
str
|
Low-temperature opacity table selection. |
'low_t_fa05_gs98'
|
Returns:
| Type | Description |
|---|---|
AtmEvalOutput
|
Populated |
eval_t_tau_varying
¶
eval_t_tau_varying(
tau_surf,
luminosity,
r,
m,
cgrav,
t_tau_id,
errtol,
max_steps,
skip_partials,
teff,
chem_id,
xa,
zbase=0.02,
low_t_option="low_t_fa05_gs98",
)
Evaluate a \(T(\tau)\) atmosphere integrating depth-varying opacity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau_surf
|
float
|
Surface optical depth \(\tau_{\mathrm{surf}}\). |
required |
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
errtol
|
float
|
Relative tolerance for |
required |
max_steps
|
int
|
Maximum |
required |
skip_partials
|
bool
|
If |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
chem_id
|
Sequence[int]
|
Species catalog IDs ( |
required |
xa
|
ArrayLike
|
Species mass fractions ( |
required |
zbase
|
float
|
Base metallicity \(Z_{\mathrm{base}}\) for |
0.02
|
low_t_option
|
str
|
Low-temperature opacity table selection. |
'low_t_fa05_gs98'
|
Returns:
| Type | Description |
|---|---|
AtmEvalOutput
|
Populated |
eval_t_tau_atm
¶
eval_t_tau_atm(
tau_surf,
luminosity,
r,
m,
cgrav,
kap_guess,
pextra_factor,
t_tau_relation,
t_tau_opacity,
errtol,
max_iters,
max_steps,
skip_partials,
teff,
chem_id=None,
xa=None,
zbase=0.02,
low_t_option="low_t_fa05_gs98",
)
Dispatch \(T(\tau)\) outer boundary evaluation across opacity modes.
Evaluates 'fixed', 'iterated', or 'varying' opacity treatments with
pextra_factor in upstream order (star/private/atm_support.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau_surf
|
float
|
Surface optical depth \(\tau_{\mathrm{surf}}\). |
required |
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
kap_guess
|
float
|
Initial opacity guess \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
pextra_factor
|
float
|
Radiation pressure enhancement factor ( |
required |
t_tau_relation
|
str
|
Upstream \(T(\tau)\) relation name ( |
required |
t_tau_opacity
|
str
|
Upstream opacity mode ( |
required |
errtol
|
float
|
Relative convergence or |
required |
max_iters
|
int
|
Maximum opacity iterations for |
required |
max_steps
|
int
|
Maximum |
required |
skip_partials
|
bool
|
If |
required |
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
required |
chem_id
|
Sequence[int] | None
|
Optional species catalog IDs ( |
None
|
xa
|
ArrayLike | None
|
Optional species mass fractions ( |
None
|
zbase
|
float
|
Base metallicity \(Z_{\mathrm{base}}\) for |
0.02
|
low_t_option
|
str
|
Low-temperature opacity table selection. |
'low_t_fa05_gs98'
|
Returns:
| Type | Description |
|---|---|
AtmEvalOutput
|
Populated |
eval_table_atm
¶
eval_table_atm(
luminosity,
r,
m,
cgrav,
atm_table,
z,
tau_factor=1.0,
atm_off_table_option="T_tau",
t_tau_relation="Eddington",
t_tau_opacity="fixed",
kap_guess=0.5,
pextra_factor=1.0,
errtol=1e-06,
max_iters=30,
max_steps=500,
skip_partials=False,
teff=5777.0,
chem_id=None,
xa=None,
zbase=0.02,
low_t_option="low_t_fa05_gs98",
)
Evaluate a tabulated atmosphere with upstream off-table blending.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity
|
float
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
atm_table
|
str
|
Upstream table name ( |
required |
z
|
float
|
Metallicity mass fraction \(Z\). |
required |
tau_factor
|
float
|
Optical-depth scale factor (must equal |
1.0
|
atm_off_table_option
|
str
|
Off-table backup mode ( |
'T_tau'
|
t_tau_relation
|
str
|
Backup \(T(\tau)\) relation name. |
'Eddington'
|
t_tau_opacity
|
str
|
Backup \(T(\tau)\) opacity mode. |
'fixed'
|
kap_guess
|
float
|
Initial opacity guess (\(\mathrm{cm^2\,g^{-1}}\)). |
0.5
|
pextra_factor
|
float
|
Radiation pressure enhancement factor. |
1.0
|
errtol
|
float
|
Relative convergence or |
1e-06
|
max_iters
|
int
|
Maximum opacity iterations for |
30
|
max_steps
|
int
|
Maximum |
500
|
skip_partials
|
bool
|
If |
False
|
teff
|
float
|
Effective temperature \(T_{\mathrm{eff}}\) (\(\mathrm{K}\)). |
5777.0
|
chem_id
|
Sequence[int] | None
|
Optional species catalog IDs ( |
None
|
xa
|
ArrayLike | None
|
Optional species mass fractions ( |
None
|
zbase
|
float
|
Base metallicity \(Z_{\mathrm{base}}\) for |
0.02
|
low_t_option
|
str
|
Low-temperature opacity table selection. |
'low_t_fa05_gs98'
|
Returns:
| Type | Description |
|---|---|
tuple[AtmEvalOutput, float]
|
Tuple |
eval_irradiated
¶
eval_irradiated(
luminosity,
r,
m,
cgrav,
t_eq,
p_surf,
kap_guess,
kap_v,
gamma,
errtol,
max_iters,
skip_partials,
chem_id=None,
xa=None,
zbase=0.02,
low_t_option="low_t_fa05_gs98",
)
Evaluate a Guillot & Havel (2011) irradiated grey atmosphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity
|
float
|
Intrinsic luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
float
|
Planetary/stellar radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
float
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
t_eq
|
float
|
Equilibrium irradiation temperature \(T_{\mathrm{eq}}\) (\(\mathrm{K}\)). |
required |
p_surf
|
float
|
Surface boundary pressure \(P_{\mathrm{surf}}\) (\(\mathrm{dyn\,cm^{-2}}\)). |
required |
kap_guess
|
float
|
Initial thermal opacity guess \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
kap_v
|
float
|
Visible-band opacity \(\kappa_v\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
gamma
|
float
|
Optical-to-thermal opacity ratio \(\gamma = \kappa_v / \kappa\)
(if |
required |
errtol
|
float
|
Relative convergence tolerance on \(\kappa\). |
required |
max_iters
|
int
|
Maximum opacity fixed-point iterations ( |
required |
skip_partials
|
bool
|
If |
required |
chem_id
|
Sequence[int] | None
|
Optional species catalog IDs ( |
None
|
xa
|
ArrayLike | None
|
Optional species mass fractions ( |
None
|
zbase
|
float
|
Base metallicity \(Z_{\mathrm{base}}\) for |
0.02
|
low_t_option
|
str
|
Low-temperature opacity table selection. |
'low_t_fa05_gs98'
|
Returns:
| Type | Description |
|---|---|
AtmIrradiatedOutput
|
Populated |
flexmesa.atm._jax
¶
Differentiable JAX kernels for surface boundary conditions (atm).
eval_t_tau_jax
¶
Evaluate \(\ln T(\tau, T_{\mathrm{eff}})\) in pure branchless JAX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_tau_id
|
int
|
\(T(\tau)\) relation identifier ( |
required |
tau
|
Array
|
Optical depth \(\tau\) (scalar or array). |
required |
teff
|
Array
|
Effective temperature \(T_{\mathrm{eff}}\) in \(\mathrm{K}\). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Natural logarithm of temperature \(\ln(T / \mathrm{K})\). |
eval_paczynski_gradr_jax
¶
Evaluate Paczynski (1969) diluted \(\nabla_{\mathrm{rad}}\) in JAX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
Array
|
Temperature \(T\) (\(\mathrm{K}\)). |
required |
p
|
Array
|
Pressure \(P\) (\(\mathrm{dyn\,cm^{-2}}\)). |
required |
rho
|
Array
|
Density \(\rho\) (\(\mathrm{g\,cm^{-3}}\)). |
required |
tau
|
Array
|
Optical depth \(\tau\). |
required |
kap
|
Array
|
Opacity \(\kappa\) (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
luminosity
|
Array
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
m
|
Array
|
Mass \(M\) (\(\mathrm{g}\)). |
required |
r
|
Array
|
Radius \(R\) (\(\mathrm{cm}\)). |
required |
cgrav
|
Array
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Diluted radiative temperature gradient \(\nabla_{\mathrm{rad}}\). |
eval_table_jax
¶
eval_table_jax(
luminosity,
r,
m,
cgrav=constants.STANDARD_CGRAV,
table_id=_core.ATM_TABLE_PHOTOSPHERE,
z=0.02,
)
Evaluate differentiable \((\ln T, \ln P)\) from an atmosphere table.
Uses a jax.custom_vjp rule backed by the analytical bicubic spline
derivatives \((\partial \ln T / \partial L,
\partial \ln T / \partial \ln R, \partial \ln T / \partial \ln M)\)
and \((\partial \ln P / \partial L, \partial \ln P / \partial \ln R,
\partial \ln P / \partial \ln M)\) computed in flexmesa-atm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity
|
Array
|
Luminosity \(L\) (\(\mathrm{erg\,s^{-1}}\)). |
required |
r
|
Array
|
Photospheric radius \(R\) (\(\mathrm{cm}\)). |
required |
m
|
Array
|
Stellar mass \(M\) (\(\mathrm{g}\)). |
required |
cgrav
|
float | Array
|
Gravitational constant \(G\) (\(\mathrm{cm^3\,g^{-1}\,s^{-2}}\)). |
STANDARD_CGRAV
|
table_id
|
int
|
Atmosphere table identifier ( |
ATM_TABLE_PHOTOSPHERE
|
z
|
float | Array
|
Metallicity mass fraction \(Z\). |
0.02
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple |
Synthetic SEDs & Filter Photometry (flexmesa.colors)¶
flexmesa.colors synthesizes stellar spectral energy distributions (SEDs) across the 1199-wavelength Kurucz/Castelli (Teff, log_g, [M/H]) grid using a 32-gather 3D cubic Hermite interpolator and integrates bolometric corrections and synthetic absolute magnitudes across Johnson-Cousins \(UBVRIJHK\) filter transmission curves via non-uniform quadratic Simpson quadrature.
flexmesa.colors.photometry
¶
10-column history photometry evaluators for flexmesa.colors.
Ports upstream MESA colors/private/colors_history.f90 and
colors/public/colors_lib.f90 into unified Safe Rust (flexmesa._rust)
and branchless @jax.jit (float64) evaluators.
eval_colors_jax
¶
Evaluate 10-column colors history vector in @jax.jit float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
Array | float
|
Effective temperature in |
required |
log_g
|
Array | float
|
Log10 surface gravity in |
required |
metallicity
|
Array | float
|
Metallicity |
required |
r
|
Array | float
|
Photospheric radius in |
required |
d
|
Array | float
|
Observer distance in |
D_10PC_CM
|
mag_system_id
|
int
|
|
0
|
method_id
|
int
|
|
0
|
Returns:
| Type | Description |
|---|---|
Array
|
1D array of shape |
Array
|
|
eval_colors
¶
eval_colors(
teff,
log_g,
metallicity,
r,
d=utils.D_10PC_CM,
*,
mag_system="Vega",
method="Hermite",
backend="auto",
)
Evaluate the 10-column colors history vector for a stellar model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
float | Array
|
Effective temperature in |
required |
log_g
|
float | Array
|
Log10 surface gravity in |
required |
metallicity
|
float | Array
|
Metallicity |
required |
r
|
float | Array
|
Photospheric radius in |
required |
d
|
float | Array
|
Observer distance in |
D_10PC_CM
|
mag_system
|
str
|
Zero-point system ( |
'Vega'
|
method
|
str
|
SED interpolator ( |
'Hermite'
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
1D array of shape |
ArrayLike
|
|
eval_colors_dual
¶
eval_colors_dual(
teff,
log_g,
metallicity,
r,
d=utils.D_10PC_CM,
*,
mag_system="Vega",
backend="auto",
)
Evaluate eval_colors and its (10, 4) Jacobian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
float | Array
|
Effective temperature in |
required |
log_g
|
float | Array
|
Log10 surface gravity in |
required |
metallicity
|
float | Array
|
Metallicity |
required |
r
|
float | Array
|
Photospheric radius in |
required |
d
|
float | Array
|
Observer distance in |
D_10PC_CM
|
mag_system
|
str
|
Zero-point system ( |
'Vega'
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayLike, ArrayLike]
|
Tuple |
eval_colors_zones
¶
eval_colors_zones(
teff,
log_g,
metallicity,
r,
d=utils.D_10PC_CM,
*,
mag_system="Vega",
method="Hermite",
backend="auto",
parallel=True,
)
Evaluate 10-column colors output across n_zones stellar models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
ArrayLike
|
1D array of temperatures in |
required |
log_g
|
ArrayLike
|
1D array of |
required |
metallicity
|
ArrayLike
|
1D array of |
required |
r
|
ArrayLike
|
1D array of radii in |
required |
d
|
float | Array
|
Observer distance in |
D_10PC_CM
|
mag_system
|
str
|
Zero-point system ( |
'Vega'
|
method
|
str
|
SED interpolator ( |
'Hermite'
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
parallel
|
bool
|
Whether to use the persistent |
True
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
2D array of shape |
flexmesa.colors.sed
¶
3D stellar atmosphere SED interpolators for flexmesa.colors.
Ports upstream MESA colors/private/hermite_interp.f90,
linear_interp.f90, and knn_interp.f90 into branchless @jax.jit
(float64) and Safe Rust (flexmesa._rust) evaluators over the
Kurucz2003all \((T_{\mathrm{eff}}, \log g, [\mathrm{M/H}], \lambda)\)
lookup cube.
compute_interp_radius_jax
¶
Compute normalized Euclidean distance to the nearest Kurucz grid node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
Array | float
|
Effective temperature in |
required |
log_g
|
Array | float
|
Log10 surface gravity in |
required |
metallicity
|
Array | float
|
Metallicity |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Scalar normalized interpolation radius |
eval_sed_hermite_jax
¶
Evaluate 3D cubic Hermite SED interpolation in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
Array | float
|
Effective temperature in |
required |
log_g
|
Array | float
|
Log10 surface gravity in |
required |
metallicity
|
Array | float
|
Metallicity |
required |
r
|
Array | float
|
Photospheric radius in |
required |
d
|
Array | float
|
Observer distance in |
D_10PC_CM
|
Returns:
| Type | Description |
|---|---|
Array
|
Diluted 1D SED flux array of shape |
Array
|
|
eval_sed_linear_jax
¶
Evaluate 3D log-fallback trilinear SED interpolation in JAX float64.
Matches upstream MESA linear_interp.f90:construct_sed_linear by
clamping all 8 cell corners to 1.0e-10 before linear and log blending.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
Array | float
|
Effective temperature in |
required |
log_g
|
Array | float
|
Log10 surface gravity in |
required |
metallicity
|
Array | float
|
Metallicity |
required |
r
|
Array | float
|
Photospheric radius in |
required |
d
|
Array | float
|
Observer distance in |
D_10PC_CM
|
Returns:
| Type | Description |
|---|---|
Array
|
Diluted 1D SED flux array of shape |
eval_sed_knn_jax
¶
Evaluate 4-nearest-neighbor inverse-distance SED interpolation in JAX.
Searches the full (76, 11, 8) normalized 3D Kurucz grid to match
upstream MESA knn_interp.f90:find_k_nearest_neighbors and
interpolate_knn_sed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
Array | float
|
Effective temperature in |
required |
log_g
|
Array | float
|
Log10 surface gravity in |
required |
metallicity
|
Array | float
|
Metallicity |
required |
r
|
Array | float
|
Photospheric radius in |
required |
d
|
Array | float
|
Observer distance in |
D_10PC_CM
|
Returns:
| Type | Description |
|---|---|
Array
|
Diluted 1D SED flux array of shape |
eval_sed
¶
Evaluate the diluted stellar SED (wavelengths, fluxes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
teff
|
float | Array
|
Effective temperature in |
required |
log_g
|
float | Array
|
Log10 surface gravity in |
required |
metallicity
|
float | Array
|
Metallicity |
required |
r
|
float | Array
|
Photospheric radius in |
required |
d
|
float | Array
|
Observer distance in |
D_10PC_CM
|
method
|
str
|
SED method ( |
'Hermite'
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[ArrayLike, ArrayLike]
|
Tuple |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
flexmesa.colors.synthetic
¶
Bolometric, synthetic filter, and zero-point photometry for colors.
Ports upstream MESA colors/private/bolometric.f90 and synthetic.f90
into unified Safe Rust (flexmesa._rust) and @jax.jit (float64)
evaluators.
flux_to_magnitude
¶
Convert integrated flux F > 0 to Pogson magnitude -2.5 log10(F).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flux
|
float | Array
|
Integrated flux |
required |
Returns:
| Type | Description |
|---|---|
float | Array
|
Magnitude |
clean_sed_fluxes_jax
¶
Zero out non-positive interior wavelengths or negative SED fluxes.
Matches the interior sanitization loop 1..n-1 in upstream MESA
bolometric.f90 and synthetic.f90.
calculate_bolometric_phot_jax
¶
Integrate bolometric flux and magnitude in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
Array
|
1D wavelength grid in |
required |
fluxes
|
Array
|
1D flux density in |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple |
calculate_bolometric_phot
¶
Integrate bolometric flux and magnitude over (wavelengths, fluxes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
ArrayLike
|
1D wavelength grid in |
required |
fluxes
|
ArrayLike
|
1D flux density in |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
tuple[float | Array, float | Array]
|
Tuple |
calculate_synthetic_flux_jax
¶
Compute photon-counting synthetic filter flux in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
Array
|
1D wavelength grid in |
required |
convolved_flux
|
Array
|
1D product |
required |
filter_on_sed_grid
|
Array
|
1D filter transmission |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Photon-counting mean flux |
Array
|
|
calculate_synthetic_jax
¶
Compute synthetic filter magnitude in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
Array
|
1D SED wavelength grid in |
required |
fluxes
|
Array
|
1D SED flux density in |
required |
filter_wavelengths
|
Array
|
1D filter wavelength grid in |
required |
filter_trans
|
Array
|
1D filter transmission curve. |
required |
zero_point_flux
|
Array | float
|
Zero-point flux |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Synthetic magnitude |
calculate_synthetic
¶
calculate_synthetic(
wavelengths,
fluxes,
filter_wavelengths,
filter_trans,
zero_point_flux,
*,
backend="auto",
)
Compute synthetic filter magnitude from an SED and filter curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
ArrayLike
|
1D SED wavelength grid in |
required |
fluxes
|
ArrayLike
|
1D SED flux density in |
required |
filter_wavelengths
|
ArrayLike
|
1D filter wavelength grid in |
required |
filter_trans
|
ArrayLike
|
1D filter transmission curve. |
required |
zero_point_flux
|
float | Array
|
Zero-point flux |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Synthetic magnitude |
compute_vega_zero_point
¶
Compute the Vega photon-counting zero-point flux for a filter curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vega_wave
|
ArrayLike
|
1D Vega wavelength grid in |
required |
vega_flux
|
ArrayLike
|
1D Vega flux spectrum in |
required |
filt_wave
|
ArrayLike
|
1D filter wavelength grid in |
required |
filt_trans
|
ArrayLike
|
1D filter transmission curve. |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Vega zero-point flux in |
compute_ab_zero_point
¶
Compute the AB photon-counting zero-point flux (\(f_\nu = 3631\) Jy).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filt_wave
|
ArrayLike
|
1D filter wavelength grid in |
required |
filt_trans
|
ArrayLike
|
1D filter transmission curve. |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
AB zero-point flux in |
compute_st_zero_point
¶
Compute the ST photon-counting zero-point flux (\(f_\lambda = 3.63e-9\)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filt_wave
|
ArrayLike
|
1D filter wavelength grid in |
required |
filt_trans
|
ArrayLike
|
1D filter transmission curve. |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
ST zero-point flux in |
flexmesa.colors.utils
¶
Quadrature, flux dilution, and grid utilities for flexmesa.colors.
Ports upstream MESA colors/private/colors_utils.f90 and
colors/private/knn_interp.f90 into unified Safe Rust (flexmesa._rust)
and branchless @jax.jit (float64) kernels.
ColorsBuiltinGrid
¶
Bases: NamedTuple
Preloaded Kurucz2003all + Johnson grid arrays in JAX float64.
Attributes:
| Name | Type | Description |
|---|---|---|
teff_grid |
Array
|
Effective temperature axis in |
logg_grid |
Array
|
Log10 surface gravity axis in CGS of shape |
meta_grid |
Array
|
Metallicity axis |
wavelengths |
Array
|
Canonical wavelength grid in |
slot_map |
Array
|
Flat |
sed_table |
Array
|
Surface flux table of shape |
filters_on_sed_grid |
Array
|
Resampled Johnson filter curves of shape
|
filter_norm_integrals |
Array
|
Photon-counting denominators
|
vega_zp |
Array
|
Vega zero-point fluxes of shape |
ab_zp |
Array
|
AB zero-point fluxes of shape |
st_zp |
Array
|
ST zero-point fluxes of shape |
get_builtin_colors_grid
cached
¶
Load the built-in Kurucz2003all + Johnson grid from Rust.
Returns:
| Name | Type | Description |
|---|---|---|
Cached |
ColorsBuiltinGrid
|
class: |
ColorsBuiltinGrid
|
|
remove_dat
¶
Strip the file extension starting at the first . character.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Input file path or filter identifier string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Substring prior to the first |
dilute_flux_jax
¶
Apply geometric dilution (r / d)^2 in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_flux
|
Array
|
1D surface flux array of shape |
required |
r
|
Array | float
|
Stellar photospheric radius in |
required |
d
|
Array | float
|
Observer distance in |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Diluted flux array of shape |
Array
|
|
dilute_flux
¶
Apply geometric flux dilution (R / d)^2 to a stellar SED.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_flux
|
ArrayLike
|
1D surface flux array of shape |
required |
r
|
float | Array
|
Stellar radius in |
required |
d
|
float | Array
|
Distance in |
D_10PC_CM
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Diluted flux array of shape |
trapezoidal_integration_jax
¶
Evaluate composite non-uniform trapezoidal rule in JAX float64.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
1D monotonic grid array of shape |
required |
y
|
Array
|
1D integrand values of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Scalar integral |
trapezoidal_integration
¶
Evaluate composite non-uniform trapezoidal quadrature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
1D grid coordinates of shape |
required |
y
|
ArrayLike
|
1D integrand values of shape |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Integrated scalar value. |
simpson_integration_jax
¶
Evaluate composite non-uniform Simpson quadrature in JAX float64.
Supports batched y of shape (*batch, n) integrated along the last
axis against 1D x of shape (n,). Matches upstream MESA
colors_utils.f90:simpson_integration, including the trapezoidal tail
interval when x.shape[0] is even.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
1D grid coordinates of shape |
required |
y
|
Array
|
Integrand values of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Integrated value of shape |
simpson_integration
¶
Evaluate composite non-uniform Simpson quadrature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ArrayLike
|
1D grid coordinates of shape |
required |
y
|
ArrayLike
|
1D integrand values of shape |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Integrated scalar value. |
interpolate_array_jax
¶
Resample 1D curve (x_in, y_in) onto x_out with flat clamping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_in
|
Array
|
1D source coordinates of shape |
required |
y_in
|
Array
|
1D source values of shape |
required |
x_out
|
Array
|
1D target coordinates of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Resampled 1D array of shape |
interpolate_array
¶
Resample 1D curve (x_in, y_in) onto x_out with flat clamping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_in
|
ArrayLike
|
1D source coordinates of shape |
required |
y_in
|
ArrayLike
|
1D source values of shape |
required |
x_out
|
ArrayLike
|
1D target coordinates of shape |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Resampled 1D array of shape |
Compiled Rust Extension Bridge (flexmesa._rust)¶
Low-level Safe Rust PyO3 bindings exposed via flexmesa._rust for opacities, atmospheres, and synthetic photometry (_ArrF64 and _ArrI64 denote float64 and int64 NumPy arrays).
kap_py¶
kap_build_full_tables_bin((kap_dir: str, aesopus_section_path: str, out_path: str) -> None): Assembles and checks anFMKAP001kap_tables_full.binfile from a MESAkap_datadirectory and pre-convertedaesopus_section.bin.kap_get_aesopus_rust((zbase: float, x: float, xc: float, xn: float, xo: float, log_rho: float, log_t: float) -> tuple[float, float, float]): EvaluatesAESOPUS_AGSS09low-temperature opacity(kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_co_rust((zbase: float, x: float, dxc: float, dxo: float, log_rho: float, log_t: float, kap_co_option: str = "gn93_co", cubic_x: bool = False, cubic_z: bool = False) -> tuple[float, float, float]): Evaluates Type 2 C/O-enhanced opacity(log10_kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_compton_opacity_rust((rho: float, t: float, lnfree_e: float, d_lnfree_e_dln_rho: float, d_lnfree_e_dln_t: float, eta: float, d_eta_dln_rho: float, d_eta_dln_t: float) -> tuple[float, float, float]): Evaluates Poutanen (2017) Compton opacity(kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_elect_cond_opacity_rust((zbar: float, log_rho: float, log_t: float, use_blouin: bool = True) -> tuple[float, float, float]): Evaluates electron thermal conduction opacity(kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_fixed_metal_rust((z: float, x: float, log_rho: float, log_t: float, prefix: str = "gs98", cubic_x: bool = False, cubic_z: bool = False) -> tuple[float, float, float]): Evaluates Type 1 fixed-metal opacity(log10_kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_kapcn_rust((zbase: float, x: float, fc: float, fn_val: float, log_rho: float, log_t: float) -> tuple[float, float, float]): EvaluateskapCNLederer & Aringer (2009) low-temperature opacity(kap, dlnkap_dlnRho, dlnkap_dlnT).kap_get_results_rust((z: float, x: float, zbase: float, xc: float, xn: float, xo: float, xne: float, log_rho: float, log_t: float, lnfree_e: float, d_lnfree_e_dln_rho: float, d_lnfree_e_dln_t: float, eta: float, d_eta_dln_rho: float, d_eta_dln_t: float, zbar: float = 1.0, kap_option: str = "gs98", kap_co_option: str = "gs98_co", kap_low_t_option: str = "lowT_fa05_gs98", kap_blend_log_t_upper_bdy: float = 3.88, kap_blend_log_t_lower_bdy: float = 3.80, cubic_interpolation_in_x: bool = False, cubic_interpolation_in_z: bool = False, include_electron_conduction: bool = True, use_blouin_conductive_opacities: bool = True, use_zbase_for_type1: bool = True, use_type2_opacities: bool = True, kap_type2_full_off_x: float = 1.0e-3, kap_type2_full_on_x: float = 1.0e-6, kap_type2_full_off_dz: float = 0.001, kap_type2_full_on_dz: float = 0.01) -> tuple[float, float, float, list[float]]): Evaluatesget_kap_results, returning(kap, dlnkap_dlnRho, dlnkap_dlnT, kap_fracs[4]).kap_get_results_zones_rust((z: float, x: float, zbase: float, xc: float, xn: float, xo: float, xne: float, log_rho_zones: _ArrF64, log_t_zones: _ArrF64, lnfree_e: float, d_lnfree_e_dln_rho: float, d_lnfree_e_dln_t: float, eta: float, d_eta_dln_rho: float, d_eta_dln_t: float, zbar: float = 1.0, kap_option: str = "gs98", kap_co_option: str = "gs98_co", kap_low_t_option: str = "lowT_fa05_gs98", kap_blend_log_t_upper_bdy: float = 3.88, kap_blend_log_t_lower_bdy: float = 3.80, cubic_interpolation_in_x: bool = False, cubic_interpolation_in_z: bool = False, include_electron_conduction: bool = True, use_blouin_conductive_opacities: bool = True, use_zbase_for_type1: bool = True, use_type2_opacities: bool = True, kap_type2_full_off_x: float = 1.0e-3, kap_type2_full_on_x: float = 1.0e-6, kap_type2_full_off_dz: float = 0.001, kap_type2_full_on_dz: float = 0.01, parallel: bool = True) -> _ArrF64): Evaluatesget_kap_resultsacrossN_zoneszones at fixed composition, returning an(N_zones, 7)array.kap_get_rust((chem_id: npt.NDArray[np.uintp], xa: _ArrF64, log_rho: float, log_t: float, lnfree_e: float, d_lnfree_e_dln_rho: float, d_lnfree_e_dln_t: float, eta: float, d_eta_dln_rho: float, d_eta_dln_t: float, zbase: float = -1.0, kap_option: str = "gs98", kap_co_option: str = "gs98_co", kap_low_t_option: str = "lowT_fa05_gs98", kap_blend_log_t_upper_bdy: float = 3.88, kap_blend_log_t_lower_bdy: float = 3.80, cubic_interpolation_in_x: bool = False, cubic_interpolation_in_z: bool = False, include_electron_conduction: bool = True, use_blouin_conductive_opacities: bool = True, use_zbase_for_type1: bool = True, use_type2_opacities: bool = True, kap_type2_full_off_x: float = 1.0e-3, kap_type2_full_on_x: float = 1.0e-6, kap_type2_full_off_dz: float = 0.001, kap_type2_full_on_dz: float = 0.01) -> tuple[float, float, float, list[float]]): Evaluateskap_getfrom 1-based isotope IDschem_idand mass fractionsxa.kap_get_zones_rust((chem_id: npt.NDArray[np.uintp], xa_zones: _ArrF64, log_rho_zones: _ArrF64, log_t_zones: _ArrF64, lnfree_e_zones: _ArrF64, d_lnfree_e_dln_rho_zones: _ArrF64, d_lnfree_e_dln_t_zones: _ArrF64, eta_zones: _ArrF64, d_eta_dln_rho_zones: _ArrF64, d_eta_dln_t_zones: _ArrF64, zbase: float = -1.0, kap_option: str = "gs98", kap_co_option: str = "gs98_co", kap_low_t_option: str = "lowT_fa05_gs98", kap_blend_log_t_upper_bdy: float = 3.88, kap_blend_log_t_lower_bdy: float = 3.80, cubic_interpolation_in_x: bool = False, cubic_interpolation_in_z: bool = False, include_electron_conduction: bool = True, use_blouin_conductive_opacities: bool = True, use_zbase_for_type1: bool = True, use_type2_opacities: bool = True, kap_type2_full_off_x: float = 1.0e-3, kap_type2_full_on_x: float = 1.0e-6, kap_type2_full_off_dz: float = 0.001, kap_type2_full_on_dz: float = 0.01, parallel: bool = True) -> _ArrF64): Evaluateskap_getacrossN_zoneszones in parallel, returning an(N_zones, 7)array[kap, dlnkap_dlnRho, dlnkap_dlnT, frac_lowT, frac_highT, frac_Type2, frac_Compton].
atm_py¶
atm_eval_e2((x: float) -> tuple[float, float]): Evaluates the second exponential integral(E_2(x), dE_2/dx).atm_eval_irradiated((l: float, r: float, m: float, cgrav: float, t_eq: float, p_surf: float, kap_guess: float, kap_v: float, gamma: float, errtol: float, max_iters: int, skip_partials: bool, chem_id: Sequence[int] | None = None, xa: _ArrF64 | None = None, zbase: float = 0.02, low_t_option: str = "low_t_fa05_gs98") -> tuple[float, ...]): Evaluates an irradiated grey atmosphere (eval_irradiated).atm_eval_paczynski_gradr((t: float, p: float, rho: float, tau: float, kap: float, l: float, m: float, r: float, cgrav: float) -> float): Evaluates the Paczynski (1969) optical-depth-diluted radiative gradient \(\nabla_{\mathrm{rad}}\).atm_eval_t_tau((t_tau_id: int, tau: float, teff: float) -> float): Evaluates \(\ln T(\tau, T_{\mathrm{eff}})\) for a \(T(\tau)\) relation ID.atm_eval_t_tau_atm((tau_surf: float, l: float, r: float, m: float, cgrav: float, kap_guess: float, pextra_factor: float, t_tau_relation: str, t_tau_opacity: str, errtol: float, max_iters: int, max_steps: int, skip_partials: bool, teff: float, chem_id: Sequence[int] | None = None, xa: _ArrF64 | None = None, zbase: float = 0.02, low_t_option: str = "low_t_fa05_gs98") -> tuple[float, ...]): Dispatches \(T(\tau)\) atmosphere evaluation across'fixed','iterated', and'varying'opacity modes withPextra_factor(eval_t_tau_atm).atm_eval_t_tau_dq_dtau((t_tau_id: int, tau: float) -> float): Evaluates \(dq/d\tau\) for a \(T(\tau)\) relation ID at optical depth \(\tau\).atm_eval_t_tau_uniform((tau_surf: float, l: float, r: float, m: float, cgrav: float, kap_guess: float, pextra_factor: float, t_tau_id: int, errtol: float, max_iters: int, skip_partials: bool, teff: float, chem_id: Sequence[int] | None = None, xa: _ArrF64 | None = None, zbase: float = 0.02, low_t_option: str = "low_t_fa05_gs98") -> tuple[float, ...]): Evaluates a grey \(T(\tau)\) atmosphere with uniform opacity (eval_t_tau_uniform).atm_eval_t_tau_varying((tau_surf: float, l: float, r: float, m: float, cgrav: float, t_tau_id: int, errtol: float, max_steps: int, skip_partials: bool, teff: float, chem_id: Sequence[int], xa: _ArrF64, zbase: float = 0.02, low_t_option: str = "low_t_fa05_gs98") -> tuple[float, ...]): Evaluates a \(T(\tau)\) atmosphere with depth-varying opacity (eval_t_tau_varying).atm_eval_table((l: float, r: float, m: float, cgrav: float, id: int, z: float, skip_partials: bool, teff: float) -> tuple[float, ...]): Evaluates a tabulated model atmosphere (eval_table).atm_eval_table_atm((l: float, r: float, m: float, cgrav: float, atm_table: str, z: float, tau_factor: float, atm_off_table_option: str, t_tau_relation: str, t_tau_opacity: str, kap_guess: float, pextra_factor: float, errtol: float, max_iters: int, max_steps: int, skip_partials: bool, teff: float, chem_id: Sequence[int] | None = None, xa: _ArrF64 | None = None, zbase: float = 0.02, low_t_option: str = "low_t_fa05_gs98") -> tuple[tuple[float, ...], float]): Evaluates a tabulated model atmosphere with upstreamatm_off_table_optionblending (eval_table_atm), returning(eval_tuple, tau_base).atm_eval_table_zones((l: _ArrF64, r: _ArrF64, m: _ArrF64, cgrav: float, id: int, z: float, skip_partials: bool, teff: _ArrF64, parallel: bool = True) -> _ArrF64): Evaluateseval_tableacrossn_zonessurface boundary conditions, returning an(n_zones, 11)array.atm_get_t_tau_base((t_tau_id: int) -> float): Returns the base optical depth \(\tau_{\mathrm{base}}\) of a \(T(\tau)\) relation ID.atm_get_t_tau_id((name: str) -> int): Maps anatm_T_tau_relationname ('Eddington','solar_Hopf','Krishna_Swamy','Trampedach_solar') to its integer ID.atm_get_table_alfa_beta((l: float, teff: float, r: float, m: float, cgrav: float, id: int) -> tuple[float, float]): Evaluates blending weights \((\alpha, \beta)\) between grey and table atmospheres.atm_get_table_base((id: int) -> float): Returns the base optical depth \(\tau_{\mathrm{base}}\) of an atmosphere table ID.atm_get_table_id((name: str) -> int): Maps anatm_tablename ('tau_100','tau_10','tau_1','tau_1m1','photosphere','WD_tau_25','DB_WD_tau_25') to its integer ID.atm_table_photosphere_zsol_spline(() -> tuple[_ArrF64, _ArrF64, bool, bool, _ArrF64]): Returns(logg_array, teff_array, iling, ilint, pgas_coeffs)for the solar metallicity (log_z == 0.0) slice ofATM_TABLE_PHOTOSPHERE.
colors_py¶
py_colors_builtin_grid(() -> tuple[_ArrF64, _ArrF64, _ArrF64, _ArrF64, _ArrI64, _ArrF64, _ArrF64, _ArrF64, _ArrF64, _ArrF64, _ArrF64]): Returns the built-inKurucz2003all+Johnsongrid arrays for@jax.jit:(teff_grid, logg_grid, meta_grid, wavelengths, slot_map, sed_table, filters_on_sed_grid, filter_norm_integrals, vega_zp, ab_zp, st_zp).py_colors_calculate_bolometric_phot((wavelengths: _ArrF64, fluxes: _ArrF64) -> tuple[float, float]): Computes(bol_mag, bol_flux)from(wavelengths, fluxes).py_colors_calculate_synthetic((wavelengths: _ArrF64, fluxes: _ArrF64, filter_wavelengths: _ArrF64, filter_trans: _ArrF64, zero_point_flux: float) -> float): Computes synthetic filter magnitudecalculate_syntheticfrom an SED and filter transmission curve.py_colors_column_names(() -> list[str]): Returns the ordered 10colorshistory output column names:["Mag_bol", "Flux_bol", "Interp_rad", "B", "I", "J", "M", "R", "U", "V"].py_colors_compute_ab_zero_point((filt_wave: _ArrF64, filt_trans: _ArrF64) -> float): Computes the AB photon-counting zero-point flux (\(f_\nu = 3631\,\)Jy).py_colors_compute_st_zero_point((filt_wave: _ArrF64, filt_trans: _ArrF64) -> float): Computes the ST photon-counting zero-point flux (\(f_\lambda = 3.63\times 10^{-9}\,\mathrm{erg\,s^{-1}\,cm^{-2}}\,\mathrm{Å}^{-1}\)).py_colors_compute_vega_zero_point((vega_wave: _ArrF64, vega_flux: _ArrF64, filt_wave: _ArrF64, filt_trans: _ArrF64) -> float): Computes the Vega photon-counting zero-point flux for a filter curve.py_colors_dilute_flux((surface_flux: _ArrF64, r: float, d: float) -> _ArrF64): Applies geometric flux dilutionsurface_flux * (r / d)^2.py_colors_eval_colors((teff: float, log_g: float, metallicity: float, r: float, d: float = 3.0857e19, mag_system: str = "Vega", method: str = "Hermite") -> _ArrF64): Evaluates the 10-columncolorsoutput vector[Mag_bol, Flux_bol, Interp_rad, B, I, J, M, R, U, V]at(teff, log_g, metallicity, r, d)(teffin K,log_ginlog10(cm s^-2),randdin cm,mag_systemin{"Vega", "AB", "ST"},methodin{"Hermite", "Linear", "KNN"}).py_colors_eval_colors_dual((teff: float, log_g: float, metallicity: float, r: float, d: float = 3.0857e19, mag_system: str = "Vega") -> tuple[_ArrF64, _ArrF64]): Evaluates(values, jacobian)foreval_colorsusingDualOrder1<4>seeded on(teff, log_g, metallicity, r)at fixedd, wherevalueshas shape(10,)andjacobianhas shape(10, 4).py_colors_eval_colors_zones((teff: _ArrF64, log_g: _ArrF64, metallicity: _ArrF64, r: _ArrF64, d: float = 3.0857e19, mag_system: str = "Vega", method: str = "Hermite", parallel: bool = True) -> _ArrF64): Evaluates the 10-columncolorsoutput acrossn_zonesstellar models in parallel on the persistentrayonworker pool, returning an(n_zones, 10)array.py_colors_eval_sed((teff: float, log_g: float, metallicity: float, r: float, d: float = 3.0857e19, method: str = "Hermite") -> tuple[_ArrF64, _ArrF64]): Evaluates the diluted stellar SED(wavelengths, fluxes)at(teff, log_g, metallicity, r, d)usingmethod("Hermite","Linear", or"KNN").py_colors_filter_curve((idx: int) -> tuple[_ArrF64, _ArrF64, float, float, float]): Returns(wavelengths, transmission, vega_zp, ab_zp, st_zp)for Johnson filteridx(0..7).py_colors_filter_names(() -> list[str]): Returns the ordered 7 Johnson filter names (["B", "I", "J", "M", "R", "U", "V"]).py_colors_interpolate_array((x_in: _ArrF64, y_in: _ArrF64, x_out: _ArrF64) -> _ArrF64): Resamples 1D curve(x_in, y_in)ontox_outvia piecewise-linear interpolation with flat clamping outside[x_in[0], x_in[-1]].py_colors_simpson_integration((x: _ArrF64, y: _ArrF64) -> float): Evaluates composite non-uniform Simpson quadraturesimpson_integration(x, y).py_colors_trapezoidal_integration((x: _ArrF64, y: _ArrF64) -> float): Evaluates composite trapezoidal quadraturetrapezoidal_integration(x, y).