Skip to content

minor update #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion uxsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .analyzer import *
from .scenario_reader_writer import *

__version__ = "1.7.5"
__version__ = "1.7.6"
__author__ = "Toru Seo"
__copyright__ = "Copyright (c) 2023 Toru Seo"
__license__ = "MIT License"
8 changes: 5 additions & 3 deletions uxsim/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ def show_simulation_progress(s):
print(f"{s.W.TIME:>8.0f} s| {sum_vehs:>8.0f} vehs| {avev:>4.1f} m/s| {time.time()-s.W.sim_start_time:8.2f} s", flush=True)

@catch_exceptions_and_warn()
def network_anim(s, animation_speed_inverse=10, detailed=0, state_variables="density_speed", minwidth=0.5, maxwidth=12, left_handed=1, figsize=(6,6), node_size=2, network_font_size=20, timestep_skip=24, file_name=None):
def network_anim(s, animation_speed_inverse=10, detailed=0, state_variables="density_speed", minwidth=0.5, maxwidth=12, left_handed=1, figsize=(6,6), node_size=2, network_font_size=20, timestep_skip=24, file_name=None, legend=True):
"""
Generates an animation of the entire transportation network and its traffic states over time.

Expand Down Expand Up @@ -1163,6 +1163,8 @@ def network_anim(s, animation_speed_inverse=10, detailed=0, state_variables="den
How many timesteps are skipped per frame. Large value means coarse and lightweight animation. Default is 8.
file_name : str, optional
The name of the file to which the animation is saved. It overrides the defauld name. Default is None.
legend : bool, optional
If set to True, the legend will be displayed. Default is True.

Notes
-----
Expand All @@ -1184,10 +1186,10 @@ def network_anim(s, animation_speed_inverse=10, detailed=0, state_variables="den
if int(t/s.W.LINKS[0].edie_dt) < s.W.LINKS[0].k_mat.shape[0]:
if detailed:
#todo_later: 今後はこちらもpillowにする
s.network(int(t), detailed=detailed, state_variables=state_variables, minwidth=minwidth, maxwidth=maxwidth, left_handed=left_handed, tmp_anim=1, figsize=figsize, node_size=node_size, network_font_size=network_font_size)
s.network(int(t), detailed=detailed, state_variables=state_variables, minwidth=minwidth, maxwidth=maxwidth, left_handed=left_handed, tmp_anim=1, figsize=figsize, node_size=node_size, network_font_size=network_font_size, legend=legend)
pics.append(Image.open(f"out{s.W.name}/tmp_anim_{t}.png"))
else:
img_ret = s.network_pillow(int(t), detailed=detailed, state_variables=state_variables, minwidth=minwidth, maxwidth=maxwidth, left_handed=left_handed, tmp_anim=1, figsize=figsize, node_size=node_size, network_font_size=network_font_size, image_return=True)
img_ret = s.network_pillow(int(t), detailed=detailed, state_variables=state_variables, minwidth=minwidth, maxwidth=maxwidth, left_handed=left_handed, tmp_anim=1, figsize=figsize, node_size=node_size, network_font_size=network_font_size, image_return=True, legend=legend)
pics.append(img_ret)

fname = f"out{s.W.name}/anim_network{detailed}.gif"
Expand Down