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

Fix for issue #1191 #1202

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix for issue #1191 #1202

wants to merge 3 commits into from

Conversation

sankarshana16
Copy link

Modified cosmology.py so that it complains when mu-sigma scale-dependent parameters are non-zero but transfer function isn't the isitgr one

Copy link
Collaborator

@c-d-leonard c-d-leonard left a comment

Choose a reason for hiding this comment

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

This is generally a good fix, thank you @sankarshana16. There is one thing regarding the values of c1_mg and c2_mg which needs to be sorted out, this is what is causing the unit tests to fail.

Also just have a look at the flake8 results - you will need to format the new lines of code to pass those formatting requirements before merging.

I wasn't able to test on my local machine yet because of some weird installation issues (which also happen on the master branch so I think it's me, not this branch). I'll try to fix that in the meantime while these fixes are implemented.

@@ -294,6 +294,16 @@ def __init__(
modified_gravity.MuSigmaMG):
raise NotImplementedError("`mg_parametrization` only supports the "
"mu-Sigma parametrization at this point")
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am assuming this commented out section is leftover from during modifications before realising you only want to through the error when c1_mg, c2_mg or lambda_mg is non-zero. Remove commented out section before merging.

if(c1_mg != 0. or c2_mg !=0. or lambda_mg != 0.):

if isinstance(self.mg_parametrization, modified_gravity.MuSigmaMG) and self.transfer_function_type is not 'boltzmann_isitgr':
raise ValueError("mu-Sigma parametrization is inconsistent with your transfer function choice (required to use isitgr)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to have a slightly more informative error message. This one doesn't clarify to the user that the issue is the scale-dependence parameters specifically. Can it say something like "Your choice of c1_mg, c2_mg, and lambda_mg values is inconsistent with your transfer function choice (you must choose istigr)."?

@@ -471,6 +481,11 @@ def _build_parameters(
c2_mg = self.mg_parametrization.c2_mg
lambda_mg = self.mg_parametrization.lambda_mg

if(c1_mg != 0. or c2_mg !=0. or lambda_mg != 0.):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The default values of c1_mg and c2_mg are actually 1. GR is recovered when c1_mg = c2_mg=1 (regardless of lambda value) or when c1_mg=c2_mg=lambda_mg=0. So, need a slightly more complicated check here to cover both cases. This is why this branch is currently failing a bunch of unit tests I think.

Copy link
Author

Choose a reason for hiding this comment

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

@c-d-leonard I've modified the code to only allow c1_mg = c2_mg = 1 or c1_mg = c2_mg = lambda_mg = 0., but complain otherwise with a better error message as you suggested. To be honest, I still had a few unit test problems, but from what I could see, they were not related to this (I think). Let me know if this is fine

@damonge
Copy link
Collaborator

damonge commented Nov 20, 2024

@sankarshana16 are you able to address these?

@sankarshana16
Copy link
Author

@c-d-leonard
Thanks for taking a look, this is my first time doing a CCL pull request, so appreciate the feedback. :)
@damonge Yeah I should be able to address these

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11973380207

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 7 of 9 (77.78%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 97.389%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyccl/cosmology.py 7 9 77.78%
Files with Coverage Reduction New Missed Lines %
pyccl/cells.py 1 97.96%
pyccl/_nonlimber_FKEM.py 3 96.15%
Totals Coverage Status
Change from base Build 11816689318: -0.02%
Covered Lines: 6527
Relevant Lines: 6702

💛 - Coveralls

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.

4 participants