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)
232 stars 288 forks source link

cross-correlation power spectra #231

Open mahtaparsa opened 6 years ago

mahtaparsa commented 6 years ago

Hi, is it possible to plot cross-correlation power spectra with CLASS?

Stefan-Heimersheim commented 6 years ago

Hi, you can find an explanation on this in the explanatory.ini:

1.a) list of output spectra requested:
- 'tCl' for temperature Cls,
- 'pCl' for polarization Cls,
- 'lCl' for CMB lensing potential Cls,
- 'nCl' (or 'dCl') for density number count Cls,
- 'sCl' for galaxy lensing potential Cls,
[...]
By defaut, the code will try to compute the following cross-correlation Cls (if
available): temperature-polarisation, temperature-CMB lensing, polarization-CMB
lensing, CMB lensing-density, and density-lensing. Other cross-correlations are
not computed because they would slow down the code considerably.

Is this what you were looking for?

Cheers, Stefan

mahtaparsa commented 6 years ago

Hi Stefan, thanks for your reply. I mean ISW-galaxy cross correlations. For example the code CAMB_sources can calculate such cross-correlations. I want to know if CLASS can do it or not.

janinarenk commented 6 years ago

Hi @mahtaparsa , Yes, you can! It just needs good sampling of the transfer functions, which makes the computation very slow, therefore it is commented out in the default version. To compute the temperature - galaxy cross correlation you need to uncomment the following lines in spectra.c :

`

if ((ppt->has_cl_cmb_temperature == _TRUE_) && (ppt->has_cl_number_count == _TRUE_) && (ppt->has_scalars == _TRUE_)) {
  psp->has_td = _TRUE_;
  psp->index_ct_td=index_ct;
  index_ct+=psp->d_size;
}
else {
  psp->has_td = _FALSE_;
}

`

And comment psp->has_pd = _FALSE_; outside the else statement (heads up: there are two atm!)

If you then choose tCl and nCl as output you will get extra columns with the T-dens correlations. If you want phi-dens you can do the same steps, just search for the psp->has_pd flag in source.c.

Cheers, Janina

mahtaparsa commented 6 years ago

Hi Janina, thanks for your reply. Outside the else statement there was "psp->has_td = FALSE;" which I commented it. The output _cl file contains TT and dens[1]-dens[1], dens[1]-dens[2], ... , and I did not find T-dens correlation.

janinarenk commented 6 years ago

Have you commented both psp->has_td = FALSE; statements? In the current version of spectra.c there is one in line 1665 and another in line 1676.

mahtaparsa commented 6 years ago

Thanks Janina! After commenting both lines, I can get T-dens outputs. How can I understand the meanings of dens[1], dens[2], ..., dens[5]?

janinarenk commented 6 years ago

This is explained in the explanatory.ini file

6a) enter here a description of the selection functions W(z) of each redshift bin; selection can be set to 'gaussian', 'tophat' or 'dirac', then pass a list of N mean redshifts in growing order separated by comas, 1 or N widths separated by comas, 1 or N bias separated by a comma, and 1 or N magnification bias separated by a comma. The width stands for one standard deviation of the gaussian (in z space), or for the half-width of the top-hat. Finally, non_diagonal sets the number of cross-correlation spectra that you want to calculate: 0 means only auto-correlation, 1 means only adjacent bins, and number of bins minus one means all correlations (default: set to 'gaussian',1,0.1,1.,0.,0)

selection=gaussian selection_mean = 0.98,0.99,1.0,1.1,1.2 selection_width = 0.1 selection_bias = selection_magnification_bias = non_diagonal=4

In this case dens[1] corresponds to the auto-correlation of the galaxy number counts in the first redshift bin (here a Gaussian centred at z=0.98) with itself. dens[1]-dens[2] would be the cross-correlation of the first and second bin. (Note that the dens column contains all contributions to the galaxy number counts you specified with number count contributions = density, rsd, lensing, gr) T-dens[1] gives you the cross-correlation btw. CMB temperature and the galaxy number counts for the first redshift bin.

mahtaparsa commented 6 years ago

Thanks a lot! That was very useful.

janinarenk commented 6 years ago

Perfect, happy to help! Could you close the issue if it is resolved now?

mahtaparsa commented 6 years ago

Yes, I will close it.

mahtaparsa commented 5 years ago

What is the output values of T-dens column? Is that l(l+1)c_l^{gt}/(2\pi) [K] ?

Stefan-Heimersheim commented 4 years ago

Hi mahtaparsa,

it's best to make a new issue instead of reopening an old one, it usually get buried somewhere at the bottom of the list otherwise. Take a look at issue #304, we just discussed this there.

TL, DR: Cl_TG is always computed in CLASS format, even if you use CAMB format, so it is in relative units and you multiple by T_cmb to get the temperature version.

Stefan-Heimersheim commented 4 years ago

Also just tagging @schoeneberg about the bug(?) that Janina noted: In spectra.c around line 520 there is psp->has_td = _FALSE_; three times. The third one looks like it is supposed to be has_pd instead?

schoeneberg commented 4 years ago

Also just tagging @schoeneberg about the bug(?) that Janina noted: In spectra.c around line 520 there is psp->has_td = _FALSE_; three times. The third one looks like it is supposed to be has_pd instead?

Added to newest version of the dev branch. To be propagated to main code very soon. Thanks for pointing it out !