Python CAMB, set_for_lmax---why are there more outputs than the limit set by lmax?

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Evan B
Posts: 13
Joined: February 27 2015
Affiliation: student

Python CAMB, set_for_lmax---why are there more outputs than

Post by Evan B » December 02 2015

In the Python-friendly version for CAMB

http://camb.readthedocs.org/en/latest/CAMBdemo.html

there is a function in

Code: Select all

camb.model
which allows one to set the lmax for the power spectra output, i.e.

Code: Select all

set_for_lmax(lmax, max_eta_k=None, lens_potential_accuracy=0, lens_margin=150, k_eta_fac=2.5, lens_k_eta_reference=18000.0)[source]
However, when I set lmax, there are always several trailing C_ell's. Why is this?

Code: Select all

import camb
pars.set_for_lmax(512, lens_potential_accuracy=0)
#get dictionary of CAMB power spectra
powers = results.get_cmb_power_spectra(pars)
totCL=powers['total']
print totCL.shape
outputs the shape
(551, 4)

That's unexpected. Shouldn't the length of the array for power spectra by 513, as that's the lmax value?

What's going on here? Was that in the original CAMB Fortran code?

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Python CAMB, set_for_lmax---why are there more outputs t

Post by Antony Lewis » December 02 2015

The set_for_lmax function is intended to set parameters to get results accurate to l_max, it does not actually determine the output L range. For example, with CMB lensing on, the lensed CL will only be accurate to a lower l_max than the unlensed CL (because lensing is like a convolution). So this function sets l_max high enough that the lensed C_l are accurate to l_max, which involves calculating spectra to higher l_max.

To fix the size of output arrays, set the optional lmax parameter argument to get_cmb_power_spectra.

[I wouldn't recommend using set_for_lmax for \ell < 1500, it'll probably work, but not much tested since WMAP data and later need fairly high Lmax. And definitely use higher lmax if you want BB right. Of course you should always test the results are stable by comparing different input accuracy/range settings].

Evan B
Posts: 13
Joined: February 27 2015
Affiliation: student

Python CAMB, set_for_lmax---why are there more outputs than

Post by Evan B » December 02 2015

"The set_for_lmax function is intended to set parameters to get results accurate to lmax, it does not actually determine the output L range"

Understood.

Question: So, in terms of TT (say), is there a difference between outputting an array of C_ell's up to lmax=2500 and slicing this array off at 512 versus explicitly setting the accurate lmax at 512 and then slicing the array to the output L range?

I wouldn't think there would be a difference in the Boltzmann code outputs.

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Python CAMB, set_for_lmax---why are there more outputs t

Post by Antony Lewis » December 02 2015

Yes, there will be a difference - lmax determines k_max and lensing coupling range, so both will be different.

Evan B
Posts: 13
Joined: February 27 2015
Affiliation: student

Python CAMB, set_for_lmax---why are there more outputs than

Post by Evan B » December 03 2015

Sorry, I'm not following this:

For TT with no lensing, I cannot see the difference it would make, in terms of shape of the power spectrum or cosmological parameters thereof.

It must be a slightly numerical difference in the output caused by [tex]k_{\text{max}}[/tex]?

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Python CAMB, set_for_lmax---why are there more outputs t

Post by Antony Lewis » December 03 2015

Yes, exactly.

Evan B
Posts: 13
Joined: February 27 2015
Affiliation: student

Python CAMB, set_for_lmax---why are there more outputs than

Post by Evan B » December 03 2015

I'm still a bit confused; bear with me.

Question:

Let's say I was working with a CMB map generated at nside=1024.

I want to use the CAMB outputs that correspond to this map. Do I run CAMB at lmax=2500 and then slice the output array at C_{ell} for ell=1024, or do I use set_for_lmax() at lmax=1024.

Surely there's a difference in terms of cosmological parameters, etc.

That is to say:

Some WMAP/Planck data products are set at nside=1024. This is because of the resolution of the data and because of the way the data structure Healpix is set up---it's not necessarily "physical".

But if I wanted the "theoretical" CAMB output for such a map, what is the correct physics: do I run at lmax=2500 and slice at lmax=1024, or use set_for_lmax() at 1024? Here the decision is a "physics" one. I'm deciding on the correct theoretical output.

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Python CAMB, set_for_lmax---why are there more outputs t

Post by Antony Lewis » December 03 2015

It shouldn't make much difference, at least of temperature. If in doubt check results are stable to increasing lmax.

(however nside=1024 can support high than l_max=1024, so not sure why you are slicing there)

Post Reply