From 9ff96544d4779d34ee60e6467a85b78a0bdb450e Mon Sep 17 00:00:00 2001 From: Cory Date: Sun, 8 Oct 2023 00:34:03 +0200 Subject: [PATCH] Rename script --- src/{test.py => animate_100_particles.py} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename src/{test.py => animate_100_particles.py} (80%) diff --git a/src/test.py b/src/animate_100_particles.py similarity index 80% rename from src/test.py rename to src/animate_100_particles.py index a215cad..a62510f 100644 --- a/src/test.py +++ b/src/animate_100_particles.py @@ -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()