LSSTDESC / firecrown

DESC Cosmology Likelihood Framework
BSD 3-Clause "New" or "Revised" License
29 stars 7 forks source link

Add support for non-linear models #198

Closed tilmantroester closed 1 year ago

tilmantroester commented 1 year ago

This is a draft implementation to address #174 based on discussions with @jablazek, @paulrogozenski, @chrgeorgiou. It currently supports perturbative IA and galaxy bias models but it should be extendable to halo-model-based models. An example (examples/des_y1_3x2pt/des_y1_3x2pt_PT.py) showcases this functionality and compares the results to a direct CCL calculation of the same quantities. They seem to match well!

Allowing support for non-linear quantities requires extensive changes to how firecrown handles two-point statistics and passes around cosmology objects. The main changes are

A plot showing the agreement with CCL: pt_cls This PR currently uses the pt_enh branch of CCL, since it required some extra functionality there.

tilmantroester commented 1 year ago

@marcpaterno, @vitenti Do you have comments or suggestions on the overall structure of the implementation? There's still quite some clean-up to do but I want to make sure you're on board with the design before investing more time in writing and changing the code.

vitenti commented 1 year ago

@tilmantroester We are still reviewing the code structure and figuring out how to better integrate with design we were developing for the toolset.

marcpaterno commented 1 year ago

@tilmantroester We have just cut firecrown release v1.3.0, containing (among other things) the new version of the likelihood "factory script".

Would you like this code to make it into a v1.4.0, which we could cut in the next week or two? As of our last meeting, our plan was to release this code to be used in the forecasting project (DESC project 291) and to make the generalization/refactoring we discussed as a task to be done after that release.

tilmantroester commented 1 year ago

I'm busy until next week but after that I'll try to get this ready to be reviewed. I'm hoping to get this done before the holidays, so that we have the models ready for the forecasting project.

tilmantroester commented 1 year ago

This should now be ready to be looked at again. I've added a unit test which automatises the example scripts. This should now also handle combinations of PT and non-PT tracers, following a similar approach to @paulrogozenski.

One thing to discuss is whether to use the firecrown.likelihood.Cosmology everywhere. Right now the methods of Likelihood still take pyccl.Cosmology arguments, and only for certain downstream cases Statistic.compute, the firecrown Cosmology class is used.

tilmantroester commented 1 year ago

This is now finally passing all tests.