Skip to content

Commit

Permalink
Model.plot_movie(**kwargs): Pass to png_to_gif()
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed May 3, 2023
1 parent 23badbd commit dd1adea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/trusspy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ def plot_movie(
nodesize=10,
cbar_limits="auto",
incs="all",
**kwargs,
):
p_movie(
self,
Expand All @@ -719,6 +720,7 @@ def plot_movie(
nodesize,
cbar_limits,
incs,
**kwargs,
)

def plot_history(
Expand Down
4 changes: 2 additions & 2 deletions src/trusspy/tools/movie_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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
)
3 changes: 2 additions & 1 deletion src/trusspy/tools/plot_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def p_movie(
nodesize=10,
cbar_limits="auto",
incs="all",
**kwargs,
):
if incs == "all":
if self.Settings.nsteps > 1:
Expand All @@ -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):
Expand Down

0 comments on commit dd1adea

Please sign in to comment.