Skip to content

Computation of sigma8 from CAMB #213

Open

Description

@emmanartis

I noticed that in the file "camb_interface.py", some undesired behaviour might happen.
If you compute the Power Spectrum in a redshift range that does not include z=0, and you still want to return sigma8, then what is return is
sigma8(z=zmin), where zmin is the minimal redshift of the redshift range.
You can see it line 594:

Get growth rates and sigma_8

sigma_8 = r.get_sigma8()[::-1]

That contradicts the definition given in the doc:
"
Amplitude of linear matter power at 8/h Mpc at z=0. Only calculated if mode=all
"
and generally the usual definition of sigma_8.
I think that a better behaviour would be to return an error to avoid confusion, or better
to automatically compute the spectrum at z=0, and deduce the proper sigma8 while maybe raising a warning.

The same problem appears with fsigma8

Activity

  1. joezuntz commented on Mar 9, 2026

    @joezuntz
    Member

    Thanks for spotting this!

    CAMB itself raises an error if you set zmin>0 and then ask for sigma8(z=0) using the get_sigma8_0 function.

    So one option is to only save the quantity if zmin=0. The other is to force camb to always include z=0. But to only use that for sigma8, not to change the output P(k, z) grids. The downside to that is that it could slow the integration if people are only doing high-z things, though I'm not sure how common that use case is.

    Another would be to only calculate them if zmin>0, and print a warning in the setup phase to let people know. That seems a bit surprising for people though.

    I guess I could add an option to not integrate to zero and also therefore not get sigma8. Maybe that's the best approach. I'll have a look now.

  2. lucafiorino22 commented on Apr 13, 2026

    @lucafiorino22

    HI, I might have spotted a possible issue with this implementation, given that now the power spectrum is created on a grid starting from z=0, get_sigma8() and get_fsigma8() will be computed on this grid, rather than the one specified by the user.

    This create a mismatch between the redshifts of the growth parameters: let's say that in the input file zmin = 0.5, then z, H, D will have as first element their values at z=0.5, but f, sigma8 and fsigma8 the ones at z=0. Of course, given that the starting points are different, also the following elements won't match.

    I do not know if there's a simple way to solve the problem, for now I just interpolate with a cubic spline at the correct redshifts, but I think it's not ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions