CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

PyCAMB get_matter_power_interpolator failure
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Felipe Maldonado



Joined: 10 Nov 2016
Posts: 4
Affiliation: FSU

PostPosted: November 10 2016  Reply with quote

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 non-linear 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)
<ipython-input-35-5020b52ca2b4> 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([1e-4,kmax])
     38 plt.xlabel('k Mpc')

/usr/local/lib/python2.7/dist-packages/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
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 1291
Affiliation: University of Sussex

PostPosted: November 10 2016  Reply with quote

Check you have the latest scipy?
Back to top
View user's profile [ Hidden ] Visit poster's website
Felipe Maldonado



Joined: 10 Nov 2016
Posts: 4
Affiliation: FSU

PostPosted: November 10 2016  Reply with quote

Antony Lewis wrote:
Check you have the latest scipy?


Hi, thank you for your reply.

I updated my versions of Numpy and Scipy and now it does work.
Thank you so much for your assistance.

Felipe
Back to top
View user's profile  
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.