Penning Trap Simulation
Simulate particle behavior inside a Penning Trap
Loading...
Searching...
No Matches
plot_particles_left.py
1import matplotlib.pyplot as plt
2
3def main():
4 files = [
5 "output/time_dependent_potential/f_0.100000.txt",
6 "output/time_dependent_potential/f_0.400000.txt",
7 "output/time_dependent_potential/f_0.700000.txt",
8 ]
9 vals = [
10 .1,
11 .4,
12 .7
13 ]
14 for i in range(3):
15 with open(files[i]) as f:
16 lines = f.readlines()
17 x = []
18 y = []
19 for line in lines:
20 a,b = line.strip().split(",")
21 x.append(float(a))
22 y.append(float(b))
23 plt.plot(x,y,label=f"amplitude: {vals[i]}")
24
25 plt.xlabel(r"$\omega_V$")
26 plt.ylabel(r"Fraction of particles left")
27 plt.title(r"The fraction of particles left in the Penning trap "
28 "after 500 microseconds for different amplitudes and frequencies")
29 plt.legend()
30 plt.show()
31
32if __name__ == "__main__":
33 main()