Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
mk_bins.py
Go to the documentation of this file.
1 import numpy as np
2 import matplotlib.pyplot as plt
3 
4 #Generates redshift distribution for angular power spectrum and correlation function benchmarks
5 #Contact david.alonso@physics.ox.ac.uk if you have issues running this script
6 
7 nz=256
8 sz=0.15
9 z1=1.0
10 z2=1.5
11 z1_arr=z1-np.fmin(20*sz,z1)+40*sz*(np.arange(nz)+0.5)/nz
12 z2_arr=z2-np.fmin(20*sz,z2)+40*sz*(np.arange(nz)+0.5)/nz
13 pz1_arr=np.exp(-0.5*((z1_arr-z1)/sz)**2)
14 pz2_arr=np.exp(-0.5*((z2_arr-z2)/sz)**2)
15 
16 zlo_arr,h1,h2=np.loadtxt("z_DESC-CC",unpack=True)
17 dz=np.mean(zlo_arr[1:]-zlo_arr[:-1])
18 zm_arr=zlo_arr+dz/2
19 
20 z_arr_bias=1.25*(np.arange(2*nz)+0.5)/nz
21 bias_arr=np.ones(len(z_arr_bias))
22 
23 
24 plt.plot(z1_arr,pz1_arr)
25 plt.plot(z2_arr,pz2_arr)
26 plt.show()
27 
28 plt.plot(zm_arr,h1)
29 plt.plot(zm_arr,h2)
30 plt.show()
31 
32 plt.plot(z_arr_bias,bias_arr)
33 plt.show()
34 
35 
36 np.savetxt("bin1_analytic.txt",np.transpose([z1_arr,pz1_arr]))
37 np.savetxt("bin2_analytic.txt",np.transpose([z2_arr,pz2_arr]))
38 
39 np.savetxt("bin1_histo.txt",np.transpose([zm_arr,h1]))
40 np.savetxt("bin2_histo.txt",np.transpose([zm_arr,h2]))
41 
42 np.savetxt("bias.txt",np.transpose([z_arr_bias,bias_arr]))