-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_and_plot.py
More file actions
32 lines (24 loc) · 1.03 KB
/
Copy pathload_and_plot.py
File metadata and controls
32 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import numpy as np
import matplotlib.pyplot as plt
from elastic_flow import ElasticFlow
import os
# Initialize grid
N = 300
grid = np.linspace(0, 2 * np.pi, N, False)
# Recreate all plots for the oval
folder = "triple_eight_300_0.5h^2"
curve_folder = f"{folder}/arrays/curve/"
# Get all iteration files
iteration_files = [f for f in os.listdir(curve_folder) if f.endswith('.npy')]
iterations = [int(f.split('.')[0]) for f in iteration_files]
iterations.sort()
for iteration in iterations:
curve_path = f"{curve_folder}{iteration}.npy"
curvature_path = f"{folder}/arrays/curvature/{iteration}.npy"
normal_path = f"{folder}/arrays/normal/{iteration}.npy"
# Initialize ElasticFlow with the loaded curve
elastic_flow = ElasticFlow(grid, [curve_path, curvature_path, normal_path], folder)
# Plot and save the curve without axis
elastic_flow.save(iteration, show_axis=False)
print(f"Iteration {iteration} loaded, plotted, and saved successfully.")
print("All curves loaded, plotted, and saved successfully.")