Files
katrin-plasma/src/mcelectron-precalculation/cross_sections/Untitled.ipynb
T
2020-08-03 10:53:12 +02:00

16 KiB

In [1]:
import numpy as np
import pandas as pd
import os
import sys
from scipy import interpolate
from scipy.optimize import curve_fit
from scipy.stats import chisquare
import scipy.integrate as integrate
In [2]:
import matplotlib.pyplot as plt
%matplotlib inline

import seaborn as sns

NEJM = sns.color_palette(palette = ['#bc3c29',
 '#0072bf',
 '#e18727',
 '#20854e',
 '#7876b1',
 '#6f99ad',
 '#ffdc91',
 '#ee4c97'])
sns.set(
    context='paper', 
    style='white', 
    palette=NEJM, 
    font='sans-serif', 
    font_scale=1, 
    color_codes=False, 
    rc = {'figure.dpi' : 100,
        'text.usetex' : True,
        'axes.labelsize' : 10,
        'xtick.labelsize' : 10, 
        'ytick.labelsize' : 10,
        'legend.fontsize' : 10,
        'xtick.bottom' : True, 
        'xtick.minor.bottom' : False,
        'ytick.left' : True,
        'ytick.minor.left' : False
        })
In [4]:
def Pettersson_eT5I_Recombination(E_eV):
    if (E_eV<0.017):
        return pow(10,-18.87) * pow(E_eV, -1.2)
    elif (E_eV < 0.159):
        return pow(10,-19.93) * pow(E_eV, -1.78)
    elif (E_eV < 1):
        return pow(10,-21.5) * pow(E_eV, -3.75);
    else:
        return 0
    
Pettersson_eT5I_Recombination = np.vectorize(Pettersson_eT5I_Recombination, otypes=[np.float])   
In [63]:
m_eV = 511e3
mI_eV = 5*2.8094320212e9

kb_eVK = 8.6173303e-5
c_ms = 3e8
T = 30
v_therm = np.sqrt(2*kb_eVK*T/mI_eV)*c_ms;
E_limit = m_eV/2*pow(v_therm/c_ms * 20000, 2);
In [139]:
def calc_microSigma_m2(E_eV, lim_fac):
    E_limit = m_eV/2*pow(v_therm/c_ms * lim_fac, 2);
    if (E_eV > E_limit):
        return samplemicro(E_eV)
    else:
        v1_ms = np.sqrt(2*E_eV/m_eV)*c_ms
        def f(theta):
            E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*np.cos(theta)) * pow(c_ms, -2)
            return samplemicro(E_eV)
        Elow_eV = m_eV/2 * pow((v1_ms - v_therm)/c_ms,2)
        Eup_eV = m_eV/2 * pow((v1_ms + v_therm)/c_ms,2)
        return integrate.quad(f, 0, np.pi)[0]/np.pi
calc_microSigma_m2 = np.vectorize(calc_microSigma_m2, otypes=[np.float])   
In [140]:
def samplemicro(E_eV):
    return E_eV**-2
samplemicro = np.vectorize(samplemicro, otypes=[np.float])   
In [141]:
E = pow(10, np.linspace(0,3, 1000))
In [142]:
sig = calc_microSigma_m2(E, 20000)
In [143]:
fig, ax = plt.subplots()
ax.plot(E, sig)
ax.set_xscale('log')
ax.set_yscale('log')
In [ ]: