Skip to content
Snippets Groups Projects
Commit 6fdbbe58 authored by David Kreplin's avatar David Kreplin
Browse files

corrected paths

parent 05409134
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -14,6 +14,8 @@ from sklearn.kernel_ridge import KernelRidge
# potential squlearn qnn import!
import random
import os
# Environment for reinforcement training
import gym
from gym import spaces
......@@ -145,9 +147,8 @@ class ScoreEnv(gym.Env):
self._num_qubits = num_qubits
self._num_features = num_features
import os
files = os.listdir("frames")
files = os.listdir(os.path.abspath("frames"))
# Iterate through each file
for file in files:
......@@ -335,6 +336,8 @@ class Game(AbstractGame):
self.run_counter = 0
self.action_counter = 0
def step(self, action):
"""
Apply action to the game.
......@@ -402,7 +405,8 @@ class Game(AbstractGame):
num_features=self.env._num_features,
)
filename = f".\\frames\\frame_{self.frame_counter:03d}.png"
filename = f"frames/frame_{self.frame_counter:03d}.png"
filename = os.path.abspath(filename)
plt.figure()
# plt.autoscale(tight=True)
......
......@@ -9,6 +9,7 @@ from IPython.display import HTML
def get_animation():
image_folder = "frames"
image_folder = os.path.abspath(image_folder)
# Get all image filenames from the folder
image_files = sorted(
......@@ -64,6 +65,6 @@ def get_animation():
# Create animation
ani = animation.FuncAnimation(fig, update, frames=len(frames), interval=1000)
ani.save("images/animation.mp4", writer="ffmpeg")
ani.save(os.path.abspath("images/animation.mp4"), writer="ffmpeg")
return HTML('<video height="400" controls>\n<source src="images/animation.mp4" type="video/mp4">\nYour browser does not support the video tag.</video>')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment