pyKurucz: A Pure Python Reimplementation of Kurucz SYNTHE for Stellar Spectrum Synthesis

Elliot M. Kim, Yuan-Sen Ting · 2026

Read pyKurucz: A Pure Python Reimplementation of Kurucz SYNTHE for Stellar Spectrum Synthesis by Elliot M. Kim, Yuan-Sen Ting (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-11693.txt.

Introduction

Kim and Ting present pyKurucz, a pure Python rebuild of the Kurucz codes for stellar spectrum synthesis. ATLAS12 and SYNTHE, the standard tools, are decades-old Fortran that fights modern toolchains. The rebuild translates both engines line by line, dropping the Fortran need for good. NumPy, SciPy, and Numba power the loop, from opacity sampling to line broadening. Against the original, it matches to a median below 0.01 percent across 100 atmosphere models. The range runs from cool giants at 2500 K to O stars at 44,000 K.

Catalog record

CREATORElliot M. Kim, Yuan-Sen Ting
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE13425
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2603.11693

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

pyKurucz: A Pure Python Reimplementation of Kurucz SYNTHE for Stellar Spectrum Synthesis Elliot M. Kim, Yuan-Sen Ting Abstract Summary pyKurucz is a pure Python reimplementation of Kurucz’s SYNTHE spectrum synthesis code — the standard tool for computing synthetic stellar spectra from first principles. Stellar spectra encode information about a star’s temperature, gravity, and chemical composition, but extracting it requires a forward model: given a stellar atmosphere and a catalog of atomic transitions, compute the light that escapes at each wavelength. SYNTHE has filled this role for decades. pyKurucz performs the same calculation, to the same numerical precision, entirely in Python. The calculation proceeds wavelength by wavelength. At each point, the code evaluates how opaque the stellar atmosphere is. The continuous (smooth) opacity component arises from H - absorption (the dominant source in Sun-like stars), hydrogen bound-free (Karsas & Latter cross-sections for levels n=1 – 15 , analytic for higher), helium, metals, Rayleigh scattering, and Thomson scattering — all interpolated from pre-tabulated arrays following the original KAPP logic. The line component comes from discrete atomic transitions: every line in the Kurucz GFALL catalog ( {\sim}1.3 million entries) near the current wavelength contributes a Voigt profile combining thermal (Doppler) and pressure (van der Waals, Stark, radiative) broadening. Hydrogen Balmer and Lyman lines receive dedicated Stark-broadened profiles via the HPROF4 routine (Holtsmark ion microfield theory, Griem impact corrections, quasi-molecular H 2 /H {}_{2}^{+} satellites for Lyman- \alpha ). Helium lines use tabulated BCS/Griem/Dimitrijević profiles. Once opacity is known at every layer, the code solves the radiative transfer equation. The emergent Eddington flux H_{\nu} is computed by the JOSH solver — a port of Kurucz’s ATLAS routine — integrating on a fixed \log\text{-}\tau grid with parabolic optical depth quadrature, source function remapping, and Lambda iteration for scattering, yielding both line+continuum F_{\lambda} and continuum-only F_{\rm cont} . The relative populations of ionization and excitation states — determining how many absorbers are available for each transition — follow from Saha ionization equilibrium and Boltzmann excitation with detailed partition functions. Molecular equilibrium for {\sim}300 diatomic species is solved during atmosphere preprocessing, affecting the electron donor budget and number densities. The implementation uses NumPy, SciPy, and Numba (JIT compilation of inner loops), requiring no Fortran compiler. It is validated to sub-0.01% median agreement with the original Fortran across stellar types from 2500 K cool giants to 44000 K O stars over 300–1800 nm at resolving power R=300{,}000 . Statement of need Kurucz’s SYNTHE is the most widely used code for computing synthetic stellar spectra from first principles, with the atomic and molecular line lists that accompany it accumulating tens of thousands of citations over several decades ( 3 ) . The original Fortran, written in a pre-Fortran-77 dialect with fixed-format source, single-character variables, computed GOTOs, and EQUIVALENCE statements, is incompatible with modern gfortran without significant manual patching — compiling it is a rite of passage that has defeated many research groups. Following the passing of Robert L. Kurucz in 2025, the long-term maintenance trajectory of the original code is uncertain. This work provides a faithful, ground-truth numerical reimplementation of SYNTHE in pure Python — not a wrapper around Fortran, but a line-by-line translation validated against the original. Spectrum synthesis requires a model atmosphere as input — a file describing the temperature–pressure–density stratification of the stellar photosphere. The synthe_py package works with any Kurucz-format .atm file from any source (ATLAS12, MARCS, PHOENIX, etc.). For convenience, the repository also bundles a pre-trained neural network emulator ( 4 , kurucz-a1;) that can predict ATLAS12-quality atmospheric structures from four stellar parameters, but this is an optional component — the synthesis engine itself has no dependency on it. A Python reimplementation offers concrete benefits: direct integration with machine learning workflows (training emulators, differentiable spectral fitting); interoperability with the broader Python ecosystem (NumPy, SciPy, Astropy); flexibility for customization without recompiling Fortran; cross-platform installation with no compiler dependency; and improved readability for teaching and debugging. State of the field Stellar spectrum synthesis has long been dominated by Fortran-based codes. The most widely used include Kurucz’s SYNTHE ( 3 ) , MOOG ( 8 ) , Turbospectrum ( 7 ) , and SPECTRUM ( 2 ) , each of which has served as a community standard for decades. While highly accurate, these codes require Fortran toolchains, are difficult to install across operating systems, often lack documentation, and do not integrate naturally with modern Python-based analysis workflows. Several efforts have brought synthesis into more modern environments. Spectroscopy Made Easy ( 6 , SME;) combines an IDL interface with compiled C++ and Fortran backends; its Python rewrite, PySME ( 10 ) , replaced the IDL layer but retained the compiled synthesis engine. iSpec ( 1 ) provides a Python framework wrapping SYNTHE, MOOG, or Turbospectrum, but requires the underlying Fortran codes to be installed. KORG ( 11 ) is a modern 1D LTE synthesis package written in Julia with automatic differentiation support; it represents the closest analog in philosophy, though it is not a reimplementation of any existing code and uses a different language ecosystem. A separate class of approaches uses machine learning to approximate synthetic spectra. The Cannon ( 5 ) learns a data-driven spectral model from a training set; The Payne ( 9 ) trains a neural network to interpolate ab initio models across label space. These are powerful for survey analysis but are statistical approximations tied to training grid fidelity. pyKurucz occupies a distinct position: it is a faithful numerical reimplementation of SYNTHE — the specific code whose line lists and physics have been the de facto standard for decades — validated against the Fortran ground truth, requiring no Fortran at any stage. This makes it the first tool to offer Kurucz-SYNTHE-quality synthesis within a pure Python environment. Software design The synthesis engine ( synthe_py ) is a standalone Python package organized into three layers. The I/O layer ( synthe_py.io ) handles atmosphere loading (Kurucz .atm and preprocessed .npz formats), atomic line catalog parsing and compilation (GFALL format), and spectrum export. The physics layer ( synthe_py.physics ) implements continuous opacity interpolation (KAPP), line opacity with Voigt profiles ( voigt_jit.py for Numba-accelerated evaluation), hydrogen Stark-broadened profiles (HPROF4 port), helium tabulated profiles (BCS/Griem/Dimitrijević), autoionizing line profiles (Fano asymmetric Lorentzians), Saha–Boltzmann population calculations with detailed partition functions (PFSAHA), and the molecular equilibrium solver ( {\sim}300 species, Gibbs free energy minimization). The engine layer ( synthe_py.engine ) orchestrates wavelength-by-wavelength opacity accumulation and radiative transfer via the JOSH solver. pyKurucz reuses the same input data as the original Fortran. The atomic line list ( gfallvac.latest ) is compiled into a cached NumPy archive on first use. Partition functions, ionization potentials, continuum opacity tables, and molecular equilibrium data are stored as .npz archives pre-extracted from Fortran data files, ensuring the Python pipeline operates on exactly the same physical data as the Fortran ground truth. Performance-critical routines — Voigt profile evaluation, opacity accumulation, and transfer integration — use Numba JIT compilation. The repository additionally includes an optional neural network atmosphere emulator ( 4 ) and a convenience script ( pykurucz.py ) for end-to-end synthesis from stellar parameters, but these are separate from the core synthe_py package. Research impact statement pyKurucz has been validated against the original Fortran SYNTHE across 100 randomly drawn

Read the complete text