Blame view

EBL-spectrums.py 2.19 KB
b5217158   Thomas Fitoussi   Python scripts to...
1
2
3
4
5
#!/bin/python

import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
374f3d52   Thomas Fitoussi   add Weight distri...
6
from Modules.Constants import *
b5217158   Thomas Fitoussi   Python scripts to...
7
8
9
10

fig = plt.figure()
ax = fig.add_subplot(111)

e4ba931e   Thomas Fitoussi   Corrections:
11
z=2
b5217158   Thomas Fitoussi   Python scripts to...
12
13
14

# ==== Dominguez ====
lamb,lambdaI = np.loadtxt("EBL_files/lambdaI_Dominguez.dat",unpack=True,usecols=[0,15])
e4ba931e   Thomas Fitoussi   Corrections:
15
#lamb,lambdaI =np.loadtxt("EBL_files/lambdaI_Dominguez.dat",unpack=True,usecols=[0,1])
b5217158   Thomas Fitoussi   Python scripts to...
16
17
18
hv = h*c/(lamb*1e-4)  # erg
density = 1e-6*(4*pi/c)*lambdaI/(hv**2) /(erg_to_GeV*1e9) *(1+z)**3
hv = hv *(erg_to_GeV*1e9)
fb95bd3d   Thomas Fitoussi   Add time delay ve...
19
ax.plot(hv,density*hv**2,"--b",label="Dominguez and Al")
b5217158   Thomas Fitoussi   Python scripts to...
20
21
22

# ==== Kneiske and Doll - "best fit" ====
hv,density = np.loadtxt("EBL_files/n_bestfit10.dat",unpack=True,usecols=[0,1])
fb95bd3d   Thomas Fitoussi   Add time delay ve...
23
ax.plot(hv,density*hv**2,"--r",label="Kneiske and Doll - 'best fit'")
b5217158   Thomas Fitoussi   Python scripts to...
24
25

# ==== Kneiske and Doll - "lower limit" ====
e4ba931e   Thomas Fitoussi   Corrections:
26
27
hv,density = np.loadtxt("EBL_files/n_lowerlimit10.dat",unpack=True,usecols=[0,179])
#hv,density =np.loadtxt("EBL_files/n_lowerlimit10.dat",unpack=True,usecols=[0,1])
b5217158   Thomas Fitoussi   Python scripts to...
28
density=density*(1+z)**3
fb95bd3d   Thomas Fitoussi   Add time delay ve...
29
ax.plot(hv,density*hv**2,"--g",label="Kneiske and Doll - 'lower limit'")
b5217158   Thomas Fitoussi   Python scripts to...
30
31

# ==== Fransceschini ====
e4ba931e   Thomas Fitoussi   Corrections:
32
33
hv,density = np.loadtxt("EBL_files/n_Fra.dat",unpack=True,usecols=[0,11])
#hv,density = np.loadtxt("EBL_files/n_Fra.dat",unpack=True,usecols=[0,1])
b5217158   Thomas Fitoussi   Python scripts to...
34
density=density*(1+z)**3
fb95bd3d   Thomas Fitoussi   Add time delay ve...
35
ax.plot(hv,density*hv**2,"--c",label="Fraceschini")
b5217158   Thomas Fitoussi   Python scripts to...
36
37

# ==== Finke ====
e4ba931e   Thomas Fitoussi   Corrections:
38
39
hv,density = np.loadtxt("EBL_files/n_Finke.dat",unpack=True,usecols=[0,201])
#hv,density = np.loadtxt("EBL_files/n_Finke.dat",unpack=True,usecols=[0,1])
b5217158   Thomas Fitoussi   Python scripts to...
40
density=density*(1+z)**3
fb95bd3d   Thomas Fitoussi   Add time delay ve...
41
ax.plot(hv,density*hv**2,"--m",label="Finke and Al")
b5217158   Thomas Fitoussi   Python scripts to...
42
43

# ==== Gilmore ====
e4ba931e   Thomas Fitoussi   Corrections:
44
45
hv,density = np.loadtxt("EBL_files/n_Gil.dat",unpack=True,usecols=[0,14])
#hv,density = np.loadtxt("EBL_files/n_Gil.dat",unpack=True,usecols=[0,1])
fb95bd3d   Thomas Fitoussi   Add time delay ve...
46
ax.plot(hv,density*hv**2,"--y",label="Gilmore and Al")
b5217158   Thomas Fitoussi   Python scripts to...
47

65135318   Thomas Fitoussi   Reset modules
48
49
50
51
52
53
54
55
56
57
#==== CMB ====
def nCMB(E):
   kTcmb = k*Tcmb*erg_to_GeV*1e9*(1+z)
   theta = E/kTcmb
   nCMB=(hb*c*erg_to_GeV*1e9)**(-3) *(E/np.pi)**2 /(np.exp(theta)-1)    
   return nCMB

hv = np.logspace(-4,-1,1000)
ax.plot(hv,nCMB(hv)*hv**2,"-k",label="CMB")

b5217158   Thomas Fitoussi   Python scripts to...
58
59
60
61
62
ax.set_xscale('log')
ax.set_yscale('log')
ax.grid(b=True,which='major')
ax.legend(loc="best",title="z = %.0f"%z)
ax.set_xlabel("energy [eV]")
65135318   Thomas Fitoussi   Reset modules
63
ax.set_ylabel("$n_{EBL}$ [photon.eV.cm$^{-3}$]")
b5217158   Thomas Fitoussi   Python scripts to...
64
65

plt.show()