Skip to content

Commit

Permalink
update readme (#103)
Browse files Browse the repository at this point in the history
* update readme

* update notebook
  • Loading branch information
jchavesmontero authored Aug 27, 2024
1 parent 8a55558 commit 445e05d
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
notebooks/.ipynb_checkpoints/
notebooks/*.ipynb
.ipynb_checkpoints
*.ipynb
*.png
lace.egg-info/
*/__pycache__/
*/*/__pycache__/
__pycache__
.github/workflows/.python-tests.yml.swn
.github/workflows/.python-tests.yml.swo
.github/workflows/.python-tests.yml.swp
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ pip install -e .
but there may be some issues.


#### Notebooks:

- All notebooks in the repository are in .py format. To generate the .ipynb version, run:

```
jupytext --to ipynb notebooks/*.py
```

- If you want to use notebooks via JupyterHub, you'll also need to download `ipykernel`:

```
Expand Down Expand Up @@ -104,7 +112,7 @@ The current version of the emulator, relased in this repo, does not emulate `alp

In the `Notebooks` folder, there are several tutorials one can run to learn how to use the archives and emulators.

- Archive tutorial: notebooks/Tutorial_bookkeeping.ipynb
- Emulator tutorial: notebooks/Tutorial_emulator.ipynb
- Archive tutorial: notebooks/Tutorial_bookkeeping.py
- Emulator tutorial: notebooks/Tutorial_emulator.py

In the `tests` folder, there are four scripts that you can run to open a Gadget or Nyx archive and run the G^and NN emulators.
In the `tests` folder, there is a script that you can run to check that the package is working properly.
45 changes: 44 additions & 1 deletion notebooks/Tutorial_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,49 @@
plt.ylabel(r'$\pi^{-1} \, k_\parallel \, P_\mathrm{1D}$')
plt.xscale('log')

# %% [markdown]
# To get the amplitude and slope of the linear power spectrum from a target cosmology (input of emulator)

# %%
from lace.cosmo.camb_cosmo import get_cosmology
from lace.cosmo.fit_linP import get_linP_Mpc_zs

# %%
h = 0.6778216034931903
H0 = 100 * h
omch2 = 0.11762521740991255
ombh2 = 0.022239961079792658
ns = 0.9628958142411611
As = np.exp(3.0151299559643365)*1e-10

cosmo = get_cosmology(H0=H0, omch2=omch2, ombh2=ombh2, ns=ns, As=As)

zs = [3]
kp_Mpc = 0.7
get_linP_Mpc_zs(cosmo, zs, kp_Mpc)

# %% [markdown]
# To get the amplitude and slope of the linear power spectrum on kms units at z=3 for a target cosmology (output of cup1d)

# %%
from lace.cosmo.fit_linP import parameterize_cosmology_kms

# %%
h = 0.6778216034931903
H0 = 100 * h
omch2 = 0.11762521740991255
ombh2 = 0.022239961079792658
ns = 0.9628958142411611
As = np.exp(3.0151299559643365)*1e-10

cosmo = get_cosmology(H0=H0, omch2=omch2, ombh2=ombh2, ns=ns, As=As)

zstar = 3
kp_kms = 0.009
camb_results = None
parameterize_cosmology_kms(cosmo, camb_results, zstar, kp_kms)


# %% [markdown]
# #### nyx simulations

Expand Down Expand Up @@ -87,7 +130,7 @@
plt.xscale('log')

# %% [markdown]
# ## For developers
# ## A general user should stop here. For developers below

# %%
import os, sys
Expand Down

0 comments on commit 445e05d

Please sign in to comment.