From dd1adeaaebc814e22dda1596f4372aec0d951190 Mon Sep 17 00:00:00 2001 From: Andreas Dutzler Date: Wed, 3 May 2023 21:33:19 +0200 Subject: [PATCH] `Model.plot_movie(**kwargs)`: Pass to `png_to_gif()` --- src/trusspy/model.py | 2 ++ src/trusspy/tools/movie_generator.py | 4 ++-- src/trusspy/tools/plot_utilities.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/trusspy/model.py b/src/trusspy/model.py index 89b91c7..764a255 100644 --- a/src/trusspy/model.py +++ b/src/trusspy/model.py @@ -708,6 +708,7 @@ def plot_movie( nodesize=10, cbar_limits="auto", incs="all", + **kwargs, ): p_movie( self, @@ -719,6 +720,7 @@ def plot_movie( nodesize, cbar_limits, incs, + **kwargs, ) def plot_history( diff --git a/src/trusspy/tools/movie_generator.py b/src/trusspy/tools/movie_generator.py index 5a302c6..3510c7b 100644 --- a/src/trusspy/tools/movie_generator.py +++ b/src/trusspy/tools/movie_generator.py @@ -11,7 +11,7 @@ import imageio -def png_to_gif(workdir=r"figures/", png_subdir=r"png/", gif_subdir=r"gif/"): +def png_to_gif(workdir=r"figures/", png_subdir=r"png/", gif_subdir=r"gif/", **kwargs): png_dir = workdir + png_subdir gif_dir = workdir + gif_subdir images = [] @@ -25,5 +25,5 @@ def png_to_gif(workdir=r"figures/", png_subdir=r"png/", gif_subdir=r"gif/"): file_path = os.path.join(png_dir, file_name) images.append(imageio.imread(file_path)) imageio.mimwrite( - gif_dir + r"movie.gif", images, duration=5 / 1000, subrectangles=True + gif_dir + r"movie.gif", images, subrectangles=True, **kwargs ) diff --git a/src/trusspy/tools/plot_utilities.py b/src/trusspy/tools/plot_utilities.py index eb428fa..f2691c4 100644 --- a/src/trusspy/tools/plot_utilities.py +++ b/src/trusspy/tools/plot_utilities.py @@ -218,6 +218,7 @@ def p_movie( nodesize=10, cbar_limits="auto", incs="all", + **kwargs, ): if incs == "all": if self.Settings.nsteps > 1: @@ -244,7 +245,7 @@ def p_movie( plt.savefig("figures/png/fig_{:03d}.png".format(i), dpi=200) plt.close("all") - png_to_gif() + png_to_gif(**kwargs) def p_path(self, nodepath, increment=-1, Y="Displacement X", fig=None, ax=None):