Penning Trap Simulation Simulate particle behavior inside a Penning Trap

Loading...
Searching...
No Matches
plot_particles_left.py
1 import matplotlib.pyplot as plt
2
3 def main():
4 with open("output/time_dependent_potential/res.txt") as f:
5 lines = f.readlines()
6 x = []
7 y1 = []
8 y2 = []
9 y3 = []
10 for line in lines:
11 l = line.strip().split(",")
12 x.append(float(l[0]))
13 y1.append(float(l[1]))
14 y2.append(float(l[2]))
15 y3.append(float(l[3]))
16
17 plt.plot(x,y1,label=f"amplitude: 0.1")
18 plt.plot(x,y2,label=f"amplitude: 0.4")
19 plt.plot(x,y3,label=f"amplitude: 0.7")
20
21 plt.xlabel(r"$\omega_V$ (MHz)")
22 plt.ylabel(r"Fraction of particles left")
23 plt.title(r"The fraction of particles left in the Penning trap "
24 "after 500 microseconds for different amplitudes and frequencies")
25 plt.legend()
26 # plt.show()
27 plt.savefig("../latex/images/particles_left.pdf")
28
29 if __name__ == "__main__":
30 main()