LSSTDESC / augur

DESC forecasting and inference validation tool
MIT License
3 stars 2 forks source link

Implement an easier way to parse a custom firecrown likelihood #60

Open arthurmloureiro opened 4 days ago

arthurmloureiro commented 4 days ago

Based on what we've done to Blinding, we can easily modify augur to take a path to a likelihood in the input yaml configuration instead of building it from scratch.

In theory, that would allow us to add new probes with minimal effort.

We would need to discuss/think of how to deal with:

*(these are already implemented in the 3x2pt firecrown generation in generate.pybut it would need to be implemented in a probe agnostic way in this case)

arthurmloureiro commented 4 days ago

Here's a way we can run a supernova forecast using an external firecrown likelihood:

import sys
sys.path.append("..//Blinding/examples/cosmic_shear/")
import cosmicshear_likelihood
from firecrown.likelihood.likelihood import load_likelihood_from_module_type
from firecrown.likelihood.likelihood import NamedParameters
from firecrown.parameters import ParamsMap
import pyccl as ccl

sacc_data = "sn_datavector.sacc"
build_parameters = NamedParameters({'sacc_data': sacc_data})
md_tools.update({})
md_tools.prepare(cosmo)

cosmo = ccl.CosmologyVanillaLCDM(matter_power_spectrum="camb",
                                 extra_parameters={"camb": {"dark_energy_model": 'ppf'}})

ao = Analyze(f'./DESC_Forecasting/test_augur_custom_likelihood_sne.yaml', 
             likelihood=sne_like, tools=md_tools, 
             req_params={'sn_ddf_sample_M': -19.3} )
ao.get_fisher_matrix()

Here's a plot using this method for a WL and a SNe test

Screenshot 2024-07-05 at 16 56 38