Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
distances_bm.py
Go to the documentation of this file.
1 import numpy as np
2 import matplotlib.pyplot as plt
3 import py_cosmo_mad as csm
4 
5 #Produces all distance benchmarks
6 #Contact david.alonso@physics.ox.ac.uk if you have issues running this script
7 
8 TCMB=2.725
9 PLOT_STUFF=0
10 WRITE_STUFF=1
11 FS=16
12 
13 def do_all(z_arr,cpar,prefix) :
14  pcs=csm.PcsPar()
15  pcs.background_set(cpar['om'],cpar['ol'],cpar['ob'],cpar['w0'],cpar['wa'],cpar['hh'],TCMB)
16 
17  a_arr=1./(z_arr+1)
18  chi_arr=np.array([pcs.radial_comoving_distance(a) for a in a_arr])
19 
20  if PLOT_STUFF==1 :
21  plt.plot(z_arr,chi_arr); plt.xlabel('$z$',fontsize=FS); plt.ylabel('$\\chi(z)\\,[{\\rm Mpc}\\,h^{-1}]$',fontsize=FS); plt.show()
22 
23  if WRITE_STUFF==1 :
24  np.savetxt(prefix+"_chi.txt",np.transpose([z_arr,chi_arr]),header="[1] z, [2] chi(z) (Mpc/h)")
25 
26 z_arr=np.array([0.,1.,2.,3.,4.,5.])
27 
28 cpar_model1={'om': 0.3,'ol': 0.7 ,'ob':0.05,'hh': 0.7,'s8': 0.8,'ns': 0.96,'w0': -1.0, 'wa': 0.0}
29 cpar_model2={'om': 0.3,'ol': 0.7 ,'ob':0.05,'hh': 0.7,'s8': 0.8,'ns': 0.96,'w0': -0.9, 'wa': 0.0}
30 cpar_model3={'om': 0.3,'ol': 0.7 ,'ob':0.05,'hh': 0.7,'s8': 0.8,'ns': 0.96,'w0': -0.9, 'wa': 0.1}
31 cpar_model4={'om': 0.3,'ol': 0.75,'ob':0.05,'hh': 0.7,'s8': 0.8,'ns': 0.96,'w0': -0.9, 'wa': 0.1}
32 cpar_model5={'om': 0.3,'ol': 0.65,'ob':0.05,'hh': 0.7,'s8': 0.8,'ns': 0.96,'w0': -0.9, 'wa': 0.1}
33 
34 do_all(z_arr,cpar_model1,"model1")
35 do_all(z_arr,cpar_model2,"model2")
36 do_all(z_arr,cpar_model3,"model3")
37 do_all(z_arr,cpar_model3,"model4")
38 do_all(z_arr,cpar_model3,"model5")
def do_all(z_arr, cpar, prefix)
Definition: distances_bm.py:13