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

Add support for non-linear models #198

Merged
merged 47 commits into from
Jan 23, 2023
Merged

Add support for non-linear models #198

merged 47 commits into from
Jan 23, 2023

Conversation

tilmantroester
Copy link
Contributor

@tilmantroester tilmantroester commented Oct 21, 2022

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

  • Add a CosmologyBundle class that bundles the ccl.Cosmology object with associated data, such as PT calculators. This class gets passed around as cosmo instead of the ccl.Cosmology object downstream of the top-level Likelihood call.
  • Add a TracerBundle class that bundles a ccl.Tracer object with information about the associated 3D field and ccl.nl_pt.PTTracers, where relevant.
  • Add a CosmoSystematicsLikelihood likelihood class that can account for cosmology-level systematics. The concrete example here is the new class PTSystematic, which populates the PT workspaces and computes the basic perturbative quantities that are later used in TwoPoint.compute
  • Changed how Source.create_tracer and TwoPoint.compute work to deal with the multiple tracers that are now required per Source
  • Add a TattAlignmentSystematic and PTNonLinearBiasSystematic systematic that make use of all this new functionality
  • Some refactoring in number_counts.py to more generally deal with magnification bias

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
Copy link
Contributor Author

@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
Copy link
Collaborator

vitenti commented Nov 7, 2022

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

@marcpaterno
Copy link
Collaborator

@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
Copy link
Contributor Author

tilmantroester commented Dec 6, 2022

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 tilmantroester marked this pull request as ready for review December 19, 2022 05:17
@tilmantroester
Copy link
Contributor Author

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
Copy link
Contributor Author

This is now finally passing all tests.

@vitenti vitenti self-requested a review January 20, 2023 17:34
@vitenti vitenti merged commit 3248a17 into master Jan 23, 2023
@vitenti vitenti deleted the 174_systematics branch January 23, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Treatment of Systematics Effects in 3x2 point statistics
4 participants