forked from joezuntz/cosmosis-standard-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'joezuntz:main' into main
- Loading branch information
Showing
47 changed files
with
2,034 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# This reproduces the chains that make up figure 2 of the DESI paper | ||
# 2404.03002 | ||
|
||
output_dir: "./output/desi-campaign" | ||
|
||
runs: | ||
- name: base | ||
base: examples/desi.ini | ||
params: | ||
- sampler = metropolis | ||
- metropolis.samples = 20000 | ||
- metropolis.use_cobaya = T | ||
- metropolis.tuning_frequency = 100 | ||
- metropolis.tuning_grace = 500 | ||
- metropolis.tuning_end = 2000 | ||
- emcee.walkers = 32 | ||
- emcee.samples = 1000 | ||
- emcee.nsteps = 20 | ||
|
||
- name: BGS | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = BGS | ||
- metropolis.samples = 30000 | ||
|
||
- name: LRG1 | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = LRG1 | ||
|
||
- name: LRG2 | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = LRG2 | ||
|
||
- name: LRG3+ELG1 | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = LRG3+ELG1 | ||
|
||
- name: ELG2 | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = ELG2 | ||
|
||
- name: QSO | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = QSO | ||
|
||
- name: Lya QSO | ||
parent: base | ||
params: | ||
- desi.desi_data_sets = Lya QSO | ||
|
||
- name: All | ||
parent: base | ||
params: | ||
# - pipeline.timing=T | ||
- desi.desi_data_sets = BGS,LRG1,LRG2,LRG3+ELG1,ELG2,QSO,Lya QSO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import cosmosis.campaign | ||
from cosmosis.postprocessing.v2 import Chain | ||
import getdist.plots | ||
import matplotlib.pyplot as plt | ||
plt.rcParams['text.usetex'] = True | ||
|
||
# The campaign file defines all the chains that we want to generate | ||
campaign, _ = cosmosis.campaign.parse_yaml_run_file("./examples/desi-figure-2-campaign.yaml") | ||
|
||
|
||
# First make all the chains, by looping through the campaign. | ||
# The next major version of CosmoSIS will do this for you more easily. | ||
for name, run in campaign.items(): | ||
if name != "base": | ||
cosmosis.campaign.launch_run(run) | ||
|
||
# These colors match those used in the DESI paper as | ||
# best I could | ||
colors = { | ||
'All': [(0.0, 0.0, 0.0), (0.0, 0.0, 0.0)], | ||
'BGS': [(0.729, 0.811, 0.552), (0.517, 0.745, 0.012)], | ||
'ELG2': [(0.584, 0.725, 0.772), (0.219, 0.447, 0.6)], | ||
'LRG1': [(0.996, 0.854, 0.596), (0.956, 0.627, 0.086)], | ||
'LRG2': [(0.960, 0.678, 0.580), (0.929, 0.262, 0.094)], | ||
'LRG3+ELG1': [(0.733, 0.603, 0.741), (0.341, 0.211, 0.701)], | ||
'Lya QSO': [(0.733, 0.556, 0.749), (0.439, 0.0, 0.474)], | ||
'QSO': [(0.662, 0.815, 0.725), (0.247, 0.552, 0.360)] | ||
} | ||
|
||
|
||
# This is the order we want the contours to be plotted in. It's not the same | ||
# as the legend order. This is because we don't want the big contours to | ||
# cover up the small ones | ||
order = ["BGS", "LRG1", "QSO", "ELG2", "Lya QSO", "LRG3+ELG1", "LRG2", "All"] | ||
|
||
|
||
# The chains are complete now so load them all in | ||
chain_data = {} | ||
for i, (name, run) in enumerate(campaign.items()): | ||
# The base parent run it not used, it's just a template. | ||
# We will soon be able to specify this in the yaml file | ||
if name == "base" : | ||
continue | ||
|
||
# Load the chain using a chain object. This is in the upcoming | ||
# v2 api for cosmosis postprocessing, which will soon replace the | ||
# main version. It uses GetDist to do everything. | ||
chain_file = campaign[name]['params']['output', 'filename'] | ||
chain = Chain.load(chain_file, name=name, burn=0.2) | ||
|
||
# Store the GetDist MCSamples object in a dictionary | ||
chain_data[name] = chain.mcsamples | ||
|
||
|
||
# split the chains into two groups, the single-data set chains | ||
# and the combined one. This is because the contours are all filled | ||
# for the single data sets, but not for the combined one. | ||
combined_sample = chain_data["All"] | ||
single_data_samples = {name: chain_data[name] for name in order if name != "All"} | ||
|
||
# This is the order we want the labels to appear in. | ||
new_order = [order.index(name) for name in colors.keys()] | ||
|
||
# The rest of this is standard GetDist calls. | ||
plotter = getdist.plots.get_single_plotter() | ||
|
||
|
||
plotter.plot_2d(list(single_data_samples.values()), | ||
"DISTANCES--H0RD", | ||
"cosmological_parameters--omega_m", | ||
filled=True, | ||
colors=[colors[name] for name in single_data_samples.keys()], | ||
add_legend_proxy=True, | ||
lims=[70, 130, 0.1, 0.7],) | ||
|
||
plotter.plot_2d(combined_sample, | ||
"DISTANCES--H0RD", | ||
"cosmological_parameters--omega_m", | ||
filled=False, | ||
colors=["k", "k"], | ||
lims=[70, 130, 0.1, 0.7], | ||
add_legend_proxy=True) | ||
|
||
|
||
ax=plotter.get_axes() | ||
plotter.add_legend(list(single_data_samples.keys()) + ["All"], label_order=new_order, legend_loc="upper right") | ||
ax.set_xlabel(r"$\mathrm{H}_0 r_d \, [100 \mathrm{km}\, \mathrm{s}^{-1}]$") | ||
ax.set_ylabel(r"$\Omega_m$") | ||
plotter.export("output/desi.pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[cosmological_parameters] | ||
; Fix these to fiducial values | ||
h0 = 0.7 | ||
ombh2 = 0.02236 | ||
omega_m = 0.01 0.3 0.99 | ||
rdh = 10.0 100.0 1000.0 | ||
|
||
|
||
; hubble = 20. 70. 120. | ||
; ombh2 = 0.005 0.02 0.1 | ||
|
||
; These are needed to run camb but will have no | ||
; effect on the observables or likelihood | ||
n_s = 0.97 | ||
A_s = 2.19e-9 | ||
w = -1.0 | ||
wa = 0.0 | ||
|
||
; New parametrization and names: | ||
mnu = 0.0 | ||
num_massive_neutrinos = 0 | ||
nnu = 3.046 | ||
|
||
omega_k = 0.0 | ||
tau = 0.0697186 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[runtime] | ||
sampler = test | ||
verbosity = quiet | ||
resume = T | ||
|
||
[pipeline] | ||
modules = consistency camb sample_rdh desi | ||
timing=F | ||
extra_output = distances/rs_zdrag distances/h0rd | ||
values = examples/desi-values.ini | ||
|
||
[maxlike] | ||
max_posterior = T | ||
|
||
[test] | ||
save_dir=output/desi | ||
fatal_errors=T | ||
|
||
[output] | ||
filename = output/desi.txt | ||
|
||
[sample_rdh] | ||
file = utility/rescale_distances_rdh/rescale_distances_rdh.py | ||
|
||
[consistency] | ||
file = utility/consistency/consistency_interface.py | ||
|
||
[camb] | ||
file = boltzmann/camb/camb_interface.py | ||
mode = background | ||
feedback = 0 | ||
AccuracyBoost = 1.0 | ||
zmin_background = 0. | ||
zmax_background = 3. | ||
nz_background = 201 | ||
use_ppf_w = T | ||
want_chistar = F | ||
|
||
|
||
[desi] | ||
file = likelihood/bao/desi1-dr1-arxiv/desi1_dr1_arxiv.py | ||
desi_data_sets = BGS,LRG1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[wl_photoz_errors] | ||
bias_1 = gaussian 0. 0.024 | ||
bias_2 = gaussian 0. 0.022 | ||
|
||
[shear_calibration_parameters] | ||
m1 = gaussian 0. 0.01 | ||
m2 = gaussian 0. 0.01 | ||
m3 = gaussian 0. 0.01 | ||
m4 = gaussian 0. 0.01 | ||
|
||
[psf_parameters] | ||
psf_alpha2 = gaussian 0.0 1.0 | ||
psf_beta2 = gaussian 0.0 1.0 | ||
psf_alpha4 = gaussian 0.0 1.0 | ||
psf_beta4 = gaussian 0.0 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[nz_sample_errors] | ||
bias_1 = gaussian 0. 0.024 | ||
bias_2 = gaussian 0. 0.022 | ||
|
||
[shear_calibration_parameters] | ||
m1 = gaussian 0. 0.01 | ||
m2 = gaussian 0. 0.01 | ||
m3 = gaussian 0. 0.01 | ||
m4 = gaussian 0. 0.01 | ||
|
||
[psf_systematics_parameters] | ||
psf_cor1_z1 = gaussian 0. 1. | ||
psf_cor2_z1 = gaussian 0. 1. | ||
psf_cor3_z1 = gaussian 0. 1. | ||
psf_cor4_z1 = gaussian 0. 1. |
Oops, something went wrong.