N_eff in pyCAMB

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Chris Pedersen
Posts: 5
Joined: March 01 2018
Affiliation: University College London

N_eff in pyCAMB

Post by Chris Pedersen » March 15 2018

Having an issue printing out N_eff in pycamb. Trying:

Code: Select all

pars = camb.CAMBparams()
pars.set_cosmology(H0=H0, ombh2=ombh2, omch2=omch2, omk=omk,num_massive_neutrinos=0, 
                   neutrino_hierarchy='degenerate',mnu=0.0,YHe=YHe,TCMB=TCMB)
## Primordial parameters
pars.InitPower.set_params(ns=ns, As=As, pivot_scalar=pivot_scalar)
pars.set_matter_power(redshifts=zs, kmax=100.0)
pars.N_eff()
Which outputs:

AttributeError Traceback (most recent call last)
<ipython-input-24-d90bcc49dcbb> in <module>()
8 pars.InitPower.set_params(ns=ns, As=As, pivot_scalar=pivot_scalar)
9 pars.set_matter_power(redshifts=zs, kmax=100.0)
---> 10 pars.N_eff()
11 camb.model.transfer_power_var.value=fluid ## Set fluid
12 results = camb.get_results(pars)

AttributeError: 'CAMBparams' object has no attribute 'N_eff'

This seems odd because in the link below it looks like this should be a callable function? Apologies if I'm doing something stupid.
http://camb.readthedocs.io/en/latest/_m ... rams.N_eff

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

Re: N_eff in pyCAMB

Post by Antony Lewis » March 15 2018

Do you have the latest master branch from github installed?

Chris Pedersen
Posts: 5
Joined: March 01 2018
Affiliation: University College London

N_eff in pyCAMB

Post by Chris Pedersen » April 08 2018

I downloaded and installed the latest version so printing N_eff now works ok. But I'm unable to get the value to actually change, as below:

Code: Select all

pars = camb.CAMBparams&#40;&#41;
pars.set_cosmology&#40;H0=67.24, ombh2=0.0223, omch2=0.115579, omk=0.0, num_massive_neutrinos=0,
                   mnu=0., nnu=0., YHe=0.24, meffsterile=0.0, standard_neutrino_neff=0.,
                   TCMB=2.718, tau=None, neutrino_hierarchy='degenerate'&#41;
## Primordial parameters
pars.InitPower.set_params&#40;ns=0.9667,As=2.142e-09,pivot_scalar=0.002,pivot_tensor=0.002,
                         nrun=0, nrunrun=0.0&#41;
pars.set_dark_energy&#40;w=-1,sound_speed=1&#41;
pars.set_matter_power&#40;redshifts=&#91;z1,z2,z3,z4&#93;, kmax=100.0&#41;
print&#40;pars.N_eff&#40;&#41;&#41;
The output for pars.N_eff() is always 3.046 no matter what I sent nnu, or standard_neutrino_neff to. Am I attempting to set N_eff in the wrong way?

Post Reply