CosmoCoffee Forum Index CosmoCoffee

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

Setting DE params in PyCAMB
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Federico Bianchini



Joined: 25 Jun 2013
Posts: 5
Affiliation: University of Melbourne

PostPosted: November 21 2017  Reply with quote

Hi Antony et al,

I'm playing with the devel branch python wrapper as I want to call CAMB for different (w0,wa).

I realized that if you initialize two cosmologies as done below

Code:

pars = camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars.InitPower.set_params(As=2e-9, ns=0.95)
pars.set_dark_energy(w=-1, cs2=1., wa=0, dark_energy_model='fluid')
data = camb.get_background(pars)

pars2 = camb.CAMBparams()
pars2.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars2.InitPower.set_params(As=2e-9, ns=0.95)
pars2.set_dark_energy(w=-0.5, cs2=1., wa=0.1, dark_energy_model='ppf')
data2 = camb.get_background(pars2)


then the background quantities computed for the two cosmologies are the same, for example data.angular_diameter_distance(0.3) will be equal to data2.angular_diameter_distance(0.3).

Am I missing something trivial or is this behaviour expected?

What is the best way to initialize different cosmologies and avoid the overwriting?

Thanks for any inputs!
Back to top
View user's profile   Visit poster's website
Antony Lewis



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

PostPosted: November 21 2017  Reply with quote

If you use
Code:

pars = camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars.InitPower.set_params(As=2e-9, ns=0.95)
pars.set_dark_energy(w=-1, cs2=1., wa=0, dark_energy_model='fluid')
data = camb.get_background(pars)
print data.angular_diameter_distance(0.3)

pars2 = camb.CAMBparams()
pars2.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars2.InitPower.set_params(As=2e-9, ns=0.95)
pars2.set_dark_energy(w=-0.5, cs2=1., wa=0.1, dark_energy_model='ppf')
data2 = camb.get_background(pars2)
print data2.angular_diameter_distance(0.3)


you will get different numbers. Generally anything that does a new computation (like get_background) works with the most-recently set parameters (i.e. the data objects do not maintain a full copy of code state).
Back to top
View user's profile [ Hidden ] Visit poster's website
Federico Bianchini



Joined: 25 Jun 2013
Posts: 5
Affiliation: University of Melbourne

PostPosted: November 22 2017  Reply with quote

Oh, I see that, thanks for your reply Antony.

Pardon my ignorance but is there any way to permanently dump the content of the data object? Say that I'm interested in storing some background quantity (such as the luminosity distance) for two cosmologies, should I just create two splines based on the data object?

Thanks again!
Back to top
View user's profile   Visit poster's website
Antony Lewis



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

PostPosted: November 22 2017  Reply with quote

Yes, I would just make a UnivariateSpline.
Back to top
View user's profile [ Hidden ] Visit poster's website
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.