Skip to content

Commit

Permalink
augur fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Sanchez authored and Javier Sanchez committed Jun 10, 2024
1 parent b5f7874 commit 4091a0e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ git clone [email protected]:LSSTDESC/firecrown.git
cd firecrown
```

The current version of `augur` relies on firecrown v0.5 or lower so in the same directory you can do:

```
git checkout tags/v0.5
pip install . -e
```

Now run a `pytest` to see if things work.

Expand Down Expand Up @@ -100,11 +94,20 @@ The user can create configuration files to fit their specific purposes following

```
from augur.generate import generate
lk = generate('./examples/config_test.yml', return_all_outputs=False, force_read=False)
lk = generate('./examples/config_test.yml', return_all_outputs=False)
```

This likelihood object can then be used by `cosmosis`, `cobaya` or `NumCosmo`. For more details follow the examples in the [`firecrown`](https://github.com/LSSTDESC/firecrown) repository.

Additionally, we can compute the Fisher matrix and Fisher biases via numerical derivatives using the following commands:

```
from augur.analyze import Analyze
ao = Analyze('./examples/config_test.yml')
ao.get_fisher_bias() # This command computes the derivates+Fisher matrices+fisher bias
print(ao.Fij, ao.bi) # These are the values of the Fisher matrix, Fij, and Fisher biases bi
```

## Example run for SRD v1
We also include example configuration files for `cosmosis` and `cobaya` to reproduce the results from the [LSST DESC Science Requirements Document](https://arxiv.org/pdf/1809.01669.pdf).

Expand Down Expand Up @@ -142,4 +145,4 @@ cd examples
cobaya-run cobaya_mcmc.yaml
```

By default the outputs will be saved at `./examples/cobaya_evaluate_output`.
By default the outputs will be saved at `./examples/cobaya_evaluate_output`.
24 changes: 17 additions & 7 deletions augur/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from augur.tracers.two_point import ZDist, LensSRD2018, SourceSRD2018
from augur.utils.cov_utils import get_gaus_cov, get_SRD_cov, get_noise_power
from augur.utils.cov_utils import TJPCovGaus
import firecrown.likelihood.gauss_family.statistic.source.weak_lensing as wl
import firecrown.likelihood.gauss_family.statistic.source.number_counts as nc
from firecrown.likelihood.gauss_family.statistic.two_point import TwoPoint
from firecrown.likelihood.gauss_family.gaussian import ConstGaussian
import firecrown.likelihood.weak_lensing as wl
import firecrown.likelihood.number_counts as nc
from firecrown.likelihood.two_point import TwoPoint
from firecrown.likelihood.gaussian import ConstGaussian
from firecrown.modeling_tools import ModelingTools
from firecrown.parameters import ParamsMap
from augur.utils.config_io import parse_config
Expand Down Expand Up @@ -305,6 +305,14 @@ def generate(config, return_all_outputs=False, write_sacc=True):
tools.prepare(cosmo)
# Run the likelihood (to get the theory)
lk.compute_loglike(tools)
# Get all bandpower windows before erasing the placeholder sacc
win_dict = {}
for st in lk.statistics:
st = st.statistic
tr1 = st.source0.sacc_tracer
tr2 = st.source1.sacc_tracer
idx = S.indices(tracers=(tr1, tr2))
win_dict[(tr1, tr2)] = S.get_bandpower_windows(idx)
# Empty the placeholder Sacc's covariance and data vector so we can "overwrite"
S.covariance = None
S.data = []
Expand All @@ -313,10 +321,12 @@ def generate(config, return_all_outputs=False, write_sacc=True):
for st in lk.statistics:
# Hack to be able to reuse the statistics
st = st.statistic
tr1 = st.source0.sacc_tracer
tr2 = st.source1.sacc_tracer
st.ready = False
S.add_ell_cl(st.sacc_data_type, st.sacc_tracers[0], st.sacc_tracers[1],
st.ell_or_theta_, st.get_theory_vector(),
window=st.theory_window_function)
S.add_ell_cl(st.sacc_data_type, tr1, tr2,
st.ells, st.get_theory_vector(), # Only valid for harmonic space
window=win_dict[(tr1, tr2)])
if config['cov_options']['cov_type'] == 'gaus_internal':
fsky = config['cov_options']['fsky']
cov = get_gaus_cov(S, lk, cosmo, fsky, config)
Expand Down

0 comments on commit 4091a0e

Please sign in to comment.