CAMB: Choosing resolution in z and k for ISW integral

 Posts: 9
 Joined: October 28 2021
 Affiliation: University of Waterloo
CAMB: Choosing resolution in z and k for ISW integral
I am working with CAMB as implemented in CosmoMC, specifically in the Modified Gravity extension ISiTGR. I have been investigating an issue regarding the CMB temperaturetemperature correlation spectrum (the TT Cls) when varying a specific modified gravity parameter, and have narrowed it down to most likely having something to do with the "resolution" of points in redshift z and scale k when integrating to obtain [math] for the Integrated SachesWolfe effect.
In camb/fortran/equations.f90, the ISW component of the CMB OutputSources is essentially just the timederivative of the Weyl potential, which is later integrated as a function of redshift (and indirectly as a function of scale k). I cannot figure out how the points in z and k at which the ISW integrand is computed are chosen, whether there is an algorithm somewhere in CAMB that decides how they are chosen, and if there is some parameter somewhere that controls this (eg. a parameter that determines the spacing in z or k, or how much interpolation occurs, or the regions where a higher density of points is required). Additionally, tracing through the CAMB code, I am having trouble finding where the ISW integrand (the timederivative of the Weyl potential) is integrated to give [math], and the subsequent calculation for transforming this into a correlation coefficient Cl.
Any help would be greatly appreciated, and would aid in resolving this issue!
In camb/fortran/equations.f90, the ISW component of the CMB OutputSources is essentially just the timederivative of the Weyl potential, which is later integrated as a function of redshift (and indirectly as a function of scale k). I cannot figure out how the points in z and k at which the ISW integrand is computed are chosen, whether there is an algorithm somewhere in CAMB that decides how they are chosen, and if there is some parameter somewhere that controls this (eg. a parameter that determines the spacing in z or k, or how much interpolation occurs, or the regions where a higher density of points is required). Additionally, tracing through the CAMB code, I am having trouble finding where the ISW integrand (the timederivative of the Weyl potential) is integrated to give [math], and the subsequent calculation for transforming this into a correlation coefficient Cl.
Any help would be greatly appreciated, and would aid in resolving this issue!

 Posts: 1842
 Joined: September 23 2004
 Affiliation: University of Sussex
 Contact:
Re: CAMB: Choosing resolution in z and k for ISW integral
You can adjust the accuracy parameters for various samplings:
https://camb.readthedocs.io/en/latest/model.html#camb.model.CAMBparams.set_custom_scalar_sources
https://camb.readthedocs.io/en/latest/model.html#camb.model.CAMBparams.set_custom_scalar_sources

 Posts: 9
 Joined: October 28 2021
 Affiliation: University of Waterloo
Re: CAMB: Choosing resolution in z and k for ISW integral
This appears to only be relevant for the python implementation of CAMB. Since I am running CAMB  to produce the theory Cls  through CosmoMC, so that I can use my results (from MCMC runs) with the Planck likelihoods (and their extra nuisance parameters) to get more accurate Cls, are their corresponding accuracy parameters in the Fortran implementation?

 Posts: 1842
 Joined: September 23 2004
 Affiliation: University of Sussex
 Contact:
Re: CAMB: Choosing resolution in z and k for ISW integral
Sorry, I posted the wrong link
https://camb.readthedocs.io/en/latest/model.html?highlight=lsampleboost#camb.model.AccuracyParams
The structure is available in Fortran and CAMB. (though you might want to look at using Cobaya rather than Cosmomc to make life easier).
https://camb.readthedocs.io/en/latest/model.html?highlight=lsampleboost#camb.model.AccuracyParams
The structure is available in Fortran and CAMB. (though you might want to look at using Cobaya rather than Cosmomc to make life easier).

 Posts: 9
 Joined: October 28 2021
 Affiliation: University of Waterloo
Re: CAMB: Choosing resolution in z and k for ISW integral
Oh I see, no worries, and thank you!
A while ago, we were thinking about Cobaya, but unfortunately the relevant modified gravity code is built on CosmoMC, and additionally one of the specific datasets and its associated likelihood code is already integrated with another modification of CosmoMC, all of which I have merged into amalgamation of CosmoMC code (which took a bit of time and effort).
Thank you so much!
A while ago, we were thinking about Cobaya, but unfortunately the relevant modified gravity code is built on CosmoMC, and additionally one of the specific datasets and its associated likelihood code is already integrated with another modification of CosmoMC, all of which I have merged into amalgamation of CosmoMC code (which took a bit of time and effort).
Thank you so much!

 Posts: 9
 Joined: October 28 2021
 Affiliation: University of Waterloo
Re: CAMB: Choosing resolution in z and k for ISW integral
By any chance, if you have time, do you think you could address my second question, ie. where the ISW integrand is integrated to give ΔT/T, and the subsequent calculation for transforming this into a Cl?
Additionally, I am wondering why, when looking at the spacing in redshift for the points at which the ISW integrand is evaluated, they are not uniform. Is there an algorithm that optimizes these points to be more dense in the regions where the Weyl potential changes quickly or is larger?
Additionally, I am wondering why, when looking at the spacing in redshift for the points at which the ISW integrand is evaluated, they are not uniform. Is there an algorithm that optimizes these points to be more dense in the regions where the Weyl potential changes quickly or is larger?

 Posts: 1842
 Joined: September 23 2004
 Affiliation: University of Sussex
 Contact:
Re: CAMB: Choosing resolution in z and k for ISW integral
Code is around here
https://github.com/cmbant/CAMB/blob/master/fortran/cmbmain.f90#L1452
The spacing is probably log or linear in conformal time.
https://github.com/cmbant/CAMB/blob/master/fortran/cmbmain.f90#L1452
The spacing is probably log or linear in conformal time.

 Posts: 9
 Joined: October 28 2021
 Affiliation: University of Waterloo
Re: CAMB: Choosing resolution in z and k for ISW integral
Thank you, this is helpful!
In a related vein, if I wanted to associate an ell value to each ISW integrand in camb/fortran/equations.f90 by (let's say) printing the ISW integrand and its ell value, where would I find that ell value (presumably in camb/fortran/cmbmain.f90)? To explain more: I am trying to look at the "resolution" of the ISW integrand as a function of redshift, but I want to split the results up by which ell value in the TT Cls they are contributing to (ie. after integrating the ISW integrand over redshift z and scale k, and calculating the Cl for each given ell), so they make sense (in that I should only be looking at the ISW integrand points in redshift space for each ell separately). I have looked in cmbmain.f90, but there are many different ell variables, and I am confused about which ones enter into the ISW calculation. Thanks!
In a related vein, if I wanted to associate an ell value to each ISW integrand in camb/fortran/equations.f90 by (let's say) printing the ISW integrand and its ell value, where would I find that ell value (presumably in camb/fortran/cmbmain.f90)? To explain more: I am trying to look at the "resolution" of the ISW integrand as a function of redshift, but I want to split the results up by which ell value in the TT Cls they are contributing to (ie. after integrating the ISW integrand over redshift z and scale k, and calculating the Cl for each given ell), so they make sense (in that I should only be looking at the ISW integrand points in redshift space for each ell separately). I have looked in cmbmain.f90, but there are many different ell variables, and I am confused about which ones enter into the ISW calculation. Thanks!

 Posts: 1842
 Joined: September 23 2004
 Affiliation: University of Sussex
 Contact:
Re: CAMB: Choosing resolution in z and k for ISW integral
You can output time evolution transfer functions (for each k), or Lk transfer functions. See the example notebook for examples of both.