backup save
This commit is contained in:
+68
@@ -0,0 +1,68 @@
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
from astropy import units as u
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
import subprocess
|
||||
|
||||
import matplotlib.colors
|
||||
|
||||
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
|
||||
|
||||
|
||||
# Input
|
||||
# =======================
|
||||
|
||||
|
||||
thesis_path = "/home/jonas/new_workspace/notes/katrin-plasma/docs/phd/jkellerer"
|
||||
output_folder = thesis_path+"/fig/Chapter2_KATRIN/MagneticBackgroundField/"
|
||||
|
||||
data_folder = thesis_path + "/figCode/Chapter2_KATRIN/MagneticBackgroundField/"
|
||||
|
||||
bfield_filename = data_folder + "Bz.dat"
|
||||
z_filename = data_folder + "z_positions.dat"
|
||||
|
||||
|
||||
# Calculation
|
||||
# =======================
|
||||
|
||||
z = np.genfromtxt(z_filename, dtype=float,delimiter=",",usecols=(0))
|
||||
Bz = np.genfromtxt(bfield_filename, dtype=float,delimiter=",",usecols=(0))
|
||||
|
||||
Bz *= -1
|
||||
|
||||
deltaz = 100
|
||||
z_plot = z[0::deltaz] +47.2
|
||||
Bz_plot = Bz[0::deltaz]
|
||||
|
||||
Bz_plot = Bz_plot[z_plot > 0]
|
||||
z_plot = z_plot[z_plot > 0]
|
||||
|
||||
# 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),sharex=True)
|
||||
|
||||
ax.set_xlabel(r'Length $z$ [m]')
|
||||
ax.set_ylabel(r'Magnetic Field $B_z$ [T]')
|
||||
ax.plot(z_plot, Bz_plot)
|
||||
#ax.vlines(0.,0.,6)
|
||||
#ax.set_xlim((-0.1,17.5))
|
||||
|
||||
plt.savefig(output_folder+"Bz_vs_z.pdf",bbox_inches='tight')
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user