65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
import numpy as np
|
|
import os
|
|
import sys
|
|
from astropy import units as u
|
|
import matplotlib
|
|
import matplotlib.pyplot as plt
|
|
|
|
homebase = os.getenv('HOMEBASE')
|
|
if homebase == None:
|
|
homebase = "/home/jonas/new_workspace/Coding/ACRONYM/acronym"
|
|
|
|
includes = homebase + "/src/grpic/boundaries_3d"
|
|
|
|
sys.path.append(includes)
|
|
|
|
import precalculation.functions.plasmaFunctions as plasmaFuncs
|
|
import analysis.plotDataFromAcronym.plot_standards as pltStd
|
|
|
|
import precalculation.functions.importDataFromKarl as karl
|
|
|
|
# Input
|
|
# =======================
|
|
|
|
thesis_path = "/home/jonas/new_workspace/notes/katrin-plasma/docs/phd/jkellerer"
|
|
output_file = thesis_path+"/fig/Chapter4_KARL/ZeroElectricFieldCase/density.pdf"
|
|
|
|
karl_data_dir = "/home/jonas/new_workspace/Coding/KARL/calcs/thesis_plots/sim_data/sim1/"
|
|
karl_filename = "df_part_e.csv"
|
|
|
|
# Calculation
|
|
# =======================
|
|
|
|
data = karl.KarlParticleData(karl_data_dir, karl_filename)
|
|
density_distribution_center = data.getDensityDistribution(z_pos=5)
|
|
density_distribution_rw = data.getDensityDistribution(z_pos=-3)
|
|
|
|
energies = density_distribution_center['Emid']
|
|
densities_center = density_distribution_center['n'] * 1E-6
|
|
densities_rw = density_distribution_rw['n'] * 1E-6
|
|
|
|
# Plot
|
|
# =======================
|
|
|
|
pltStd.setRcParams()
|
|
prop_cycle = plt.rcParams['axes.prop_cycle']
|
|
colors = prop_cycle.by_key()['color']
|
|
|
|
(width, height) = pltStd.set_size('thesis')
|
|
fig, ax = plt.subplots(1, 1, figsize=(width, height))
|
|
|
|
#data.plotDensityDistribution(fig=fig, ax=ax)
|
|
|
|
ax.plot(energies, densities_center, label='Center')
|
|
ax.plot(energies, densities_rw, label='Rearwall')
|
|
|
|
ax.set_xscale('log')
|
|
ax.set_yscale('log')
|
|
ax.set_xlabel(r'Energy $E$ [eV]')
|
|
ax.set_ylabel(r'Diff. energy spectrum $\frac{\partial n}{\partial E}$ $\left[ \frac{1}{cm^3 eV}\right]$')
|
|
|
|
ax.legend()
|
|
|
|
plt.show()
|
|
|
|
fig.savefig(output_file,bbox_inches='tight') |