-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into two-point-one-point
- Loading branch information
Showing
32 changed files
with
1,295 additions
and
29 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
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,64 @@ | ||
[runtime] | ||
sampler = test | ||
root = ${PWD} | ||
resume = T | ||
verbosity = noisy | ||
|
||
[test] | ||
save_dir = output/spt3g_2018_lensing | ||
fatal_errors = T | ||
|
||
[nautilus] | ||
n_live = 1500 | ||
verbose = T | ||
|
||
[emcee] | ||
walkers = 64 | ||
samples = 1000 | ||
nsteps = 5 | ||
|
||
|
||
[pipeline] | ||
; these names refer to sections later in the file: | ||
modules = consistency camb spt3g_2018_lensing | ||
values = examples/candl_test_values.ini | ||
priors = examples/candl_test_priors.ini | ||
debug = F | ||
timing = F | ||
extra_output = cosmological_parameters/sigma_8 cosmological_parameters/omega_m | ||
|
||
[spt3g_2018_lensing] | ||
file = ./likelihood/candl/candl_cosmosis_interface.py ; Location of interface code - change depending on the location of your .ini file | ||
data_set = 'candl.data.SPT3G_2018_Lens' ; Data set or path to .yaml file | ||
variant = 'use_CMB' ; Select a variant of the data set if pointing to an index file | ||
lensing = T ; Switch on for lensing likelihoods | ||
feedback = T ; Switch on to request feedback from candl initialisation | ||
data_selection = "..." ; Select a subset of the data set | ||
clear_1d_internal_priors = F ; Switch off to use candl internal 1d priors | ||
clear_nd_internal_priors = F ; Switch on to ignore candl internal higher dimensional priors. Careful: higher-dimensional priors are not implemented in CosmoSIS itself. | ||
force_ignore_transformations = '' ; Backdoor if you want to ignore certain transformations in the data model. | ||
|
||
[output] | ||
filename = output/spt3g-18-lens.txt | ||
|
||
; The consistency module translates between our chosen parameterization | ||
; and any other that modules in the pipeline may want (e.g. camb) | ||
[consistency] | ||
file = ./utility/consistency/consistency_interface.py | ||
cosmomc_theta = T | ||
|
||
[camb] | ||
file = boltzmann/camb/camb_interface.py | ||
feedback = 0 ; verbosity of output | ||
mode = cmb ; mode to run camb. For CMB lensing only, cmb is sufficient | ||
lmax = 4000 ; max ell to use for cmb calculation | ||
lens_margin = 1250 ; Lmax | ||
AccuracyBoost = 1.0 ; CAMB accuracy boost parameter | ||
lSampleBoost = 1.0 ; CAMB lsample boost parameter | ||
lAccuracyBoost = 1.0 ; CAMB lAccuracy boost parameter | ||
lens_potential_accuracy = 4 ; CAMB lens_potential accuracy paramater | ||
do_tensors = T ;include tensor modes | ||
do_lensing = T ;lensing is required w/ Planck data | ||
NonLinear = lens ; Non-linear calculation | ||
theta_H0_range = "20 100" ; Set bounds in H0 | ||
halofit_version = takahashi ; Halofit version |
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,3 @@ | ||
[cosmological_parameters] | ||
ombh2 = normal 0.02233 0.00036 | ||
n_s = normal 0.96 0.02 |
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,16 @@ | ||
|
||
[cosmological_parameters] | ||
omch2 = 0.08 0.12 0.16 | ||
ombh2 = 0.01 0.02233 0.03 | ||
log1e10As = 2.9 3.0448 3.2 | ||
n_s = 0.86 0.96 1.06 | ||
cosmomc_theta = 0.9 1.04 1.20 | ||
omega_k = 0.0 | ||
mnu = 0.06 | ||
nnu = 3.046 | ||
yhe = 0.245341 | ||
tau = 0.0543 | ||
num_massive_neutrinos = 3 | ||
|
||
[nuisance_parameters] | ||
A_fg = 0.0 1.0 2.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,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") |
Oops, something went wrong.