Rename script
This commit is contained in:
parent
ad2865c3a2
commit
9ff96544d4
@ -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()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user