LSSTDESC / CCL

DESC Core Cosmology Library: cosmology routines with validated numerical accuracy
BSD 3-Clause "New" or "Revised" License
141 stars 64 forks source link

Save CLASS transfer functions when calculating matter power #114

Open dkirkby opened 7 years ago

dkirkby commented 7 years ago

This could either be triggered by an option to ccl_cosmology_compute_power_class() or we could always calculate and save the transfer functions (since they are presumably always being calculated anyway) to simplify the API. Any opinions?

elikrause commented 7 years ago

My guess is that always saving these as part of the cosmo structure would not add much run time. Which exact transfer functions would you like to have as part of the CCL, and do you know how these are accessed from CLASS?

damonge commented 7 years ago

It may be interesting to save delta, phi+psi and at some point, v (the latter two for lensing and RSDs). These are trivially related to each other in LCDM, but not necessarily in other models (which will be important when we extend CCL). I have accessed these before in my hacked versions of CLASS, so I could look into this at some point.

dkirkby commented 7 years ago

I am able to access the CLASS transfer functions within my hacked ccl_cosmology_compute_power_class() but I see negative values so I'm not sure how they are defined. Any ideas? In any case, it looks straightforward to add and fill a new ccl_spline2d in ccl_data for the matter and velocity transfer functions of each species, as well as phi & psi.

dkirkby commented 7 years ago

The CLASS transfer functions make sense if I plot -t(k) / t(kmin) / k**2, as shown in this plot of the total matter density transfer function compared with BBKS: tk_total

I propose that we adopt the normalization and scaling shown in this plot, rather than the raw CLASS values, unless there are objections. I think this also matches how CAMB provides transfer functions.

c-d-leonard commented 4 years ago

I believe we still do not save the transfer functions. Is this something we still want? I can see it being useful, especially for modified gravity applications. @damonge @dkirkby?

damonge commented 4 years ago

Yes, this is eventually gonna bite us in the ass. We have a relatively nice formalism to store these things (the generalized Pks), but we're not using it for it.

dkirkby commented 4 years ago

Yes, I think we still want this. Is it easier to implement now?

damonge commented 4 years ago

I think so, and it could be done at the python level (the same way it's done for the power spectrum now)