Code accompanying the paper:
Ionizing photon production and escape fractions during cosmic reionization in the TNG50 simulation Ivan Kostyuk, Dylan Nelson, Benedetta Ciardi, Martin Glatzle, Annalisa Pillepich MNRAS 521, 3077 (2023) — DOI: 10.1093/mnras/stad677 · arXiv:2207.11278
Understanding which galaxies supply the bulk of ionizing photons during the epoch of reionization (6 < z < 10) requires knowing not just how many ionizing photons are produced, but what fraction escape from their host halos. Measuring this escape fraction fesc directly at high redshift is observationally out of reach, and theoretical predictions differ substantially depending on how radiative transfer and sub-grid absorption are modelled.
This repository contains the analysis code for a study that post-processes ~4 000 TNG50 galaxies (106 ≤ M★/M☉ ≤ 108) with the 3D multi-frequency radiative transfer code CRASH, computing fesc self-consistently along thousands of lines of sight per halo.
Key results:
- fesc rises with stellar mass from ~0.3 at M★ = 106 M☉ to ~0.6 at M★ = 107.5 M☉, with hints of a turnover at higher masses
- Significant scatter at fixed mass, driven by diversity in the ionizing photon rate and the spatial relationship between stellar sources and the gas density field
- Dust reduces fesc by a few percent at low masses and up to 10% for M★ ≳ 106.5 M☉
- fesc is energy-dependent: photons above 54.4 eV (relevant for He reionization and binary-star models) escape at a substantially lower rate than lower-energy ionizing photons
- Halos with M★ ≲ 107.5 M☉ dominate the global ionizing emissivity at all redshifts studied
The notebooks in this repo are load-bearing: each one produces specific figures in the paper and contains the full analysis pipeline for that result. They are not exploratory scratch pads — they are the analysis.
These scripts interact directly with the CRASH post-processing runs or TNG50 snapshot data and must be run before the analysis notebooks.
| Script | Purpose |
|---|---|
build_df.py |
Reads CRASH output folders and assembles a pandas dataframe of halo properties |
update_df.py |
Adds stellar ages, gas clumping, and surface density columns to the dataframe |
add_metallicities.py |
Appends stellar metallicities to the dataframe |
prepare_new_runs.py |
Tools for setting up a new CRASH post-processing run |
synchronize_folders.py |
Moves halos from reduced-source RT runs to full-source fesc calculations |
phase_diagram.py |
Generates phase diagram data |
These notebooks read the compiled dataframe and produce the paper figures. They can be run independently of the simulation data, provided the dataframe is available (see Data below).
| Notebook | Figures | What it does |
|---|---|---|
counts_histogram.ipynb |
Fig. 1 | Halo population summary plots |
median_fesc.ipynb |
Figs. 2, 3, 13 | fesc vs stellar/halo mass; dust comparison; literature comparison |
fesc_vs_quant.ipynb |
— | fesc as a function of various galaxy properties |
histograms.ipynb |
Fig. 6 | 2D histograms of halo properties vs fesc; bimodal escape fraction analysis |
loc_esc.ipynb |
Fig. 7 | Effect of different local (cloud-scale) escape fraction assumptions |
uv_emissivity.ipynb |
Figs. 8, 9 | Escaped ionizing photon density in TNG50; comparison to literature |
r_fesc.ipynb |
Fig. 10 | Properties of individual stellar particles and their contribution to fesc |
spectra.ipynb |
Figs. 11, 12 | Spectral (energy) dependence of fesc |
numerical_convergence_tests.ipynb |
Fig. A1 | Source number reduction convergence tests |
large_radii.ipynb |
— | fesc as a function of aperture radius (not in final paper) |
These two notebooks need the raw CRASH density and ionization maps, not just the dataframe:
| Notebook | Figures | What it does |
|---|---|---|
esc_fraction.ipynb |
Fig. 5 | Line-of-sight fesc maps and density projections for individual halos |
halo_image.ipynb |
Fig. 4 | Projected images of halo gas and stellar distributions |
Not used for data analysis — for preparing and cleaning CRASH runs:
| Notebook | Purpose |
|---|---|
merge_sources.ipynb |
Source reduction pre-processing; includes validation tests |
clean_up.ipynb |
Deletes intermediate simulation files to reduce disk usage |
The analysis notebooks require the compiled halo dataframe, which is not included in this repository due to size. To obtain the dataframe, please open an issue or reach out via the contact on the arXiv page.
Python ≥ 3.7, NumPy, pandas, matplotlib, h5py, astropy. Access to IllustrisTNG simulation data and CRASH outputs is required to run the simulation-facing scripts.
If you use this code, please cite:
@article{Kostyuk2023fesc,
author = {Kostyuk, Ivan and Nelson, Dylan and Ciardi, Benedetta and Glatzle, Martin and Pillepich, Annalisa},
title = {Ionizing photon production and escape fractions during cosmic reionization in the {TNG50} simulation},
journal = {MNRAS},
year = {2023},
volume = {521},
pages = {3077},
doi = {10.1093/mnras/stad677},
eprint = {2207.11278},
archivePrefix = {arXiv}
}