adtzlr / trusspy

Nonlinear Truss Solver for Python
http://trusspy.readthedocs.io/
GNU General Public License v3.0
53 stars 11 forks source link

The keyword `fps` is no longer supported. Use `duration`(in ms) instead #39

Closed AlanRvk closed 1 year ago

AlanRvk commented 1 year ago

Output exceeds the size limit. Open the full output data in a text editor--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[40], line 2 1 # show results ----> 2 M.plot_movie( 3 config=["deformed"], 4 view="xz", 5 contour="force", 6 lim_scale=(-0.5, 3.5, -2, 2), 7 force_scale=1.0, 8 cbar_limits=[-1, 1], 9 )

File [~(removedforprivacy)....site-packages/trusspy/model.py:712), in Model.plot_movie(self, config, view, contour, lim_scale, force_scale, nodesize, cbar_limits, incs) 701 def plot_movie( 702 self, 703 config="both", (...) 710 incs="all", 711 ): --> 712 p_movie( 713 self, 714 config, 715 view, 716 contour, ... 326 save_args = { 327 "format": format or Image.registered_extensions()[extension], 328 }

TypeError: The keyword fps is no longer supported. Use duration(in ms) instead, e.g. fps=50 == duration=20 (1000 * 1/50).

adtzlr commented 1 year ago

Hi @AlanRvk and thanks for reporting!

If I set the duration instead of fps, then I have to use seconds and not milliseconds. Did that change in newer versions of imageio? I have 2.22.1 installed.

Edit

Okay, in 2.28.1 one has to use milliseconds. ~I'll figure out in which version the change was made and set the duration either in s or ms.~ I'll remove the pre-defined fps and duration values completely as I don't want to maintain that mess. Instead, optional keyword arguments are passed to the underlying png_to_gif(**kwargs)-call in Model.plot_movie(**kwargs). Then, its up to the user to look into the docs of imageio and set the desired duration.

Model.plot_movie(duration=1000 * 1 / 5)