From 4091a0ec995c59382de4fce4e3fa588cb45b4de3 Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Mon, 10 Jun 2024 17:45:54 -0400 Subject: [PATCH 1/6] augur fixes --- README.md | 19 +++++++++++-------- augur/generate.py | 24 +++++++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) 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/generate.py b/augur/generate.py index cd95c4c..21c9f76 100644 --- a/augur/generate.py +++ b/augur/generate.py @@ -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 @@ -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 = [] @@ -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) From f35be118c2d6ab97017f056c3fac223e1ea0106f Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Mon, 10 Jun 2024 17:46:17 -0400 Subject: [PATCH 2/6] fixed environment requirements --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From bd0dcad50ce989e92eeb01e3c494dd5dd48bd6f6 Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Mon, 10 Jun 2024 17:56:54 -0400 Subject: [PATCH 3/6] fixed version of firecrown --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 7234ec0..9cbab15 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: forecasting channels: - conda-forge dependencies: - - firecrown>=1.7.4 + - firecrown>=1.8 - flake8 - healpy - jinja2 From 57520dc439a55aae27e0e4e34adf7fa504ad620a Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Mon, 10 Jun 2024 18:00:47 -0400 Subject: [PATCH 4/6] updated version number --- augur/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 953884cccb5175d2eab487b7af0afda046209d8c Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Tue, 11 Jun 2024 10:55:48 -0400 Subject: [PATCH 5/6] trying to fix backcompatibility --- augur/generate.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/augur/generate.py b/augur/generate.py index 21c9f76..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.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 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 From c74498ae0eb1aabad63e38011f088bfa53a983e6 Mon Sep 17 00:00:00 2001 From: Javier Sanchez Date: Tue, 11 Jun 2024 10:56:18 -0400 Subject: [PATCH 6/6] fixed environment for CI/CD --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 9cbab15..7234ec0 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: forecasting channels: - conda-forge dependencies: - - firecrown>=1.8 + - firecrown>=1.7.4 - flake8 - healpy - jinja2