Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters – References 2025

Bisweswar Sen, Abhirup Datta · 2025

Read Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters – References 2025 by Bisweswar Sen, Abhirup Datta (2025) 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-2509-06834.txt.

Introduction

Reading the early universe's history from a faint hydrogen signal is made easier to enter by Bisweswar Sen in a solo 2025 cosmology paper. The twenty-one-centimeter line of neutral hydrogen can probe cosmic dawn, but pulling astrophysical parameters from its power spectrum is hard. Sen presents a beginner-friendly pipeline built in PyTorch.

The method is marginal neural ratio estimation, a simulation-based inference method that avoids writing down an explicit likelihood. Runs from the 21cmFAST code supply training data. From power spectra alone, the pipeline recovers key parameters such as how well gas was ionized and the X-ray brightness of early sources. Openness and ease of use are the stated aims, offering newcomers a hands-on entry point into twenty-one-centimeter cosmology rather than a black box. The work is a teaching tool as much as a measuring method.

Catalog record

CREATORBisweswar Sen, Abhirup Datta
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE13 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-06834

Browse the full library · About the Tower of Babel

Full text

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

Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters Unlocking 21cm Cosmology with SBI: A Beginner friendly NRE for Inference of Astrophysical Parameters – References 2025 Bisweswar Sen, Abhirup Datta Abstract The 21-cm line of neutral hydrogen is a promising probe of the early Universe, yet extracting astrophysical parameters from its power spectrum remains a major challenge. We present a beginner-friendly PyTorch pipeline for Marginal Neural Ratio Estimation (MNRE), a Simulation-Based Inference (SBI) method that bypasses explicit likelihoods. Using 21cmFAST simulations, we show that MNRE can recover key astrophysical parameters such as the ionizing efficiency ζ \zeta and X-ray luminosity L X L_{X} directly from power spectra. Our implementation prioritizes transparency and accessibility, offering a practical entry point for new researchers in 21-cm cosmology. 1 Introduction The 21-cm hyperfine transition of neutral hydrogen offers a unique window into the high-redshift intergalactic medium (IGM), particularly during the Epoch of Reionization (EoR) and the preceding Epoch of Heating (EoH) ( Furlanetto, Oh & Briggs 2006 ) . The observed differential brightness temperature relative to the CMB can be written as \delta T_{b}(\nu)\approx 27\,x_{\rm HI}(1+\delta_{b})\left(\frac{\Omega_{b}h^{2}}{0.023}\right)\left(\frac{0.15}{\Omega_{m}h^{2}}\frac{1+z}{10}\right)^{1/2}\left(1-\frac{T_{\rm CMB}}{T_{S}}\right){\rm mK}, (1) where x_{\rm HI} is the neutral fraction, \delta_{b} the baryonic overdensity, and T_{S} the spin temperature. This dependence encodes the ionization and thermal history of the IGM, controlled by astrophysical parameters such as the ionizing efficiency \zeta and X-ray luminosity L_{X} of early galaxies. A key statistical observable is the dimensionless power spectrum \Delta^{2}(k,z)=\frac{k^{3}}{2\pi^{2}}P_{21}(k,z), (2) where P_{21}(k,z) is the 3D power spectrum of \delta T_{b} . The shape and amplitude of \Delta^{2}(k,z) at different redshifts carry information about ionization morphology and IGM heating processes. Traditional Bayesian inference of astrophysical parameters requires evaluating the likelihood p(x|\theta)=\exp\left[-\frac{1}{2}(x-\mu_{\theta})^{\top}\Sigma_{\theta}^{-1}(x-\mu_{\theta})\right], (3) which is often intractable for high-dimensional 21-cm data. Instead, Simulation-Based Inference (SBI) replaces explicit likelihoods with neural estimators trained on simulations. Within SBI, Marginal Neural Ratio Estimation (MNRE) ( Hermans, Begy & Louppe 2020 ) learns the likelihood-to-evidence ratio r_{\phi}(x,\theta)\approx\frac{p(x|\theta)}{p(x)}, (4) through a binary classification task. Bayes’ theorem then yields p(\theta|x)\propto r_{\phi}(x,\theta)\,p(\theta). (5) Recent works (e.g. Saxena et al. 2023 ) have demonstrated the promise of MNRE in recovering astrophysical parameters from mock SKA data. However, existing SBI frameworks often rely on rigid data hierarchies (e.g. Zarr) that present barriers to new users. In this work, we present a streamlined PyTorch-based MNRE pipeline that lowers the technical threshold while retaining scientific robustness. 2 Simulations and Astrophysical Parameters We generate our training data using the 21cmFAST v3.0 semi-numerical simulation ( Mesinger, Furlanetto & Cen 2011 ) . Cosmological parameters are fixed to \Lambda CDM values consistent with Planck 2018 results ( Planck Collaboration 2020 ) . We vary two key astrophysical parameters: (1) the ionizing efficiency \zeta of high- z galaxies, and (2) the soft X-ray luminosity per star-formation-rate L_{X,<2\,{\rm keV}} (in units of erg s -1 per M_{\odot} yr -1 ). The ionizing efficiency \zeta encapsulates factors such as the stellar escape fraction and photon production efficiency (cf. Barkana & Loeb 2001 ); we sample \zeta uniformly in [10,100]. The X-ray parameter \log_{10}L_{X} sets the heating of the IGM by high-mass X-ray binaries ( Mineo et al. 2012 ) ; we sample \log_{10}L_{X} in [38,42]. As illustrated in Figure 1 , the overall pipeline begins with random sampling of astrophysical parameters. These parameters are then propagated through 21cmFAST to generate lightcones, which are sliced and analyzed. This visual summary ensures that the data generation workflow is transparent for new researchers. Figure 1: Workflow of the dataset generation pipeline. Astrophysical parameters are randomized to create 300 parameter sets, which are fed into 21cmFAST to generate lightcones. Each lightcone is sliced into chunks for power spectrum extraction. This flowchart highlights the modularity and beginner-friendly design of the pipeline. We generate 300 independent lightcones with random (\zeta,\log_{10}L_{X}) . Each lightcone is segmented into 11 slices along the line-of-sight (equal comoving depth) and we compute the 21-cm power spectrum \Delta^{2}(k) for each slice. This yields 300\times 11=3300 power spectra in our training set. Figure 2 shows the power spectra extracted from 11 line-of-sight chunks of a single lightcone. Each curve represents the dimensionless power spectrum \Delta^{2}(k) at a different comoving depth, and together they capture the cosmic evolution encoded in a single simulated observation. Figure 2: Example 21-cm power spectra from a single lightcone, divided into 11 line-of-sight chunks. Each curve corresponds to one slice, showing how \Delta^{2}(k) evolves with comoving distance. This reflects the redshift evolution of ionization and heating processes. To emphasize the variation between chunks, Figure 3 zooms in on the first two spectra. These differences highlight how even within one lightcone, the astrophysical parameters leave distinct imprints across redshift slices, motivating the use of a machine-learning inference framework. Figure 3: Zoomed-in view of the first two power spectrum chunks from Figure 2 , illustrating subtle variations in \Delta^{2}(k) across slices of the same lightcone. These intra-lightcone variations are crucial for training MNRE to recognize astrophysical parameter dependencies. 3 Marginal Neural Ratio Estimation Methodology We implement MNRE by training a simple multi-layer perceptron (MLP) in PyTorch ( PyTorch Team 2023 ) to act as a likelihood ratio estimator. The input to the network is an augmented vector combining parameters and data. Training is conducted on 3300 examples for 100 epochs with the Adam optimizer and binary cross-entropy loss. Training converges stably, and retraining yields consistent ratio predictions, demonstrating that the mapping has been learned robustly. This approach bypasses complex data structures, in contrast to Swyft’s Zarr-based workflow. 4 Results Using the trained ratio network, we computed posterior distributions on (\zeta,L_{X}) for test signals. As shown in Figure 4 , the predicted likelihood ratio increases monotonically with the ionizing efficiency \zeta . This demonstrates that the network has successfully captured the astrophysical sensitivity of the signal. Figure 4: Predicted likelihood ratio as a function of the ionizing efficiency \zeta . The monotonic growth indicates that MNRE correctly recovers the dependence of the 21-cm signal on ionizing efficiency. When extended to the two-dimensional parameter space, Figure 5 reveals correlations between \zeta and L_{X} . The color scale encodes the predicted ratio, and the positive slope demonstrates that higher ionizing efficiency can be offset by stronger X-ray heating to produce similar power spectra. Using the trained ratio network, we computed posterior distributions on (\zeta,L_{X}) for various test signals. For example, fixing \zeta=50 , we sweep L_{X} and compute r(x,\zeta,L_{X}) for an observed power spectrum x . The resulting posterior p(\zeta=50,L_{X}|x)\propto rp(L_{X}) yields a 1D distribution on L_{X} . We find that the peak and spread of this posterior correctly identify the true L_{X} within uncertainties. Figure 4 shows a representative recovered posterior: the 1D marginals for \zeta and L_{X} (diagonal panels) and their 2D correlation (off-diagonal) are plotted, demonstrating that the MNRE-derived constraints align with the input parameters. In our two-parameter examples, we observe a clear trend: the inferred neural ratio increases with increasing \zeta (for fixed x ) as shown in Figure 5. This is physically sensible because, in our setup, higher ionizing efficiency tends to produce a stronger reionization signal (lower power spectrum) relative to heating, affecting the ratio. The 2D posterior in ( \zeta,L_{X} ) often shows a positive correlation: high \zeta can be partially

Read the complete text