eor-limits is a small utility that provides a compendium of published upper limits on the 21-cm power spectrum from the Epoch of Reionization (EoR) and Cosmic Dawn. It also provides functionality to plot these limits as a function of scale
The published limits are included in human-readable YAML files in the data folder, alongside the theoretical predictions in the theory folder and sensitivity estimates in the sensitivities folder. It is also possible to read in custom YAML files, and we welcome pull requests to add new observational data or theory models from published papers.
To use the code, check out the Usage and examples. For users who want to quickly explore the limits and make plots without needing to install anything, check out the new online interface: eorlimits.streamlit.app!
-
Clone the repository using
git clone https://github.com/EoRImaging/eor_limits -
For a simple user installation, change directories into the
eor_limitsfolder and runpip install .(including the dot). -
To install without dependencies, run
pip install --no-deps .(including the dot).
-
pip installation: Developers who would like to contribute to the code can install the package as:
pip install -e .(including the dot). This will install the package in editable mode, which allows you to make changes to the code and have them immediately reflected when you import the package. -
uv installation: If you prefer to use
uvto manage your environment, you can install the package in editable mode with the development dependencies using:uv sync. To also install the dependencies for building the documentation, useuv sync --group docs. -
Using pre-commit: To use pre-commit to prevent committing code that does not follow our style, you'll need to run
pre-commit installin the top leveleor_limitsdirectory. -
Testing: To run the tests, you can use the command
pytestfrom the top leveleor_limitsdirectory. If you haveuvinstalled, you can also run the tests with the development dependencies usinguv run pytest. -
CLI debugging: To debug the CLI, prefix the command you want to run with the environment variable
EOR_LIMITS_DEBUG=1, e.g.EOR_LIMITS_DEBUG=1 eor-limits plot-vs-k --out=MyPlot.pdf. This will print out richly-formatted tracebacks instead of the high-level error messages.
There are three main ways to use eor-limits: through the online graphical user interface (GUI), through the Python API in a notebook or script, or through the command line interface (CLI).
The online GUI is the quickest way to explore published limits and generate plots without installing anything locally. It is built with Streamlit and lets you select datasets, apply filters, customize the display, and download both the data and resulting figures. You can access it at eorlimits.streamlit.app. Note that the GUI may differ in its plotting style and customization options, as it sits on a different GitHub repository (although using this codebase as a dependency) and is maintained separately.
The Python API provides tools for loading, filtering, and plotting the included datasets. For a more complete walkthrough, see the Tutorial notebook. Here we just give a brief overview. All datasets are loaded with load_limit_data, load_theory_model, or load_sensitivity_data, which return a DataSet object. For available datasets, see KNOWN_LIMITS, KNOWN_THEORIES, and KNOWN_SENSITIVITIES. A simple example of loading the data and slicing it is shown below:
from eor_limits import load_limit_data, load_theory_model, load_sensitivity_data
from eor_limits import KNOWN_LIMITS, KNOWN_THEORIES, KNOWN_SENSITIVITIES
hera2026 = load_limit_data("HERA2026") # or eor_limits.DataSet.load("HERA2026")
print(hera2026.data.as_pandas_df())
hera2026_trunc = hera2026.select_z_range(7, 10).select_k_range(0.1, 1)
hera2026_lowest = hera2026.select_lowest_delta_squared(per_z=True, per_tag=False)The two main plotting functions are plot_vs_k and plot_vs_z, which show limits as a function of scale
from eor_limits import plot_vs_k, plot_vs_z
plot_vs_k()The plotting functions accept keyword arguments to choose which observational limits, theory models, and sensitivity estimates to include. You can then customize their styles. For example, the following code plots the HERA limits between redshifts 7 and 11, bolds and shades the HERA 2023 result, adds the Mesinger2016Faint and Mesinger2016Bright theory models with custom colors and shaded regions, and adds the SKA-Low AA4 sensitivity estimate in red.
from eor_limits import plot_vs_k, plot_vs_z
plot_vs_k(
limits=["HERA2022", "HERA2023", "HERA2026"],
z_range=(7, 11),
bold_limits=["HERA2023"],
shade_limits=True,
base_limit_style={"shade_alpha": 0.05},
limit_styles={"HERA2023": {"shade_alpha": 0.5}},
theories=["Mesinger2016Faint", "Mesinger2016Bright"],
shade_theories=True,
base_theory_style={"color": "black"},
theory_styles={
"Mesinger2016Faint": {"linestyle": "--"},
"Mesinger2016Bright": {"linestyle": ":"},
},
sensitivities={"SKA-AA4": "Breitman2026_AA4_deep1080h"},
sensitivity_style={"SKA-AA4": {"color": "red"}},
publication=True,
out="MyPlot.pdf",
)Note that custom sensitivity files must use the same format as the limits, i.e. units of k_unit attribute of its output file), so these values must be divided by k_unit: h/Mpc attribute must be present in the YAML file. Files without it are rejected.
After installation, you can use the eor-limits command to make plots from the terminal. Run eor-limits -h, eor-limits plot-vs-k -h, or eor-limits plot-vs-z -h to see the available options.
For the default plot of all limits as a function of scale
eor-limits plot-vs-k --out=MyPlot.pdfThe CLI exposes the same plotting options as the Python API. Dictionary-style options, such as sensitivities and custom styles, are passed as JSON strings:
eor-limits plot-vs-k \
--limits HERA2022 HERA2023 HERA2026 \
--z-range 7 11 \
--bold-limits HERA2023 \
--shade-limits \
--base-limit-style '{"shade_alpha": 0.05}' \
--limit-styles '{"HERA2023": {"shade_alpha": 0.5}}' \
--theories Mesinger2016Faint Mesinger2016Bright \
--shade-theories \
--base-theory-style '{"color": "black"}' \
--theory-styles '{"Mesinger2016Faint": {"linestyle": "--"}, "Mesinger2016Bright": {"linestyle": ":"}}' \
--sensitivities '{"SKA-AA4": "Breitman2026_AA4_deep1080h"}' \
--sensitivity-style '{"SKA-AA4": {"color": "red"}}' \
--publication \
--out MyPlot.pdfWe welcome contributions to this repository from the community. If you would like to contribute, please follow these guidelines:
-
If you would like to add new observational limits, theory models or sensitivities, ensure that they come from peer-reviewed published papers and make a pull request to add them to the repository (see Developer installation for information on how to set up your environment). The data should be added in the form of a YAML file in the data folder (for observational limits), the theory folder (for theory models), or the sensitivities folder (for sensitivity estimates) following the format of the existing files.
telescope: GMRT author: Paciga year: 2013 doi: 10.1093/mnras/stt753 data: delta_squared: [[6.15e4]] k: [[0.5]] z: [8.6]
-
If you would like to plot or compare unpublished data, you can create a local YAML file in the same format and pass its path wherever a dataset name is accepted, e.g.
plot_vs_k(limits=["HERA2026", "/path/to/my_data.yaml"])orload_limit_data("/path/to/my_data.yaml"). The same works for theories (theories=andload_theory_model) and sensitivities (sensitivities=andload_sensitivity_data). -
If you would like to report a bug or request a feature, please file an issue on the GitHub repository.
This code is fully open-source, available under BSD 2-Clause License. See the LICENSE file for more details. Please feel free to use and modify the code as needed.
