Constantes.py 1.75 KB
#!/bin/python

from numpy import *

e=4.8032068e-10 # esu (cgs units)
qe=1.602176565e-12 # erg
m=9.1093897e-28 # g
me=510.998928 # kev
c=2.99792458e10 # cm.s-1
k=1.380658E-16 # erg.K-1
h=6.62606957e-27 # erg.s
hb=1.05457266E-27 # erg.s
alpha=1./137.035999679
lambdaC=hb/(m*c)
Mpc=(3.0856776e+16)*1e8 # Mpc to cm
erg_to_GeV=1/(1.602176565e-3)
degre=180/pi
s_to_yr=3600*24*365.25

# Cosmology
a0=1.
H0=67.8*1e5/(Mpc) # s-1
omegaM = 0.3
omegaK = 0
omegaL = 0.7

# CMB 
Tcmb=2.7255 # K
Tcmbp=(k*Tcmb)/(m*c*c) # Adimentionnal thermal energy
nCMB=449 # cm^-3
Ecmb=3*Tcmbp*me*1e3 #eV
rhoCMB=Ecmb*nCMB #eV.cm^-3

# EBL
Eebl=1 #eV

# Particles physics
r0=e*e/(m*c*c)
sigmaT=8.*pi*(r0**2)/3. # Thomson cross section

# Compton accumulation
Compton_threshold = 0.05
ECompton_threshold = Compton_threshold/(4/3*2.7*Tcmbp) *me*1e-6 #GeV

# Value for analytic expression
Ee=1e3 #GeV
B=1e-17 #Gauss
lambda_B=0.3 #Mpc

# Compton scattering
Dic= 3*(me*1e-6)**2/(4*sigmaT*rhoCMB*1e-9*Ee) /Mpc #Mpc
lambdaIC=1/(nCMB*sigmaT*Mpc) #Mpc
Eic= 4*Ecmb*Ee**2/(3*me**2)*1e3 #GeV 

# Larmor radius
RL=(Ee/erg_to_GeV)/(e*B) /Mpc #Mpc
# Magnetic deflection
delta=lambdaIC/RL*degre
Delta1=Dic/RL*degre                #degre if Dic >> lambda_B 
Delta2=sqrt(Dic*lambda_B)/RL*degre #degre if Dic << lambda_B

# Threshold energy when Dic = RL
Ethreshold_ic = Eic*Dic/RL # GeV
# Pair production
Ethreshold_gg=(me)**2/Eebl *1e-3 #GeV
lambda_gg=0.8 # (E_gamma/1TeV)^-1 Gpc (from Durrer and Neronov 2013)

# usefull integrand
def comobileTime(z):
   return -1/(H0*(1+z)*sqrt(omegaM*(1+z)**3+omegaK*(1+z)**2+omegaL))

def distPhoton(z):
   return -c/(H0*a0*sqrt(omegaM*(1+z)**3+omegaK*(1+z)**2+omegaL))

def distLepton(z,E):
   beta = sqrt(1-m**2*c**4/E**2)
   return -beta*c/(H0*a0*sqrt(omegaM*(1+z)**3+omegaK*(1+z)**2+omegaL))