diff --git a/latex/images/3d_plot.pdf b/latex/images/3d_plot.pdf index 78b115e..98a1825 100644 Binary files a/latex/images/3d_plot.pdf and b/latex/images/3d_plot.pdf differ diff --git a/latex/images/particles_left.pdf b/latex/images/particles_left.pdf index cc065d4..b158c7e 100644 Binary files a/latex/images/particles_left.pdf and b/latex/images/particles_left.pdf differ diff --git a/latex/images/phase_space_2_particles_x.pdf b/latex/images/phase_space_2_particles_x.pdf index 7af3a9c..a344069 100644 Binary files a/latex/images/phase_space_2_particles_x.pdf and b/latex/images/phase_space_2_particles_x.pdf differ diff --git a/latex/images/phase_space_2_particles_z.pdf b/latex/images/phase_space_2_particles_z.pdf index 86fe6c3..daf1f69 100644 Binary files a/latex/images/phase_space_2_particles_z.pdf and b/latex/images/phase_space_2_particles_z.pdf differ diff --git a/latex/images/plot_2_particles_xy.pdf b/latex/images/plot_2_particles_xy.pdf index 8e44ccd..5203fbc 100644 Binary files a/latex/images/plot_2_particles_xy.pdf and b/latex/images/plot_2_particles_xy.pdf differ diff --git a/latex/images/single_particle.pdf b/latex/images/single_particle.pdf index cf0ee5a..760b65c 100644 Binary files a/latex/images/single_particle.pdf and b/latex/images/single_particle.pdf differ diff --git a/latex/main.pdf b/latex/main.pdf deleted file mode 100644 index 1ce8a25..0000000 Binary files a/latex/main.pdf and /dev/null differ diff --git a/src/scripts/plot_2_particles.py b/src/scripts/plot_2_particles.py index 17f327c..be7838b 100644 --- a/src/scripts/plot_2_particles.py +++ b/src/scripts/plot_2_particles.py @@ -1,5 +1,19 @@ import matplotlib.pyplot as plt import numpy as np +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def main(): files = [ @@ -29,10 +43,10 @@ def main(): plt.xlabel(r"x $(\mu m)$") plt.ylabel(r"y $(\mu m)$") - plt.title(r"2 particles with and without interactions.") - # plt.legend() - # plt.show() - plt.savefig("../latex/images/plot_2_particles_xy.pdf") + # plt.title(r"2 particles with and without interactions.") + plt.legend(loc="upper right") + plt.savefig("../latex/images/plot_2_particles_xy.pdf", bbox_inches="tight") + plt.show() if __name__ == "__main__": diff --git a/src/scripts/plot_3d.py b/src/scripts/plot_3d.py index 535a27a..6aad06c 100644 --- a/src/scripts/plot_3d.py +++ b/src/scripts/plot_3d.py @@ -1,5 +1,19 @@ import matplotlib.pyplot as plt import numpy as np +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def main(): files = [ diff --git a/src/scripts/plot_particles_left.py b/src/scripts/plot_particles_left.py index 85bfd78..9884cd2 100644 --- a/src/scripts/plot_particles_left.py +++ b/src/scripts/plot_particles_left.py @@ -1,6 +1,28 @@ import matplotlib.pyplot as plt +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def main(): + colors = [ + "lightskyblue", + "deepskyblue", + "salmon", + "tomato", + "mediumaquamarine", + "mediumseagreen" + ] with open("output/time_dependent_potential/res.txt") as f: lines = f.readlines() x = [] @@ -14,17 +36,22 @@ def main(): y2.append(float(l[2])) y3.append(float(l[3])) - plt.plot(x,y1,label=f"amplitude: 0.1") - plt.plot(x,y2,label=f"amplitude: 0.4") - plt.plot(x,y3,label=f"amplitude: 0.7") + fig, ax = plt.subplots() + ax.plot(x, y1, label=r"$f_{1} = 0.1$", color=colors[0]) + ax.plot(x, y2, label=r"$f_{2} = 0.4$", color=colors[2]) + ax.plot(x, y3, label=r"$f_{3} = 0.7$", color=colors[4]) + + ax.set_xlabel(r"Frequency $\omega_V$ (MHz)") + ax.set_xlim((0, 2.8)) + ax.set_ylabel(r"Fraction of particles left") + ax.set_ylim((-0.1, 1.1)) + # plt.title(r"The fraction of particles left in the Penning trap " + # "after 500 microseconds for different amplitudes and frequencies") + + ax.legend(loc="upper right") - plt.xlabel(r"$\omega_V$ (MHz)") - plt.ylabel(r"Fraction of particles left") - plt.title(r"The fraction of particles left in the Penning trap " - "after 500 microseconds for different amplitudes and frequencies") - plt.legend() # plt.show() - plt.savefig("../latex/images/particles_left.pdf") + fig.savefig("../latex/images/particles_left.pdf", bbox_inches="tight") if __name__ == "__main__": main() diff --git a/src/scripts/plot_phase_space.py b/src/scripts/plot_phase_space.py index 5a4c3ac..849dbfe 100644 --- a/src/scripts/plot_phase_space.py +++ b/src/scripts/plot_phase_space.py @@ -1,5 +1,19 @@ import matplotlib.pyplot as plt import numpy as np +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def main(): directories = { @@ -21,7 +35,7 @@ def main(): r"particle 1 v", r"particle 2 r", r"particle 2 v", - ] + ] colors = [ "lightskyblue", "deepskyblue", @@ -44,9 +58,9 @@ def main(): axs1[i].legend() axs1[i].set_title(title) - # plt.show() fig1.savefig("../latex/images/phase_space_2_particles_x.pdf") fig2.savefig("../latex/images/phase_space_2_particles_z.pdf") + plt.show() if __name__ == "__main__": diff --git a/src/scripts/plot_relative_error.py b/src/scripts/plot_relative_error.py index 54214c8..10106af 100644 --- a/src/scripts/plot_relative_error.py +++ b/src/scripts/plot_relative_error.py @@ -1,5 +1,19 @@ import matplotlib.pyplot as plt import numpy as np +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def main(): directories = { @@ -22,7 +36,7 @@ def main(): "Relative error for the RK4 method", "Relative error for the forward Euler method" ] - fig1, axs1 = plt.subplots(2,1) + fig1, axs1 = plt.subplots(2,1, sharex=True) for i, (dir, title) in enumerate(zip(directories, titles)): max_err = [] for label, file in zip(labels, files): @@ -33,17 +47,17 @@ def main(): max_err.append(max(r)) axs1[i].plot(t, r, label=label) - axs1[i].set(xlabel=r"t $(\mu s)$", ylabel = r"relative_error $(\mu m)$") + axs1[i].set(ylabel = r"relative_error $(\mu m)$") # xlabel=r"t $(\mu s)$", - + axs1[1].set_xlabel(r"t $(\mu s)$") axs1[i].legend() - axs1[i].set_title(title) + # axs1[i].set_title(title) conv_rate = 1/3 * sum([np.log10(max_err[i+1]/max_err[i])/np.log10(.5) for i in range(3)]) print(conv_rate) - plt.show() # fig1.savefig("../latex/images/phase_space_2_particles_x.pdf") + plt.show() if __name__ == "__main__": diff --git a/src/scripts/plot_single_particle.py b/src/scripts/plot_single_particle.py index f4bdc6a..6ee2d16 100644 --- a/src/scripts/plot_single_particle.py +++ b/src/scripts/plot_single_particle.py @@ -1,5 +1,19 @@ import matplotlib.pyplot as plt import numpy as np +import seaborn as sns + +sns.set_theme() +params = { + "font.family": "Serif", + "font.serif": "Roman", + "text.usetex": True, + "axes.titlesize": "large", + "axes.labelsize": "large", + "xtick.labelsize": "large", + "ytick.labelsize": "large", + "legend.fontsize": "medium" +} +plt.rcParams.update(params) def z(t): V_0 = 25.*9.64852558 * 10**4 @@ -9,6 +23,14 @@ def z(t): return 20.*np.cos(w_z*t) def main(): + colors = [ + "lightskyblue", + "deepskyblue", + "salmon", + "tomato", + "mediumaquamarine", + "mediumseagreen" + ] filename = "output/simulate_single_particle/particle_0_r.txt" r = t = [] with open(filename) as f: @@ -16,14 +38,17 @@ def main(): t = np.linspace(0, 50, len(lines)) r = np.array([list(map(float, line.strip().split(","))) for line in lines]) - plt.plot(t, r[:, 2], label="approximation") - plt.plot(t, z(t), label="analytical") - plt.xlabel(r"time $(\mu s)$") - plt.ylabel(r"z $(\mu m)$") - plt.title(r"Movement of a single particle in the x direction") - plt.legend() - # plt.savefig("../latex/images/single_particle.pdf") - plt.show() + fig, ax = plt.subplots() + ax.plot(t, r[:, 2], label="approximation", color=colors[3]) + ax.plot(t, z(t), label="analytical", color=colors[5], linestyle="dotted") + ax.set_xlabel(r"Time $(\mu s)$") + ax.set_xlim((-5, 55)) + ax.set_ylabel(r"z $(\mu m)$") + ax.set_ylim((-25, 25)) + # plt.title(r"Movement of a single particle in the x direction") + ax.legend(loc="upper right") + fig.savefig("../latex/images/single_particle.pdf", bbox_inches="tight") + # plt.show() if __name__ == "__main__":