Skip to content

Commit

Permalink
Merge branch 'JulianBMunoz:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yonboyage authored Nov 8, 2023
2 parents b84251e + 3943b90 commit 515f0e2
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Package using Conda

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda install pytest
pytest
31 changes: 31 additions & 0 deletions CITATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
If you find this code useful, please cite:

[An Effective Model for the Cosmic-Dawn 21-cm Signal](https://arxiv.org/abs/2302.08506).
Muñoz 2023

@article{Munoz:2023kkg,
author = "Mu\~noz, Julian B.",
title = "{An Effective Model for the Cosmic-Dawn 21-cm Signal}",
eprint = "2302.08506",
archivePrefix = "arXiv",
primaryClass = "astro-ph.CO",
doi = "10.1093/mnras/stad1512",
month = "2",
year = "2023"
}

If additionally you use the UVLF functionality consider citing:

[Breaking degeneracies in the first galaxies with clustering](https://arxiv.org/abs/2306.09403).
Muñoz, Mirocha, Furlanetto, and Sabti 2023


@article{Munoz:2023cup,
author = "Mu\~noz, Julian B. and Mirocha, Jordan and Furlanetto, Steven and Sabti, Nashwan",
title = "{Breaking degeneracies in the first galaxies with clustering}",
eprint = "2306.09403",
archivePrefix = "arXiv",
primaryClass = "astro-ph.CO",
month = "6",
year = "2023"
}
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<img src="docs/zeusLogo.png" width=20% height=20%>
</p>

# Zeus21: Lightning-fast simulations of 21-cm at cosmic dawn
# Zeus21: Lightning-fast simulations of cosmic dawn

Zeus21 encodes the effective model for the 21-cm power spectrum and global signal from [Muñoz 2023](https://arxiv.org/abs/2302.08506). The goal is to capture all the nonlocal and nonlinear physics of cosmic dawn in a light and fully Pythonic code. Zeus21 takes advantage of the approximate log-normality of the star-formation rate density (SFRD) during cosmic dawn to compute the 21-cm power spectrum analytically. It agrees with more expensive semi-numerical simulations to roughly 10% precision, but has comparably negligible computational cost (~ s) and memory requirements.
Zeus21 encodes the effective model for the 21-cm power spectrum, global signal from [Muñoz 2023a](https://arxiv.org/abs/2302.08506). The goal is to capture all the nonlocal and nonlinear physics of cosmic dawn in a light and fully Pythonic code. Zeus21 takes advantage of the approximate log-normality of the star-formation rate density (SFRD) during cosmic dawn to compute the 21-cm power spectrum analytically. It agrees with more expensive semi-numerical simulations to roughly 10% precision, but has comparably negligible computational cost (~ s) and memory requirements. Now Zeus21 can also predict galaxy UV luminosity functions (UVLFs) and their linear clustering (galaxy bias) at any z, see [Muñoz et al. 2023b](https://arxiv.org/abs/2306.09403) for the implementation and application to JWST.

Zeus21 (Zippy Early-Universe Solver for 21-cm) pairs well with data from [HERA](https://reionization.org/), but can be used for any 21-cm inference or prediction. Current capabilities include finding the 21-cm power spectrum (at a broad range of k and z), the global signal, IGM temperatures (Tk, Ts, Tcolor), neutral fraction xHI, Lyman-alpha fluxes, and the evolution of the SFRD; all across cosmic dawn z=5-35. Zeus21 can use three different astrophysical models, one of which emulates 21cmFAST, and can vary the cosmology through CLASS.
Zeus21 (Zippy Early-Universe Solver for 21-cm) pairs well with data from [HERA](https://reionization.org/), but can be used for any 21-cm inference or prediction. Current capabilities include finding the 21-cm power spectrum (at a broad range of k and z), the global signal, IGM temperatures (Tk, Ts, Tcolor), neutral fraction xHI, Lyman-alpha fluxes, and the evolution of the SFRD; all across cosmic dawn z=5-35. Zeus21 can use three different astrophysical models, one of which emulates 21cmFAST, and can vary the cosmology through CLASS.

If you want to get started I recommend checking the Jupyter tutorial in `docs/`. Full documentation in [ReadTheDocs](https://zeus21.readthedocs.io/en/latest/), more coming soon. Here is an example power spectrum (at k=0.3/Mpc) and global signal as a function of redshift, for two cases of X-ray luminosity. You can run it yourself with the tutorial included!

Expand Down Expand Up @@ -41,5 +41,11 @@ python setup.py install --user
## Citation

If you find this code useful please cite:

[An Effective Model for the Cosmic-Dawn 21-cm Signal](https://arxiv.org/abs/2302.08506)

and include a link to [this Github](https://github.com/JulianBMunoz/Zeus21).
If you use the UVLF module please consider citing:

[Breaking degeneracies in the first galaxies with clustering](https://arxiv.org/abs/2306.09403)

6 changes: 6 additions & 0 deletions zeus21/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,9 @@
#RSD related
MU_AVG = 0.6 #recovers (1+mu^2)^2 = 1.87, and very close for (1+mu^2) [for cross terms]
MU_LoS = 1.0 #only fully LoS modes


#UVLF related
_MAGMAX = 10 #max abs magnitude to avoid infs
FLAG_RENORMALIZE_LUV = False #whether to renormalize the lognormal LUV with sigmaUV to recover <LUV> or otherwise <MUV>. Recommend False.
NZ_TOINT = 3 #how many zs around <z> with z_rms we use to predict. Only in HMF since the rest do not vary much.
9 changes: 8 additions & 1 deletion zeus21/sfrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,13 @@ def Matom(z):
"Returns Matom as a function of z"
return 3.3e7 * pow((1.+z)/(21.),-3./2)

#fstar = Mstardot/Mhdot, parametrizes as you wish
def fstarofz(Astro_Parameters, Cosmo_Parameters, z, Mhlist):
epsstar_ofz = Astro_Parameters.epsstar * 10**(Astro_Parameters.dlog10epsstardz * (z-Astro_Parameters._zpivot) )
return 2.0 * Cosmo_Parameters.OmegaB/Cosmo_Parameters.OmegaM * epsstar_ofz\
/(pow(Mhlist/Astro_Parameters.Mc,- Astro_Parameters.alphastar) + pow(Mhlist/Astro_Parameters.Mc,- Astro_Parameters.betastar) )


#Only PopII for now (TODO, add PopIII)
def SFR(Astro_Parameters, Cosmo_Parameters, HMF_interpolator, z):
"SFR in Msun/yr at redshift z. Evaluated at the halo masses Mh [Msun] of the HMF_interpolator, given Astro_Parameters"
Expand All @@ -457,7 +464,7 @@ def SFR(Astro_Parameters, Cosmo_Parameters, HMF_interpolator, z):
fduty = np.heaviside(Mh - Astro_Parameters.Mturn_fixed, 0.5)

if(Astro_Parameters.astromodel == 0): #GALLUMI-like
fstarM = 2.0 * Cosmo_Parameters.OmegaB/Cosmo_Parameters.OmegaM * Astro_Parameters.epsstar/(pow(Mh/Astro_Parameters.Mc,- Astro_Parameters.alphastar) + pow(Mh/Astro_Parameters.Mc,- Astro_Parameters.betastar) )
fstarM = fstarofz(Astro_Parameters, Cosmo_Parameters, z, Mh)

if(Astro_Parameters.accretion_model == 0): #exponential accretion
dMhdz = Mh * constants.ALPHA_accretion_exponential
Expand Down

0 comments on commit 515f0e2

Please sign in to comment.