Rename script

This commit is contained in:
Cory Balaton 2023-10-08 00:34:03 +02:00
parent ad2865c3a2
commit 9ff96544d4
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B

View File

@ -7,11 +7,11 @@ def get_data(files):
res = []
for file in files:
arr = [[], [], []]
with open(file) as f:
with open(file, encoding="utf8") as f:
lines = f.readlines()
for line in lines:
xi,yi,zi = map(lambda x: float(x), line.strip().split(","))
xi,yi,zi = map(float, line.strip().split(","))
arr[0].append(xi)
arr[1].append(yi)
arr[2].append(zi)
@ -27,11 +27,12 @@ def update(num, lines, arr):
def animate():
plt.style.use("dark_background")
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
arr = get_data([f"output/p{i}.txt" for i in range(100)])
arr = get_data([f"output/p{i}_RK4.txt" for i in range(100)])
arr = arr[:,:,::10]
@ -53,7 +54,7 @@ def animate():
blit=False)
# ani.save("100_particles.gif", writer=animation.FFMpegFileWriter(fps=30))
ani.save("100_particles.gif", writer=animation.FFMpegFileWriter(fps=30))
plt.show()