update validation, B,n variation and stastistics

This commit is contained in:
Jonas Kellerer
2021-05-18 09:47:10 +02:00
parent b9f6c51c32
commit 23df1345a4
15 changed files with 340 additions and 110 deletions
@@ -0,0 +1,100 @@
-3.96 -1.62
-3.88 -2.22
-3.79 -2.13
-3.71 -2.04
-3.63 -1.95
-3.54 -1.86
-3.46 -1.77
-3.38 -1.69
-3.29 -1.61
-3.21 -1.53
-3.13 -1.46
-3.05 -1.39
-2.96 -1.33
-2.88 -1.27
-2.80 -1.22
-2.71 -1.18
-2.63 -1.15
-2.55 -1.13
-2.46 -1.13
-2.38 -1.15
-2.30 -1.19
-2.22 -1.26
-2.13 -1.36
-2.05 -1.49
-1.97 -1.66
-1.88 -1.88
-1.80 -2.15
-1.72 -2.50
-1.63 -2.88
-1.55 -3.24
-1.47 -3.42
-1.39 -3.45
-1.30 -3.49
-1.22 -3.48
-1.14 -3.49
-1.05 -3.50
-0.97 -3.50
-0.89 -3.52
-0.80 -3.53
-0.72 -3.55
-0.64 -3.61
-0.56 -3.69
-0.47 -3.79
-0.39 -3.89
-0.31 -4.00
-0.22 -4.12
-0.14 -4.21
-0.06 -4.30
0.03 -4.42
0.11 -4.55
0.19 -4.67
0.28 -4.82
0.36 -4.90
0.44 -4.98
0.52 -5.04
0.61 -5.06
0.69 -5.07
0.77 -5.09
0.86 -5.14
0.94 -5.32
1.02 -4.58
1.11 -6.06
1.19 -6.24
1.27 -6.55
1.35 -6.89
1.44 -7.10
1.52 -7.31
1.60 -7.27
1.69 -7.35
1.77 -7.47
1.85 -7.43
1.94 -7.62
2.02 -7.66
2.10 -7.66
2.18 -7.71
2.27 -7.67
2.35 -7.51
2.43 -7.75
2.52 -7.72
2.60 -7.66
2.68 -7.58
2.77 -7.42
2.85 -7.52
2.93 -7.38
3.01 -7.35
3.10 -7.18
3.18 -7.16
3.26 -7.18
3.35 -7.10
3.43 -6.92
3.51 -6.89
3.60 -6.90
3.68 -6.82
3.76 -6.74
3.84 -6.72
3.93 -6.91
4.01 -6.90
4.09 -7.11
4.18 -7.37
4.26 -22.88
@@ -0,0 +1,100 @@
#!/bin/python3
import numpy as np
import os
import sys
from astropy import units as u
from astropy import constants as const
import matplotlib
import matplotlib.pyplot as plt
# Specific includes
# =======================
homebase = os.getenv('HOMEBASE')
if homebase is None:
homebase = "/home/jonas/new_workspace/Coding/KARL/karl"
sys.path.append(homebase+"/src/tools/analysis_jkellerer")
from functions.calculate_density_from_karl import *
import functions.plot_standards as pst
# inputs
# =====================
paper_path = "/home/jonas/new_workspace/notes/paper/docs/paper/monte-carlo-electron-spectrum/"
output_folder = paper_path+"/figures/"
filename_Nastoyashchii = paper_path + "/calculations/ComparisonNastoyashchii/data_Nastoyashchii.txt"
folder_karl = "/home/jonas/new_workspace/Coding/Output/LRZ/SCRATCH/KARL/ComparisonNastoyashchii/parameter_20210509_1/"
filename_karl = folder_karl + "mc_electron_out_1391.h5"
z_pos_1 = 8
z_pos_2 = 0
# calculation
# ======================
# data from karl
key = "/Populations/e-/e-"
density_karl = getDensities(filename_karl, key)
zmins = getZBinsMin(filename_karl, key)
zmaxs = getZBinsMax(filename_karl, key)
Emins = getEBinsMin(filename_karl, key)
Emaxs = getEBinsMax(filename_karl, key)
z_index_1 = np.where(zmins <= z_pos_1)[-1][-1]
density_karl_plot_1 = np.mean(density_karl[z_index_1,0,:,:],0) / 1E6
plot_bins = np.dstack((Emins,Emaxs)).flatten()
plot_datas_1 = np.dstack((density_karl_plot_1,density_karl_plot_1)).flatten()
z_index_2 = np.where(zmins <= z_pos_2)[-1][-1]
density_karl_plot_2 = np.mean(density_karl[z_index_2,0,:,:],0) / 1E6
plot_datas_2 = np.dstack((density_karl_plot_2,density_karl_plot_2)).flatten()
# data from Nastoyashchii
data_Nastoyashchii = np.genfromtxt(filename_Nastoyashchii)
energy_Nastoyashchii = 10**data_Nastoyashchii[:,0]
denisty_Nastoyashchii = 10**data_Nastoyashchii[:,1]
denisty_Nastoyashchii = denisty_Nastoyashchii/denisty_Nastoyashchii.max() * 2E4
# plots
# ======================
pst.setRcParams()
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
(width, height) = pst.set_size('thesis')
fig, ax = plt.subplots(1, 1, figsize=(width, height*1.0),sharex=True)
ax.set_facecolor('#e7e7e7ff')
ax.grid(color='white')
ax.set_axisbelow(True)
ax.plot(plot_bins, plot_datas_1, '-', label="KARL, inlet")
ax.plot(plot_bins, plot_datas_2, '--', label="KARL, rear wall")
ax.plot(energy_Nastoyashchii[1:], denisty_Nastoyashchii[1:], '-.', label='Nastoyashchii')
ax.set_ylim(1E-3, density_karl_plot_1.max()*1.2)
ax.set_xlim(1E-5, 18.3E3)
ax.set_yscale('log')
ax.set_xscale('log')
ax.legend()
ax.set_xlabel(r'Energy $E$ [eV]')
ax.set_ylabel(r'Density $n$ [1/cm$^{3}$]')
plt.savefig(output_folder+"comprarison_ndE_Nastoyashchii.pdf",bbox_inches='tight')
plt.show()
@@ -54,8 +54,8 @@ n_max_lau = data_lau[:,4]*1E-6
max_density = 6.337599e20 # 1/m^3
densities_karl = np.array([5E-4, 0.002, 0.02, 1, 0.02])*max_density / 1E6
zs_karl = np.array([-8.2856, -6.57, -5, 0, 5])*100 - z_rw
densities_karl = np.array([5E-4, 0.002, 0.02, 1, 0.02, 0.002, 5E-4])*max_density / 1E6
zs_karl = np.array([-8.2856, -6.57, -5, 0, 5, 6.57, 8.2856])*100 - z_rw
#densities_karl = np.array([5E-4, 0.033, 1, 0.033])*max_density / 1E6
#zs_karl = np.array([-8, -5, 0, 5])*100