4 import matplotlib.pyplot 
as plt
 
    5 import scipy.constants 
as const
 
    6 from scipy.integrate 
import quad
 
   13           Class to calculate the charged particle neutrino-nucleon cross sections 
   14           and average cross sections. 
   39         self.
T_grid = np.array([2.8e0,3.5e0,4.0e0,5.0e0,6.4e0,8.0e0,10.0e0])
 
   44           Correction for weak magnetism and recoil according to Horowitz 2002 
   45           (https://ui.adsabs.harvard.edu/abs/2002PhRvD..65d3001H/abstract, Equation 22). 
   56         R = cv**2*(1+4*E+16/3.*E**2)+3*ca**2*(1+4/3*E)**2
 
   59             R = R + 4*(cv+F2)*ca*E*(1+4/3*E)
 
   61             R = R - 4*(cv+F2)*ca*E*(1+4/3*E)
 
   62         R = R + 8/3*cv*F2*E**2
 
   63         R = R+5/3*E**2*(1+2/5*E)*F2**2
 
   65         denom = ((cv**2+3*ca**2)*(1+2*E)**3)
 
   73           Calculate the electron neutrino cross section according to Equation 10 of 
   74           Burrows et al. 2006 (https://ui.adsabs.harvard.edu/abs/2006NuPhA.777..356B/abstract). 
   75           Outputs the cross section in 10^42 cm^2. 
   78         res = res * (1-(self.
mec2/(E+self.
Dnp))**2.0)**(0.5)*self.
WM(E,0)
 
   81     def WM(self,E,mode=0):
 
   83           Weak magnetism and recoil corrections. 
   84           Mode 0 returns a higher order of this correction according to Horowitz 2002, 
   85           mode 1 returns a simplified value of Burrows et al. 2006. 
   88             res = self.
__cor(E,
True)
 
   90             res = 1+1.1*E/self.
mnc2 
   92             raise ValueError(
"Mode not defined!")
 
   99           Calculate the electron anti neutrino cross section according to Equation 11 of 
  100           Burrows et al. 2006 (https://ui.adsabs.harvard.edu/abs/2006NuPhA.777..356B/abstract). 
  101           Outputs the cross section in 10^42 cm^2. 
  104         res = res * (1-(self.
mec2/(E-self.
Dnp))**2.0)**(0.5)*self.
WMbar(E,0)
 
  111          Weak magnetism and recoil corrections. 
  112          Mode 0 returns a higher order of this correction according to Horowitz 2002, 
  113          mode 1 returns a simplified value of Burrows et al. 2006. 
  116             res = self.
__cor(E,
False)
 
  118             res = 1-7.1*E/self.
mnc2 
  120             raise ValueError(
"Mode not defined!")
 
  127           Calculate the Fermi-Dirac distribution. 
  129         res = E**2/(1+np.exp(E/T))
 
  135           Calculate the average neutrino cross section: 
  137           The average neutrino cross section is calculated according 
  138           to the integral of the cross sections multiplied by the normalized 
  139           Fermi-Dirac distribution. 
  142         result, _ = quad(integrand, 0, np.inf)
 
  146         result2, _ = quad(integrand, 0, np.inf)
 
  148         return result/result2
 
  152           Calculate the average energy of the absorped neutrino for the reaction: 
  156         result, _ = quad(integrand, 0, np.inf)
 
  159         result2, _ = quad(integrand, 0, np.inf)
 
  162         return (result/result2)/result3
 
  167           Calculate the average energy of the absorped neutrino for the reaction: 
  168             bar(nu)_e + p -> n + positron 
  171         result, _ = quad(integrand, self.
Dnp+self.
mec2, np.inf)
 
  174         result2, _ = quad(integrand, self.
Dnp+self.
mec2, np.inf)
 
  177         return (result/result2)/result3
 
  182           Calculate the average neutrino cross section: 
  183             bar(nu)_e + p -> n + positron 
  184           The average neutrino cross section is calculated according 
  185           to the integral of the cross sections multiplied by the normalized 
  186           Fermi-Dirac distribution. 
  189         result, _ = quad(integrand, self.
Dnp+self.
mec2, np.inf)
 
  193         result2, _ = quad(integrand, self.
Dnp+self.
mec2, np.inf)
 
  194         return result/result2
 
  199           Create the WinNet file with the calculated cross sections 
  200           and the average energy of the absorped neutrino. 
  207         out = 
"         n    p                             nen"+
"\n" 
  210         for ind,T 
in enumerate(Tgrid):
 
  216         for ind,T 
in enumerate(Tgrid):
 
  221         out += 
"         p    n                            nebp"+
"\n" 
  223         for ind,T 
in enumerate(Tgrid):
 
  229         for ind,T 
in enumerate(Tgrid):
 
  235         with open(file_name,
"w") 
as f:
 
  240 if __name__ == 
"__main__":
 
  242       Create the cross section file when executing this script. 
  243       Furthermore, plot the cross sections for a range of temperatures. 
  246     filename_crosssection     = 
"neunucleons.dat" 
  249     n_class.create_WinNet_file_cross_section(filename_crosssection)
 
  252     fig = plt.figure(figsize=(5,3))
 
  257     T_more = np.linspace(2,13.0,n_temp)
 
  258     nu     = np.zeros(n_temp)
 
  259     anu    = np.zeros(n_temp)
 
  260     for ind,T 
in enumerate(T_more):
 
  261         nu[ind]  = n_class.sigma_avg_nu_n(T)
 
  262         anu[ind] = n_class.sigma_avg_anu_p(T)
 
  265     plt.plot(T_more,nu,label=
r"$\nu_e n$")
 
  266     plt.plot(T_more,anu,label=
r"$\bar{\nu}_e p$")
 
  269     Tgrid = np.array([2.8e0,3.5e0,4.0e0,5.0e0,6.4e0,8.0e0,10.0e0])
 
  270     nu     = np.zeros(len(Tgrid))
 
  271     anu    = np.zeros(len(Tgrid))
 
  272     for ind,T 
in enumerate(Tgrid):
 
  273         nu[ind]  = n_class.sigma_avg_nu_n(T)
 
  274         anu[ind] = n_class.sigma_avg_anu_p(T)
 
  277     plt.scatter(Tgrid,nu,facecolors=
'none',edgecolors=
'k')
 
  278     plt.scatter(Tgrid,anu,facecolors=
'none',edgecolors=
'k')
 
  281     plt.xlabel(
"T [MeV]")
 
  282     plt.ylabel(
r"$<\sigma> (10^{-42}$ cm$^2)$")