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

Issues/43 #44

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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`.
2 changes: 1 addition & 1 deletion augur/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0"
__version__ = "0.4.0"
32 changes: 25 additions & 7 deletions augur/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@
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
from packaging.version import Version
import firecrown
if Version(firecrown.__version__) >= Version('1.8'):
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
elif Version(firecrown.__version__) >= Version('1.7.4'):
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
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 +313,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 +329,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
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: forecasting
channels:
- conda-forge
dependencies:
- firecrown>=1.7.1
- firecrown>=1.7.4
- flake8
- healpy
- jinja2
Expand Down
Loading