-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporating CMB Lensing Sources and Statistics into Firecrown for 5…
…x2pt (#123) * read CMBK * adding and testing CCL NK and GK * adding NK & GK * Update sources.py * add documentation * fix lint errors * few fixes * Update sources.py * Update sources.py * Update sources.py * Update sources.py * Add CMBL test * Update test_cmbl_source.py * Update test_cmbl_source.py
- Loading branch information
1 parent
cb3e92c
commit 646c158
Showing
10 changed files
with
7,555 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,98 @@ | ||
parameters: | ||
Omega_k: 0.0 | ||
Omega_g: 0.0 | ||
w0: -1.0 | ||
wa: 0.0 | ||
T_CMB: 2.7 | ||
Neff: 0 | ||
m_nu: 0.0 | ||
transfer_function: 'bbks' | ||
mass_function: 'tinker' | ||
|
||
Omega_b: 0.045 | ||
Omega_c: 0.21 | ||
h: 0.71 | ||
sigma8: 0.80 | ||
n_s: 0.964 | ||
|
||
bias_lens: 1.0 | ||
|
||
|
||
cosmosis: | ||
sampler: emcee | ||
debug: False | ||
quiet: True | ||
mpi: True | ||
test: | ||
fatal_erros: True | ||
emcee: | ||
walkers: 32 | ||
samples: 20 | ||
parameters: | ||
Omega_c: [0.1, 0.21, 0.9] | ||
sigma8: [0.4, 0.8, 1.2] | ||
n_s: [0.87, 0.964, 1.07] | ||
h: [0.55, 0.71, 0.91] | ||
Omega_b: [0.03, 0.045, 0.07] | ||
|
||
|
||
priors: | ||
module: firecrown.priors | ||
|
||
Omega_c: | ||
kind: uniform | ||
loc: 0.1 | ||
scale: 0.8 | ||
|
||
n_s: | ||
kind: uniform | ||
loc: 0.87 | ||
scale: 0.2 | ||
|
||
sigma8: | ||
kind: uniform | ||
loc: 0.40 | ||
scale: 0.80 | ||
|
||
h: | ||
kind: uniform | ||
loc: 0.55 | ||
scale: 0.36 | ||
|
||
Omega_b: | ||
kind: uniform | ||
loc: 0.03 | ||
scale: 0.04 | ||
|
||
|
||
two_point: | ||
module: firecrown.ccl.two_point | ||
sacc_data: GK.sacc | ||
|
||
sources: | ||
{% for i in range(5) %} | ||
src{{i}}: | ||
kind: CMBLSource | ||
sacc_tracer: ck{{i}} | ||
{% endfor %} | ||
|
||
{% for i in range(5) %} | ||
lens{{i}}: | ||
kind: WLSource | ||
sacc_tracer: wl{{i}} | ||
{% endfor %} | ||
|
||
statistics: | ||
{% for i in range(5) %} | ||
GK{{i}}: | ||
sources: ['lens{{i}}','src{{i}}'] | ||
sacc_data_type: 'cmbGalaxy_convergenceShear_xi_t' | ||
{% endfor %} | ||
|
||
likelihood: | ||
kind: ConstGaussianLogLike | ||
data_vector: | ||
{% for i in range(5) %} | ||
- GK{{i}} | ||
{% endfor %} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,106 @@ | ||
parameters: | ||
Omega_k: 0.0 | ||
Omega_g: 0.0 | ||
w0: -1.0 | ||
wa: 0.0 | ||
T_CMB: 2.7 | ||
Neff: 0 | ||
m_nu: 0.0 | ||
transfer_function: 'bbks' | ||
mass_function: 'tinker' | ||
|
||
sigma8: 0.80 | ||
|
||
Omega_b: 0.045 | ||
h: 0.71 | ||
Omega_c: 0.21 | ||
n_s: 0.964 | ||
|
||
{% for i in range(5) %} | ||
bias_lens{{i}}: 1.0 | ||
{% endfor %} | ||
|
||
|
||
cosmosis: | ||
sampler: emcee | ||
debug: True | ||
quiet: False | ||
mpi: False | ||
test: | ||
fatal_erros: True | ||
emcee: | ||
walkers: 32 | ||
samples: 60 | ||
parameters: | ||
Omega_c: [0.1, 0.21, 0.9] | ||
n_s: [0.87, 0.964, 1.07] | ||
h: [0.55, 0.71, 0.91] | ||
Omega_b: [0.03, 0.045, 0.07] | ||
{% for i in range(5) %} | ||
bias_lens{{i}}: [0.2, 1.0, 4.0] | ||
{% endfor %} | ||
|
||
|
||
priors: | ||
module: firecrown.priors | ||
|
||
Omega_c: | ||
kind: uniform | ||
loc: 0.1 | ||
scale: 0.8 | ||
|
||
n_s: | ||
kind: uniform | ||
loc: 0.87 | ||
scale: 0.2 | ||
|
||
h: | ||
kind: uniform | ||
loc: 0.55 | ||
scale: 0.36 | ||
|
||
Omega_b: | ||
kind: uniform | ||
loc: 0.03 | ||
scale: 0.04 | ||
|
||
{% for i in range(5) %} | ||
bias_lens{{i}}: | ||
kind: uniform | ||
loc: 0.2 | ||
scale: 3.8 | ||
{% endfor %} | ||
|
||
|
||
two_point: | ||
module: firecrown.ccl.two_point | ||
sacc_data: NK.sacc | ||
|
||
sources: | ||
{% for i in range(5) %} | ||
src{{i}}: | ||
kind: CMBLSource | ||
sacc_tracer: ck{{i}} | ||
{% endfor %} | ||
|
||
{% for i in range(5) %} | ||
lens{{i}}: | ||
kind: NumberCountsSource | ||
sacc_tracer: gc{{i}} | ||
bias: bias_lens{{i}} | ||
{% endfor %} | ||
|
||
statistics: | ||
{% for i in range(5) %} | ||
NK{{i}}: | ||
sources: ['lens{{i}}','src{{i}}'] | ||
sacc_data_type: 'cmbGalaxy_convergenceDensity_xi' | ||
{% endfor %} | ||
|
||
likelihood: | ||
kind: ConstGaussianLogLike | ||
data_vector: | ||
{% for i in range(5) %} | ||
- NK{{i}} | ||
{% endfor %} | ||
|
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,17 @@ | ||
# NK and GK constraints | ||
|
||
This is part of 5x2pt analysis. `NK.yaml` constrains cosmology based on galaxy number count x CMB lensing correlation (data stored in `NK.sacc`). `GK.yanml` constrains cosmology based on galaxy weak lensing x CMB lensing correlation (data stored in `GK.sacc`). | ||
|
||
Both constraints use `emcee` as the sampler for MCMC chains. | ||
|
||
To run this example, type | ||
|
||
```bash | ||
$ firecrown run-cosmosis NK.yaml | ||
``` | ||
|
||
or for GK, type | ||
|
||
```bash | ||
$ firecrown run-cosmosis GK.yaml | ||
``` |
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,55 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
import sacc | ||
import pyccl as ccl | ||
|
||
from ..sources import CMBLSource | ||
|
||
|
||
@pytest.fixture | ||
def cmbl_data(): | ||
sacc_data = sacc.Sacc() | ||
|
||
params = dict( | ||
Omega_c=0.27, | ||
Omega_b=0.045, | ||
Omega_k=0.0, | ||
w0=-1.0, | ||
wa=0.0, | ||
sigma8=0.8, | ||
n_s=0.96, | ||
h=0.67) | ||
cosmo = ccl.Cosmology(**params) | ||
|
||
ell = np.arange(3000) | ||
|
||
sacc_data.add_tracer('Map', 'trc1', quantity='cmb_convergence', spin=0, | ||
ell=ell, beam=None) | ||
|
||
return { | ||
'cosmo': cosmo, | ||
'sacc_tracer': 'trc1', | ||
'sacc_data': sacc_data, | ||
'params': params, | ||
'systematics': [], | ||
'systematics_dict': {}, | ||
'scale_': 1.05} | ||
|
||
|
||
def test_cmbl_source_nosys(cmbl_data): | ||
src = CMBLSource( | ||
sacc_tracer=cmbl_data['sacc_tracer'], | ||
scale=0.5) | ||
src.read(cmbl_data['sacc_data']) | ||
|
||
src.render( | ||
cmbl_data['cosmo'], | ||
cmbl_data['params'], | ||
cmbl_data['systematics_dict']) | ||
|
||
assert np.allclose(src.scale, 0.5) | ||
assert np.allclose(src.scale_, 0.5) | ||
assert src.systematics == [] | ||
|
||
assert isinstance(src.tracer_, ccl.CMBLensingTracer) |
Oops, something went wrong.