Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCL modes #465

Merged
merged 25 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
934a6e1
Turning tests into a package to allow importing.
vitenti Oct 28, 2024
f51762b
Introducing CCL creation modes.
vitenti Oct 28, 2024
7812922
Reorganized cobaya example in subdiretorie.
vitenti Oct 28, 2024
cfe4eeb
Handling experiment loading directories.
vitenti Oct 28, 2024
8a38848
Reorganized cosmosis example subdir.
vitenti Oct 28, 2024
c1a9f90
Renaming example files.
vitenti Oct 28, 2024
7f81807
Better path specification for cobaya.
vitenti Oct 28, 2024
90a2a43
Adding support for pure_ccl in numcosmo connector.
vitenti Oct 28, 2024
f2cc227
Updated tests.
vitenti Oct 28, 2024
fba1ef7
Updated file names.
vitenti Oct 28, 2024
181e207
Adding support for mu_sigma experiments.
vitenti Oct 28, 2024
1ba6fea
Updated README.md
vitenti Oct 28, 2024
1c0b139
Updated README.md
vitenti Oct 28, 2024
65b53c9
Improving integration tests.
vitenti Oct 29, 2024
6adedff
Removing mu_sigma test from NumCosmo list.
vitenti Oct 29, 2024
659360b
Testing new camb_extra_parameters.
vitenti Oct 29, 2024
51b1bf2
Testing Cobaya connector with ccl_pure mode.
vitenti Oct 29, 2024
d02513e
Fixed long lines.
vitenti Oct 29, 2024
a44a6a0
More testing for CCLFactory.
vitenti Oct 29, 2024
304199e
Testing NumCosmo connector.
vitenti Oct 29, 2024
2399c58
Removing the conditional testing.
vitenti Oct 29, 2024
ce94a1b
Testing absolute path in DataSource.
vitenti Oct 29, 2024
72002e6
Testing cosmosis connector with pure ccl.
vitenti Oct 29, 2024
ae8e911
Adding missing mass_split test check.
vitenti Oct 29, 2024
33213a4
Removing unnecessary pip install of isitgr.
vitenti Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies:
- pip:
- autoclasstoc
- cobaya
- isitgr
- pygobject-stubs
- portalocker
- pybobyqa
Expand Down
78 changes: 58 additions & 20 deletions examples/des_y1_3x2pt/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,76 @@
# DES Y1 3x2pt Analysis

The code here will run a test sample for a Flat LCDM cosmology using either Cobaya or CosmoSIS.
The DES Y1 3x2pt analysis of the Dark Energy Survey (DES) Year 1 (Y1) data, focusing on
**cosmic shear**, **galaxy-galaxy lensing**, and **galaxy clustering**. This repository
demonstrates how to use the DES Y1 3x2pt data products to compute the likelihood with
the following tools:

## Running Cobaya
- **Cobaya**
- **CosmoSIS**
- **NumCosmo**

## Likelihood Factories

The **Firecrown** likelihoods can be customized through user-defined factories. In this
example, the following factory files are provided:

The Cobaya file `cobaya_evaluate.yaml` configures Cobaya to use the `des_y1_3x2pt.py` likelihood.
Run it using:
- `factory.py`: Factory for the DES Y1 3x2pt analysis.
- `factory_PT.py`: Factory for the DES Y1 3x2pt analysis using perturbation theory.

cobaya-run cobaya_evaluate.yaml
Alternatively, Firecrown’s **default factories** can be configured using experiment
configuration files:

This will produce the output files:
- `experiment.yaml`: Standard configuration for the DES Y1 3x2pt analysis.
- `pure_ccl_experiment.yaml`: Configuration for the DES Y1 3x2pt analysis in
**pure_ccl** mode.
- `mu_sigma_experiment.yaml`: Configuration for **mu_sigma_isitgr** mode.

cobaya_evaluate_output.input.yaml
cobaya_evaluate_output.updated.yaml
cobaya_evaluate_output.updated.dill_pickle
cobaya_evaluate_output.1.txt
Note that `mu_sigma_experiment.yaml` requires the
[`isitgr`](https://github.com/mishakb/ISiTGR) package to be installed. This package is
not installed by default in the Firecrown environment.

## Running CosmoSIS

The pipeline configuration file `des_y1_3x2pt.ini` and the related `des_y1_3x2pt_values.ini` configure CosmoSIS to use the `des_y1_3x2pt.py` likelihood.
Run this using:
For each likelihood factory, a corresponding **CosmoSIS** pipeline configuration file is
provided:

cosmosis des_y1_3x2pt.ini
- `cosmosis/factory.ini`: Pipeline for the standard DES Y1 3x2pt analysis.
- `cosmosis/factory_PT.ini`: Pipeline for the analysis with perturbation theory.
- `cosmosis/pure_ccl.ini`: Pipeline for the analysis in **pure CCL** mode.
- `cosmosis/mu_sigma.ini`: Pipeline for the analysis in **mu_sigma_isitgr** mode.

This will produce the output to the screen, showing the calculated likelihood.
It also creates the directory `des_y1_3x2pt_output` which is populated with the CosmoSIS datablock contents for the generated sample.
### Example Command

## Generating the `firecrown` Inputs
To run the CosmoSIS pipeline, use the following command:

```bash
cosmosis cosmosis/factory.ini
```

## Running Cobaya

Note, this code below only has to be run if you want to generate the firecrown input from the DES Y1 3x2pt data products.
This file is stored at `examples/des_y1_3x2pt/des_y1_3x2pt_sacc_data.fits`.
You do not have to make it yourself.
For Cobaya, the pipeline configuration files are:

- `cobaya/evaluate.yaml`: Pipeline for the standard DES Y1 3x2pt analysis.
- `cobaya/evaluate_PT.yaml`: Pipeline for the analysis with perturbation theory.
- `cobaya/evaluate_pure_ccl.yaml`: Pipeline for the analysis in **pure CCL** mode.
- `cobaya/evaluate_mu_sigma.yaml`: Pipeline for the analysis in **mu_sigma_isitgr** mode.

### Example Command

To run the Cobaya pipeline, use the following command:

```bash
cobaya-run cobaya/factory.yaml
```

## Generating the `firecrown` Inputs

To generate the `firecrown` inputs, first download the DES Y1 3x2pt data products [here](http://desdr-server.ncsa.illinois.edu/despublic/y1a1_files/chains/2pt_NG_mcal_1110.fits).
There is already a `sacc_data.fits` file in this directory that contains the DES Y1
3x2pt data products. If you want to regenerate the `firecrown` inputs, you can run
`generate_des_data.py`. To generate the `firecrown` inputs, first download the DES Y1
3x2pt data products
[here](http://desdr-server.ncsa.illinois.edu/despublic/y1a1_files/chains/2pt_NG_mcal_1110.fits).

Then run the script

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ theory:
likelihood:
des_y1_3x2pt:
external: !!python/name:firecrown.connector.cobaya.likelihood.LikelihoodConnector ''
firecrownIni: des_y1_3x2pt.py
firecrownIni: ${FIRECROWN_DIR}/examples/des_y1_3x2pt/factory.py
derived_parameters:
- TwoPoint__NumberCountsScale_lens0
- TwoPoint__NumberCountsScale_lens1
Expand Down Expand Up @@ -182,7 +182,7 @@ params:
sampler:
evaluate: null
stop_at_error: true
output: cobaya_evaluate_output
output: output
packages_path: null
test: false
debug: false
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ theory:
likelihood:
des_y1_3x2pt:
external: !!python/name:firecrown.connector.cobaya.likelihood.LikelihoodConnector ''
firecrownIni: des_y1_3x2pt_PT.py
firecrownIni: ${FIRECROWN_DIR}/examples/des_y1_3x2pt/factory_PT.py
params:
As:
prior:
Expand Down Expand Up @@ -96,7 +96,7 @@ params:
sampler:
evaluate: null
stop_at_error: true
output: cobaya_evaluate_output_PT
output: output_PT
packages_path: null
test: false
debug: false
176 changes: 176 additions & 0 deletions examples/des_y1_3x2pt/cobaya/evaluate_mu_sigma.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
likelihood:
des_y1_3x2pt:
external: !!python/name:firecrown.connector.cobaya.likelihood.LikelihoodConnector ''
firecrownIni: firecrown.likelihood.factories.build_two_point_likelihood
build_parameters:
likelihood_config: ${FIRECROWN_DIR}/examples/des_y1_3x2pt/mu_sigma_experiment.yaml
params:
sigma8:
prior:
min: 0.6
max: 1.0
ref: 0.8
proposal: 0.01
Omega_b: 0.05
Omega_c:
prior:
min: 0.05
max: 0.35
ref: 0.25
proposal: 0.01
Omega_k: 0.0
h: 0.682
Neff: 3.046
m_nu: 0.06
n_s: 0.971
w0: -1.0
wa: 0.0
T_CMB: 2.7255

# - MG Model
mg_musigma_mu:
ref: 1.0
prior:
min: 0.8
max: 1.2
mg_musigma_sigma:
ref: 1.0
prior:
min: 0.8
max: 1.2
mg_musigma_c1: 1.0
mg_musigma_c2: 1.0
mg_musigma_lambda0: 1.0
# Likelihood params
# - IA model
ia_bias:
ref: 0.5
prior:
min: -5.0
max: +5.0
alphaz:
ref: 0.0
prior:
min: -5.0
max: +5.0

# - these parameters are fixed
z_piv: 0.62

# - linear bias for lenses
lens0_bias:
ref: 1.4
prior:
min: 0.8
max: 3.0
lens1_bias:
ref: 1.6
prior:
min: 0.8
max: 3.0
lens2_bias:
ref: 1.6
prior:
min: 0.8
max: 3.0
lens3_bias:
ref: 1.9
prior:
min: 0.8
max: 3.0
lens4_bias:
ref: 2.0
prior:
min: 0.8
max: 3.0

# - photoz shifts for the lensing sources
src0_delta_z:
ref: -0.001
prior:
dist: norm
loc: -0.001
scale: 0.016
src1_delta_z:
ref: -0.019
prior:
dist: norm
loc: -0.019
scale: 0.013
src2_delta_z:
ref: +0.009
prior:
dist: norm
loc: 0.009
scale: 0.011
src3_delta_z:
ref: -0.018
prior:
dist: norm
loc: -0.018
scale: 0.022

# - photoz shifts for the lenses
lens0_delta_z:
ref: 0.001
prior:
dist: norm
loc: 0.001
scale: 0.008
lens1_delta_z:
ref: 0.002
prior:
dist: norm
loc: 0.002
scale: 0.007
lens2_delta_z:
ref: 0.001
prior:
dist: norm
loc: 0.001
scale: 0.007
lens3_delta_z:
ref: 0.003
prior:
dist: norm
loc: 0.003
scale: 0.01
lens4_delta_z:
ref: 0.0
prior:
dist: norm
loc: 0.0
scale: 0.01

# - shear errors
src0_mult_bias:
ref: 0.0
prior:
dist: norm
loc: 0.012
scale: 0.023
src1_mult_bias:
ref: 0.0
prior:
dist: norm
loc: 0.012
scale: 0.023
src2_mult_bias:
ref: 0.0
prior:
dist: norm
loc: 0.012
scale: 0.023
src3_mult_bias:
ref: 0.0
prior:
dist: norm
loc: 0.012
scale: 0.023
sampler:
evaluate: null
stop_at_error: true
output: output_mu_sigma
packages_path: null
test: false
debug: false
Loading
Loading