Coryab/code #10
@ -23,7 +23,18 @@ def main():
|
|||||||
"mediumaquamarine",
|
"mediumaquamarine",
|
||||||
"mediumseagreen"
|
"mediumseagreen"
|
||||||
]
|
]
|
||||||
with open("output/time_dependent_potential/res.txt") as f:
|
files = [
|
||||||
|
"output/time_dependent_potential/wide_sweep.txt",
|
||||||
|
"output/time_dependent_potential/narrow_sweep.txt",
|
||||||
|
"output/time_dependent_potential/narrow_sweep_interactions.txt",
|
||||||
|
]
|
||||||
|
outputs = [
|
||||||
|
"particles_left_wide_sweep.pdf",
|
||||||
|
"particles_left_narrow_sweep.pdf",
|
||||||
|
"particles_left_narrow_sweep_interactions.pdf",
|
||||||
|
]
|
||||||
|
for file, output in zip(files, outputs):
|
||||||
|
with open(file) as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
x = []
|
x = []
|
||||||
y1 = []
|
y1 = []
|
||||||
@ -42,16 +53,16 @@ def main():
|
|||||||
ax.plot(x, y3, label=r"$f_{3} = 0.7$", color=colors[4])
|
ax.plot(x, y3, label=r"$f_{3} = 0.7$", color=colors[4])
|
||||||
|
|
||||||
ax.set_xlabel(r"Frequency $\omega_V$ (MHz)")
|
ax.set_xlabel(r"Frequency $\omega_V$ (MHz)")
|
||||||
ax.set_xlim((0, 2.8))
|
# ax.set_xlim((0, 2.8))
|
||||||
ax.set_ylabel(r"Fraction of particles left")
|
ax.set_ylabel(r"Fraction of particles left")
|
||||||
ax.set_ylim((-0.1, 1.1))
|
# ax.set_ylim((-0.1, 1.1))
|
||||||
# plt.title(r"The fraction of particles left in the Penning trap "
|
# plt.title(r"The fraction of particles left in the Penning trap "
|
||||||
# "after 500 microseconds for different amplitudes and frequencies")
|
# "after 500 microseconds for different amplitudes and frequencies")
|
||||||
|
|
||||||
ax.legend(loc="upper right")
|
ax.legend(loc="upper right")
|
||||||
|
|
||||||
# plt.show()
|
# plt.show()
|
||||||
fig.savefig("../latex/images/particles_left.pdf", bbox_inches="tight")
|
fig.savefig(f"../latex/images/{output}", bbox_inches="tight")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -42,19 +42,19 @@ def main():
|
|||||||
fig2, axs2 = plt.subplots(2,1,sharex=True)
|
fig2, axs2 = plt.subplots(2,1,sharex=True)
|
||||||
for i, (file, label) in enumerate(zip(files, labels)):
|
for i, (file, label) in enumerate(zip(files, labels)):
|
||||||
for j, (dir, linestyle) in enumerate(zip(directories, linestyles)):
|
for j, (dir, linestyle) in enumerate(zip(directories, linestyles)):
|
||||||
|
r = []
|
||||||
|
v = []
|
||||||
with open(dir+file+"_r.txt") as f:
|
with open(dir+file+"_r.txt") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
t = np.linspace(0, 50, len(lines))
|
|
||||||
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
|
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
|
||||||
axs1[i].plot(t, r[:,0], label=f"{label[j]} r", linestyle=linestyle)
|
|
||||||
axs2[i].plot(t, r[:,2], label=f"{label[j]} r", linestyle=linestyle)
|
|
||||||
|
|
||||||
with open(dir+file+"_v.txt") as f:
|
with open(dir+file+"_v.txt") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
t = np.linspace(0, 50, len(lines))
|
v = np.array([list(map(float, line.strip().split(","))) for line in lines])
|
||||||
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
|
axs1[i].plot(r[:,0], v[:,0], label=label[j])
|
||||||
axs1[i].plot(t, r[:,0], label=f"{label[j]} v", linestyle=linestyle)
|
axs2[i].plot(r[:,2], v[:,2], label=label[j])
|
||||||
axs2[i].plot(t, r[:,2], label=f"{label[j]} v", linestyle=linestyle)
|
axs1[i].axis("equal")
|
||||||
|
axs2[i].axis("equal")
|
||||||
|
|
||||||
|
|
||||||
axs1[1].set(xlabel=r"t $(\mu s)$", ylabel = r"x $(\mu m)$")
|
axs1[1].set(xlabel=r"t $(\mu s)$", ylabel = r"x $(\mu m)$")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user