Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
sigmaM_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 sigma(M) 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 LKMAX=7
13 
14 def do_all(m_arr,cpar,prefix) :
15  pcs=csm.PcsPar()
16  pcs.background_set(cpar['om'],cpar['ol'],cpar['ob'],cpar['w0'],cpar['wa'],cpar['hh'],TCMB)
17  pcs.set_linear_pk('BBKS',-3,LKMAX,0.01,cpar['ns'],cpar['s8'])
18 
19  r_arr=np.array([pcs.M2R(m) for m in m_arr])
20  sm_arr=np.sqrt(np.array([pcs.sig0_L(r,r,'TopHat','TopHat') for r in r_arr]))
21 
22  if PLOT_STUFF==1 :
23  plt.plot(m_arr,sm_arr)
24  plt.xlabel('$M\\,[M_{\\odot}\\,h^{-1}]$',fontsize=FS)
25  plt.ylabel('$\\sigma(M)$',fontsize=FS)
26  plt.gca().set_xscale('log');
27  plt.gca().set_yscale('log');
28  plt.show()
29 
30  if WRITE_STUFF==1 :
31  np.savetxt(prefix+"_sm.txt",np.transpose([m_arr,sm_arr]),header="[1] M (M_sun/h), [2] sigma(M)")
32 
33 z_arr=np.array([0.,1.,2.,3.,4.,5.])
34 lm_arr=6.+2*np.arange(6)
35 m_arr=10**lm_arr
36 
37 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}
38 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}
39 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}
40 
41 do_all(m_arr,cpar_model1,"model1")
42 do_all(m_arr,cpar_model2,"model2")
43 do_all(m_arr,cpar_model3,"model3")
def do_all(m_arr, cpar, prefix)
Definition: sigmaM_bm.py:14