Skip to content

Commit

Permalink
adressing issue rte-france#569 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Jan 10, 2024
1 parent 022ba01 commit 3c5196f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Change Log
- [FIXED] `PandapowerBackend`, when no slack was present
- [FIXED] the "BaseBackendTest" class did not correctly detect divergence in most cases (which lead
to weird bugs in failing tests)
- [FIXED] an issue with imageio having deprecated the `fps` kwargs (see https://github.com/rte-france/Grid2Op/issues/569)
- [ADDED] A type of environment that does not perform the "emulation of the protections"
for some part of the grid (`MaskedEnvironment`) see https://github.com/rte-france/Grid2Op/issues/571
- [IMPROVED] the CI speed: by not testing every possible numpy version but only most ancient and most recent
Expand Down
13 changes: 9 additions & 4 deletions grid2op/Episode/EpisodeReplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def replay_episode(
load_info: ``str``
Defaults to "p". What kind of values to show on loads.
Can be oneof `["p", "v", None]`
Can be one of `["p", "v", None]`
gen_info: ``str``
Defaults to "p". What kind of values to show on generators.
Can be oneof `["p", "v", None]`
Can be one of `["p", "v", None]`
line_info: ``str``
Defaults to "rho". What kind of values to show on lines.
Can be oneof `["rho", "a", "p", "v", None]`
Can be one of `["rho", "a", "p", "v", None]`
resolution: ``tuple``
Defaults to (1280, 720). The resolution to use for the gif.
Expand Down Expand Up @@ -187,7 +187,12 @@ def replay_episode(
# Export all frames as gif if enabled
if gif_name is not None and len(frames) > 0:
try:
imageio.mimwrite(gif_path, frames, fps=fps)
try:
# with imageio > 2.5 you need to compute the duration
imageio.mimwrite(gif_path, frames, duration=1000./fps)
except TypeError:
# imageio <= 2.5 can be given fps directly
imageio.mimwrite(gif_path, frames, fps=fps)
# Try to compress
try:
from pygifsicle import optimize
Expand Down

0 comments on commit 3c5196f

Please sign in to comment.