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

Container for MG params #1119

Merged
merged 10 commits into from
Aug 2, 2023
Merged

Container for MG params #1119

merged 10 commits into from
Aug 2, 2023

Conversation

tilmantroester
Copy link
Contributor

@tilmantroester tilmantroester commented Jul 28, 2023

This PR introduces a ModifiedGravity interface to the Cosmology class which encapsulates MG parametrisations (just mu-Sigma for now). Under the hood (i.e. C-layer) nothing has changed.
The motivation is to reduce clutter in the Cosmology interface and allow different MG parametrisations in the future without breaking the API.

Instead of

cosmo = ccl.Cosmology(
    Omega_c=0.25,
    Omega_b=0.05,
    h=0.7,
    A_s=2.1e-9,
    n_s=0.96,
    mu_0=0.1, sigma_0=0.2,
)

the new API is now

from pyccl.modified_gravity import MuSigmaMG
cosmo = ccl.Cosmology(
    Omega_c=0.25,
    Omega_b=0.05,
    h=0.7,
    A_s=2.1e-9,
    n_s=0.96,
    mg_parametrisation=MuSigmaMG(mu_0=0.1, sigma_0=0.2),
)

This doesn't use CCLNamedClass at the moment due to a conflict with dataclass (see #1118).

@coveralls
Copy link

coveralls commented Jul 28, 2023

Pull Request Test Coverage Report for Build 5743350713

  • 37 of 37 (100.0%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 97.448%

Files with Coverage Reduction New Missed Lines %
pyccl/cosmology.py 1 99.26%
Totals Coverage Status
Change from base Build 5694401474: 0.01%
Covered Lines: 5805
Relevant Lines: 5957

💛 - Coveralls

@damonge
Copy link
Collaborator

damonge commented Aug 1, 2023

@tilmantroester , I'm not sure it's worth trying to make this a CCLNamedClass. This is more appropriate for things like halo model ingredients, baryonic effects, or emulators, where there are a gazillion parametrisations and you want to sift through them quickly.

@tilmantroester
Copy link
Contributor Author

Fair enough. Changing this wouldn't affect the API so this could be made a CCLNamedClass sometime later when there are multiple MG models.

Copy link
Collaborator

@damonge damonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tilmantroester . Looks good to me, just a couple of minor things before merging.

pyccl/cosmology.py Outdated Show resolved Hide resolved
pyccl/tests/test_baryons_vd19.py Outdated Show resolved Hide resolved
@tilmantroester
Copy link
Contributor Author

Are there opinions on the spelling of "parametrisation"? Do we use AE spelling and use z instead of s?

@damonge
Copy link
Collaborator

damonge commented Aug 2, 2023

I think AE for the most part (although I find myself being very inconsistent)

@tilmantroester
Copy link
Contributor Author

Switched to "parametrization" now.

Copy link
Collaborator

@damonge damonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tilmantroester tilmantroester merged commit bbbaffd into master Aug 2, 2023
3 checks passed
@tilmantroester tilmantroester deleted the mg_container branch August 2, 2023 22:07
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.

3 participants