diff --git a/README.md b/README.md index 5b22c84..5a73085 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,6 @@ git clone git@github.com: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. @@ -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). @@ -142,4 +145,4 @@ cd examples cobaya-run cobaya_mcmc.yaml ``` -By default the outputs will be saved at `./examples/cobaya_evaluate_output`. \ No newline at end of file +By default the outputs will be saved at `./examples/cobaya_evaluate_output`. diff --git a/augur/_version.py b/augur/_version.py index 493f741..6a9beea 100644 --- a/augur/_version.py +++ b/augur/_version.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.4.0" diff --git a/augur/generate.py b/augur/generate.py index cd95c4c..5227565 100644 --- a/augur/generate.py +++ b/augur/generate.py @@ -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 @@ -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 = [] @@ -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) diff --git a/environment.yml b/environment.yml index f284945..7234ec0 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: forecasting channels: - conda-forge dependencies: - - firecrown>=1.7.1 + - firecrown>=1.7.4 - flake8 - healpy - jinja2