Skip to content
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

Creating Gif via replay episode returns an error #569

Closed
ML-IEE opened this issue Dec 8, 2023 · 2 comments
Closed

Creating Gif via replay episode returns an error #569

ML-IEE opened this issue Dec 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ML-IEE
Copy link

ML-IEE commented Dec 8, 2023

Environment

  • Grid2op version: 1.9.5

Bug description

Hey, I am not quite sure whether or not this might already been fixed in the newer versions, however in Grid2Op v1.9.5 I was not able to create a gif due to the depriciated argument "fps". I could not see in the Release note, whether this was fixed.

How to reproduce

The code is quite similar to the plotting example
In the following example we import the results from an Runner

import grid2op
from grid2op.Episode import EpisodeReplay
env = grid2op.make("l2rpn_wcci_2022")

plot_epi = EpisodeReplay("path")
plot_epi.replay_episode("2050-08-08_5",gif_name = "08-08-05",
                        start_step = 385, end_step = 700)

Possible Error

As far as I can see the error is due to the depreciated fps argument in the .replay_episode() method

imageio.mimwrite(gif_path, frames, fps=fps)

Proposed fix

The fix is rather simple. Just use duration instead of fps

imageio.mimwrite(gif_path, frames, duration=1000/fps)
@ML-IEE ML-IEE added the bug Something isn't working label Dec 8, 2023
@BDonnot
Copy link
Collaborator

BDonnot commented Jan 10, 2024

Hi,

Thanks for noticing it. I added a try / catch block to make sure the old behaviour is still correct on most ancient imageio version, but beside that your fix seems good :-)

Thanks !

@BDonnot BDonnot mentioned this issue Jan 26, 2024
@BDonnot
Copy link
Collaborator

BDonnot commented Jan 26, 2024

Should be solved in 1.9.8

@BDonnot BDonnot closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants