diff --git a/src/plot_particles_left.py b/src/plot_particles_left.py new file mode 100644 index 0000000..1d9a45c --- /dev/null +++ b/src/plot_particles_left.py @@ -0,0 +1,33 @@ +import matplotlib.pyplot as plt + +def main(): + files = [ + "output/time_dependent_potential/f_0.100000.txt", + "output/time_dependent_potential/f_0.400000.txt", + "output/time_dependent_potential/f_0.700000.txt", + ] + vals = [ + .1, + .4, + .7 + ] + for i in range(3): + with open(files[i]) as f: + lines = f.readlines() + x = [] + y = [] + for line in lines: + a,b = line.strip().split(",") + x.append(float(a)) + y.append(float(b)) + plt.plot(x,y,label=f"amplitude: {vals[i]}") + + plt.xlabel(r"$\omega_V$") + 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() + +if __name__ == "__main__": + main()