Skip to main content
Sandbox Physics
Hearing the first stars in 21 cm hydrogen

Recompute HERA's upper limits and compare a model through its window

Sandbox Physics ·

With one short Python script and the public HERA Phase I files you can rebuild all seven Field 1 upper limits between k=0.19k=0.19 and 0.58 h Mpc−10.58\,h\,\mathrm{Mpc^{-1}}, digit for digit, and then compare two model histories with them the way the paper says a model should be compared: through the window functions. This guide gives the files, the command, the expected output and five mistakes that change the answer.

You should know what a bandpower, a window function and the rule U=max⁡(Δ^2,0)+2σU=\max(\hat\Delta^2,0)+2\sigma are. The chapter turning delay power into a bandpower explains them.

The files and what each one is

All files are in one folder and can be downloaded individually.

Table 5.1 The tutorial files, their content and their label.
FileWhat it holdsLabel
hera-h1c-idr2-window-extract.jsonHERA bandpowers, 1σ1\sigma, window rows and neighbour covariance, all three fields, both bands, 0.15≤k≤0.60.15\le k\le0.6Real observation, derived extract
model-spectra.jsonDensity-only prediction on HERA's window grid for a heated and a cold historyIdeal reference
recompute_window_comparison.pyThe script, standard library onlyMethod
expected-output.jsonWhat the script should writeCheck
MANIFEST.jsonByte counts, SHA-256 hashes, versions and unitsProvenance
NOTICE.txtSource, citation and reuse termsProvenance

The extract comes from the three UVPSpec files in the HERA Collaboration's public release, HERA_2021_pspec_data.zip, retrieved on 12 November 2026 with SHA-256 1c98d163...388d2c. The paper states that the data behind its Tables 3 and 4 and Figures 17 and 18 are public. HERA Collaboration 2022, Data section The release page names no licence, so the extract is shared for teaching and verification with a request to cite the paper. The extraction script that reads the HDF5 files with h5py and numpy is kept in this site's source repository. It writes out the delay-to-kk conversion from hera_pspec at the git hash recorded in the files. hera_pspec conversions.py

The model file is not a HERA product and was not fitted to HERA data. It is the Lab's linear prediction Δ212=Tˉb2(1+μ2)2Δm2\Delta^2_{21}=\bar T_{\mathrm b}^2(1+\mu^2)^2\Delta^2_m with μ=1\mu=1, an Eisenstein-Hu no-wiggle transfer function and Planck 2018 parameters. Eisenstein and Hu 1998 The heated history has Tˉb=16.2 mK\bar T_{\mathrm b}=16.2\,\mathrm{mK} at z=7.93z=7.93, the cold one −221 mK-221\,\mathrm{mK}.

Run it

From the folder that holds the files:

python3 -I recompute_window_comparison.py hera-h1c-idr2-window-extract.json model-spectra.json my-output.json

The flag keeps Python from importing anything from the current folder. The script prints:

redshift 10.38
  k=0.256  U=(95.74)^2 mK^2  heated/U=0.0032  cold/U=0.375
  k=0.384  U=(178.23)^2 mK^2  heated/U=0.0014  cold/U=0.163
  k=0.512  U=(296.30)^2 mK^2  heated/U=0.0006  cold/U=0.076
redshift 7.93
  k=0.192  U=(30.76)^2 mK^2  heated/U=0.0168  cold/U=3.132
  k=0.320  U=(49.60)^2 mK^2  heated/U=0.0110  cold/U=2.063
  k=0.448  U=(113.39)^2 mK^2  heated/U=0.0029  cold/U=0.542
  k=0.576  U=(148.85)^2 mK^2  heated/U=0.0021  cold/U=0.389

Then compare my-output.json with expected-output.json. The only field allowed to differ is the Python version. The reference run used Python 3.9.6; the model file was exported with Node v26.11.1.

The script stops with an error when a window row's sum differs from one by more than 10−610^{-6}, or when the model grid differs from the window grid.

Step 1: rebuild the limits

The files hold bandpowers on a grid of Δk=0.064 h Mpc−1\Delta k=0.064\,h\,\mathrm{Mpc^{-1}}. HERA's public notebook recommends either the single lowest limit in each band or every other bin, because neighbouring bins are correlated. The script takes every other bin, starting at 0.2560.256 in Band 1 and 0.1920.192 in Band 2 as the notebook does. HERA Public Data Release 1, notebook

Table 5.2 Field 1 bandpowers, errors and upper limits rebuilt from the public files.
Band, redshiftkkΔ^2\hat\Delta^2σ\sigmaUUU\sqrt U
1, z=10.4z=10.40.2561708.73729.09166.895.74
1, z=10.4z=10.40.3846829.812467.431764.6178.23
1, z=10.4z=10.40.51227953.929918.787791.2296.30
2, z=7.9z=7.90.192211.7367.3946.430.76
2, z=7.9z=7.90.320−516.0-516.01229.82459.749.60
2, z=7.9z=7.90.4485974.13441.112856.3113.39
2, z=7.9z=7.90.5767409.67373.122155.8148.85

Powers are in mK2\mathrm{mK^2} and U\sqrt U in mK\mathrm{mK}. The two headline limits, (95.74)2(95.74)^2 at z=10.4z=10.4 and (30.76)2(30.76)^2 at z=7.9z=7.9, are the values printed in the paper. HERA Collaboration 2022, §4.4 Reproducing them exactly checks both the extract and the rule.

Step 2: pass the models through the windows

For each kept bin the script multiplies the model on HERA's full window grid by that bin's window row and sums. It also reports the model at the bin centre, so you can see how much the window matters. At z=7.9z=7.9 the cold history exceeds the limit in the first two bins, by factors 3.133.13 and 2.062.06. The heated history stays below 0.0170.017 of every limit. At z=10.4z=10.4 neither history is excluded.

What this does and does not show: a density-only model of fully coupled, unheated gas at z=7.9z=7.9 is ruled out by HERA's Field 1 data. It says nothing about models with strong spin-temperature or ionization fluctuations, which this model leaves out.

Five mistakes that change the answer

The script computes each of these on purpose and writes it next to the correct value.

  1. Keeping a negative estimate. At k=0.320k=0.320 the estimate is −516.0-516.0. Adding 2σ2\sigma to it gives 1943.71943.7 instead of 2459.7 mK22459.7\,\mathrm{mK^2}, a limit 21 % tighter than the data support.
  2. Using 1σ1\sigma. At k=0.192k=0.192 the limit drops from 946.4946.4 to 579.0 mK2579.0\,\mathrm{mK^2}. That is no longer a 95 % limit.
  3. Skipping the window. At k=0.192k=0.192 the cold model is 28932893 at the bin centre and 2964 mK22964\,\mathrm{mK^2} through the window; the heated model is 15.4915.49 against 15.8715.87. Small here, but it biases every comparison in the same direction.
  4. Converting hh twice. HERA's kk is already in h Mpc−1h\,\mathrm{Mpc^{-1}}. Dividing it by h=0.6736h=0.6736 again moves every point to 1.481.48 times larger kk, and the windowed cold model at 0.1920.192 rises from 29642964 to 4604 mK24604\,\mathrm{mK^2}, 55 % too high.
  5. Treating every native bin as independent. The extract carries the covariance between neighbouring bins. Their correlation coefficient is 0.250.25 to 0.310.31 in Band 2 and 0.320.32 to 0.330.33 in Band 1. Combining all seven native bins as if independent would overstate how much the data constrain.

Units, conventions and limits of this check

The kk values in the files use HERA's cosmology, with H0=67.27 km s−1 Mpc−1H_0=67.27\,\mathrm{km\,s^{-1}\,Mpc^{-1}}. HERA Collaboration 2022, §4 The model uses Planck 2018, h=0.6736h=0.6736. The 0.13 % difference in hh moves a model point by far less than the window width of 0.031 h Mpc−10.031\,h\,\mathrm{Mpc^{-1}}, so it is ignored here and recorded in the manifest.

The estimates are the real part of the cross-power spectrum, in mK2\mathrm{mK^2}. The errors are the square root of the covariance diagonal stored in the file; because the seven limits match the paper, these are the error bars behind its Tables 3 and 4. The extract also holds Fields 2 and 3; the comparison uses Field 1 only, as the paper's headline limits do. This is not a likelihood analysis. A proper constraint would treat the correlated limits in a statistical model.

Checklist

  • Check the SHA-256 of each file against MANIFEST.json before running.
  • Run with python3 -I and compare your output with expected-output.json.
  • Confirm the seven limits, and especially the two headline values, against the paper.
  • Keep negative estimates at zero, add 2σ2\sigma, and use every other bin.
  • Pass models through the window rows and keep kk in h Mpc−1h\,\mathrm{Mpc^{-1}} once.
  • Label HERA numbers as real observation and model numbers as ideal reference wherever you plot them.

Try it in the Lab

21 cm cosmic dawn and radio foregrounds: Try the cold-hydrogen preset and compare its HERA ratio with your script's output.

Sources

  1. HERA Collaboration 2022, Data section
  2. hera_pspec conversions.py
  3. Eisenstein and Hu 1998
  4. HERA Public Data Release 1, notebook

Keep reading

What this page links to directly

Hearing the first stars in 21 cm hydrogen · Reading path

From hydrogen brightness to a HERA upper limit

  1. ArticleFinding faint early hydrogen under a bright radio sky
  2. ArticleWhy early hydrogen glows or casts a shadow at 21 cm
  3. ArticleHow one baseline separates smooth foregrounds from hydrogen
  4. ArticleTurning delay power into a bandpower without losing the signal
  5. You are hereRecompute HERA's upper limits and compare a model through its window
  6. ArticleReading how HERA kept foregrounds out of its first limits
Something broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy