Skip to content

Synthesize stellar spectra
with ATLAS12 & SYNTHE,
in pure Python.

A faithful, performance-tuned reimplementation of Robert Kurucz's ATLAS12 stellar atmosphere code and SYNTHE spectrum synthesis code, in pure Python. Go from \(T_{\rm eff}\), \(\log g\), and either a bulk metallicity / α-enhancement (\(\rm[M/H]\), \(\rm[\alpha/M]\)) or an arbitrary per-element abundance pattern, to a self-consistent 300–1800 nm spectrum — atmosphere included.

Python 3.10+ License MIT Validated sub-0.1% vs. Fortran Range 300–1800 nm

01 Quick start

Give pykurucz \(T_{\rm eff}\), \(\log g\), and an abundance specification — bulk, per-element, or both — and it returns a self-consistent synthetic spectrum. Two equivalent ways to drive it:

import pykurucz

# Metal-poor α-enhanced K giant (the standard workflow)
spec_path = pykurucz.synthesize(
    teff=4500, logg=2.0,
    mh=-1.5, am=0.3,
    wl_start=500, wl_end=510,
    resolution=300_000,
)
python pykurucz.py \
    --teff 4500 --logg 2.0 \
    --mh -1.5 --am 0.3 \
    --wl-start 500 --wl-end 510
import pykurucz

# CEMP-s star: Fe-poor, C and Ba enhanced
spec_path = pykurucz.synthesize(
    teff=4800, logg=1.5,
    abundances={26: -2.5, 6: +1.2, 56: +1.0},  # Z → dex offset
    wl_start=400, wl_end=700,
)
python pykurucz.py \
    --teff 4800 --logg 1.5 \
    --abund Fe:-2.5 --abund C:+1.2 --abund Ba:+1.0 \
    --wl-start 400 --wl-end 700
import pykurucz
spec_path = pykurucz.synthesize(
    teff=5770, logg=4.44, mh=0.0, am=0.0,
    wl_start=500, wl_end=510,
)
python pykurucz.py --teff 5770 --logg 4.44 \
    --wl-start 500 --wl-end 510

In every case the atmosphere is rebuilt from the requested abundances and the spectrum is synthesised on top of it — no scaled-solar template assumption. See Stellar Parameters for the syntax in detail.

02 Why pykurucz

01 · DEPLOY

Pure Python

No Fortran compiler, no opaque binary blobs. NumPy, SciPy, and Numba — install with pip and run anywhere CPython runs, including air-gapped HPC nodes.

02 · CORRECTNESS

Fortran-validated

End-to-end parity with Kurucz's original ATLAS12 + SYNTHE pipeline. Sub-0.1% flux differences across 300–1800 nm on the validation grid — every kernel was tested against its Fortran counterpart before being trusted.

03 · WARM START

Neural starting atmosphere

A small PyTorch network predicts the starting atmosphere from \(T_{\rm eff}\), \(\log g\), [M/H], [α/M]. The warm start lands inside ATLAS's convergence basin, so atlas_py reaches the tolerance in ~10–15 iterations. A generic grey-atmosphere cold start can stall in a local minimum and never reach the threshold within the iteration budget.

04 · ABUNDANCES

Bulk and per-element, atmosphere included

Two common modes, one consistent pipeline. Set bulk --mh and --am for the standard scaled-solar / α-enhanced cases, or override any individual element (--abund Fe:-1.0 --abund C:+0.4 …) when you need a peculiar pattern. Either way, the atmosphere is rebuilt from scratch with the matching opacity, so line blanketing reshapes the temperature structure self-consistently — not just the spectrum on top of a generic template. Halo dwarfs, α-rich giants, CEMP-s carbon-rich giants, peculiar Ap stars all work end-to-end from one command.

03 Documentation
04 Pipeline at a glance

Two entry points share the same validated synthesis core. Pre-computed atmospheres skip the emulator and atlas_py iteration entirely.

INPUTS ATMOSPHERE PREPROCESSING SYNTHESIS Stellar parameters Teff · logg · [M/H] · [α/M] Existing .atm file ATLAS · MARCS · PHOENIX atmosphere emulator predict warm start atlas_py iterate to converge preprocess populations · opacities synthe_py line-by-line transfer .spec output flux · continuum

Dedicated to the memory of Robert L. Kurucz (1944–2025), whose ATLAS and SYNTHE codes laid the foundations for modern stellar spectroscopy.