Felipe Maldonado
Joined: 10 Nov 2016 Posts: 4 Affiliation: FSU

Posted: November 10 2016 


I'm having trouble getting camb.get_matter_power_interpolator to work.
I copied the entire CAMB example notebook and ran every line, and it worked fine until I called the matter power spectrum interpolator:
Code: 
PK = camb.get_matter_power_interpolator(pars, nonlinear=True,
hubble_units=False, k_hunit=False, kmax=kmax,
var1=model.Transfer_Weyl,var2=model.Transfer_Weyl, zmax=zs[1])
#Have a look at interpolated power spectrum results for a range of redshifts
#Expect linear potentials to decay a bit when Lambda becomes important, and change from nonlinear growth
plt.figure(figsize=(8,5))
k=np.exp(np.log(10)*np.linspace(4,2,200))
zplot = [0, 0.5, 1, 4 ,20]
for z in zplot:
plt.loglog(k, PK.P(z,k))

Which failed with the following error message:
Code: 

TypeError Traceback (most recent call last)
<ipythoninput355020b52ca2b4> in <module>()
34 zplot = [0, 0.5, 1, 4 ,20]
35 for z in zplot:
> 36 plt.loglog(k, PK.P(z,k))
37 plt.xlim([1e4,kmax])
38 plt.xlabel('k Mpc')
/usr/local/lib/python2.7/distpackages/camb/camb.pyc in P(self, z, kh, grid)
1128 grid = not np.isscalar(z) and not np.isscalar(kh)
1129 if self.islog:
> 1130 return np.exp(self(z, np.log(kh), grid=grid))
1131 else:
1132 return self(z, np.log(kh), grid=grid)
TypeError: __call__() got an unexpected keyword argument 'grid'

I copy pasted the offending code from the example notebook so I don't believe it to be wrong. Furthermore, I asked someone else to run it on their machine and it did work, which leads me to believe the problem is with my machine. We both ran CAMB 0.1.2 and Python 2.7.6 on different Linux distributions and probably different compilers, but both of us have gfortran 4.9 or newer as required,
Any guidance in this matter would be greatly appreciated.
Felipe 
