Plot the amount of particles left in Penning trap
This commit is contained in:
parent
58c9212e5c
commit
3431e09aeb
33
src/plot_particles_left.py
Normal file
33
src/plot_particles_left.py
Normal file
@ -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()
|
||||
Loading…
Reference in New Issue
Block a user