# Penning Trap Simulation: src/scripts/plot_particles_left.py Source File

Loading...
Searching...
No Matches
plot_particles_left.py
import matplotlib.pyplot as plt
def main():
with open("output/time_dependent_potential/res.txt") as f:
lines = f.readlines()
x = []
y1 = []
y2 = []
y3 = []
for line in lines:
l = line.strip().split(",")
x.append(float(l[0]))
y1.append(float(l[1]))
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")
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")
if __name__ == "__main__":
main()