Analytic.py 587 Bytes
from Constants import me, Ecmb, Eic, lambda_gg, degre, RL, Dic
from numpy import sqrt, abs, sin, arcsin
from Read import ReadE_source, ReadD_source, ReadEGMF

def Analytic_flux(E_ic):
   return  me*1e3/4*sqrt(3e9/Ecmb)*1e-9*sqrt(E_ic) #GeV

def Analytic_theta(E,fileId):
   Esource=ReadE_source(fileId)*1e-3#TeV
   Dsource=ReadD_source(fileId) #Mpc
   B=ReadEGMF(fileId) #Gauss
   delta_to_theta=(lambda_gg/Esource*1e3)/Dsource
   RL0=RL*(Esource/2)*(1e-17/B)
   Dic0=Dic/(Esource/2)
   delta=Dic0/(2*RL0)*((Esource/2)**2 *Eic/E-1)
   return abs(arcsin(delta_to_theta*sin(delta))*degre)