lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
218 stars 291 forks source link

Possible bug in ppt->index_ln_tau_pk #536

Open genye00 opened 11 months ago

genye00 commented 11 months ago

In https://github.com/lesgourg/class_public/blob/aa92943e4ab86b56970953589b4897adf2bd0f99/source/perturbations.c#L2066C5-L2066C25 ppt->index_ln_tau_pk is the starting index of of the earliest time when pk is calculated in the log(tau) array, it probably should be changed to ppt->index_ln_tau_pk = index_tau_pk + ppt->ln_tau_size - ppt->tau_size;

kcroker commented 8 months ago

How did you encounter this?

genye00 commented 8 months ago

How did you encounter this?

It's been some time. I do not remember the details. I think I discovered this when trying to draw out the raw P(k,z) or P(k, tau) and playing with the limit on k and z and tau.

JiangJQ2000 commented 8 months ago

This should be the same problem as #471, and is actually the solution. It looks like v3.2.1 fixes this issue, as the starting index was changed to 0 (or just index_tau for tau_sampling), and index_ln_tau_pk is not used.