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

Allow sigma8 as an input when using CAMB for nonlinear power spectra #1106

Merged
merged 22 commits into from
Jul 24, 2023

Conversation

tilmantroester
Copy link
Contributor

This PR rescales the primordial power spectrum in CAMB before computing the non-linear power spectrum, allowing using sigma8 as an input.

By default, INTEGRATION_SIGMAR_EPSREL is set to 1e-5, which results in a relative error of 1e-3 on sigma8. We might want to push this a bit.

pyccl/boltzmann.py Show resolved Hide resolved
pyccl/boltzmann.py Outdated Show resolved Hide resolved
@tilmantroester
Copy link
Contributor Author

The failing CI is due to CLASS not supporting cython 3.0.0: lesgourg/class_public#531

@damonge
Copy link
Collaborator

damonge commented Jul 18, 2023

So it's because of an update in gha?

@tilmantroester
Copy link
Contributor Author

I think because class is not forcing its cython dependence to be less than 3.0.0, the class installation now fails because cython updated to 3.0.0, which breaks class.

@damonge
Copy link
Collaborator

damonge commented Jul 18, 2023

OK, I say we wait a couple of days and see if class fix that. Otherwise we can try to force gha to use a previous cython version (disabling the class tests would be kind of tragic)

@hsinfan1996
Copy link
Contributor

classy 2.8.0 might work. Versions>2.8.0 will install Cython 3.0.0 when being installed.

@hsinfan1996
Copy link
Contributor

classy==2.8.0

@damonge
Copy link
Collaborator

damonge commented Jul 19, 2023

No luck, it seems...

@hsinfan1996
Copy link
Contributor

hsinfan1996 commented Jul 19, 2023

No luck, it seems...

It doesn't work here. pip (or mamba?) still installs the latest Cython I guess.

@hsinfan1996
Copy link
Contributor

hsinfan1996 commented Jul 19, 2023

Does it mean only 2.9.4 and below are pip installable?
lesgourg/class_public#527 (comment)

@damonge
Copy link
Collaborator

damonge commented Jul 20, 2023

@tilmantroester tests can now run, but some seem to be failing.

@tilmantroester
Copy link
Contributor Author

Can someone explain this test:
https://github.com/LSSTDESC/CCL/blob/master/pyccl/tests/test_power_mu_sigma_sigma8norm.py#L48-L61 ?

From this my understanding is that if sigma8 is given, then setting mu and Sigma should not have any effect because any rescaling of the power spectrum is undone by the sigma8 normalisation?

@damonge
Copy link
Collaborator

damonge commented Jul 21, 2023

Humm, I think it's just testing that initialising power spectra with A_s or its associated sigma8 gives the same result, even when you're passing MG parameters != 0

@tilmantroester
Copy link
Contributor Author

Ah, my confusion was that the input sigma8 is including MG. Should be fixed now. Looking at the MG implementation, I'm a bit worried though. It's quite opaque and the C-layer does things like creating new C cosmology structs. Since we don't support the C API any more, is that safe?
Would an API like the baryons, which modifies the power spectra (and growth rates in this case) make sense, instead of having mu and Sigma as first-class cosmology parameters? Especially since that only applies to linear scales, which are of restricted use for the LSS stuff CCL is for.

@coveralls
Copy link

coveralls commented Jul 21, 2023

Pull Request Test Coverage Report for Build 5640753554

  • 34 of 34 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 97.443%

Files with Coverage Reduction New Missed Lines %
pyccl/baryons/baccoemu_baryons.py 1 98.63%
Totals Coverage Status
Change from base Build 5619969593: 0.004%
Covered Lines: 5679
Relevant Lines: 5828

💛 - Coveralls

.github/environment.yml Outdated Show resolved Hide resolved
benchmarks/test_ptpk_lpt.py Outdated Show resolved Hide resolved
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 ae245cd into master Jul 24, 2023
3 checks passed
@tilmantroester tilmantroester deleted the sigma8_for_camb branch July 24, 2023 20:41
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