Skip to content

Commit

Permalink
Fix animation frames ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
tretre91 committed Jan 21, 2025
1 parent eb8dd5b commit 5b69600
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion projects/01_wave/python/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from matplotlib import *
from matplotlib.pyplot import *
import matplotlib.animation as animation
import re

# ______________________________________________________________________________
# RCParams - personalize the figure output
Expand Down Expand Up @@ -50,7 +51,8 @@

file_list = glob.glob("{}/grid_*.json".format(file_path))

file_list = sorted(file_list)
iter_number_re = re.compile(r"{}/grid_(\d+).json".format(file_path))
file_list = sorted(file_list, key=lambda p: int(iter_number_re.match(p).group(1)))

# ______________________________________________________________________________
# Animation function
Expand Down
4 changes: 3 additions & 1 deletion projects/01_wave/python/animate_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from matplotlib.pyplot import *
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
import re

# ______________________________________________________________________________
# RCParams - personalize the figure output
Expand Down Expand Up @@ -51,7 +52,8 @@

file_list = glob.glob("{}/grid_*.json".format(file_path))

file_list = sorted(file_list)
iter_number_re = re.compile(r"{}/grid_(\d+).json".format(file_path))
file_list = sorted(file_list, key=lambda p: int(iter_number_re.match(p).group(1)))

# ______________________________________________________________________________
# Animation function
Expand Down

0 comments on commit 5b69600

Please sign in to comment.