Skip to content

Commit

Permalink
PEP8 mods
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpalms committed Aug 13, 2022
1 parent 2c13342 commit 5137480
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions diambra/arena/utils/gym_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ def nested_dict_obs_space(space, k_list=[], level=0):
if isinstance(v, gym.spaces.dict.Dict):
k_list = k_list[0:level]
k_list.append(k)
nested_dict_obs_space(v, k_list, level=level+1)
nested_dict_obs_space(v, k_list, level=level + 1)
else:
k_list = k_list[0:level]
out_string = "observation_space"
indentation = " "*level
indentation = " " * level
for idk in k_list:
out_string += "[\"{}\"]".format(idk)
out_string += "[\"{}\"]".format(k)
out_string = indentation+out_string+":"
out_string = indentation + out_string + ":"
print(out_string, v)
if isinstance(v, gym.spaces.MultiDiscrete):
print(indentation+"Space size:", v.nvec.shape)
print(indentation + "Space size:", v.nvec.shape)
elif isinstance(v, gym.spaces.Discrete):
pass
elif isinstance(v, gym.spaces.Box):
Expand Down Expand Up @@ -161,10 +161,10 @@ def show_gym_obs(observation, char_list, wait_key=1, viz=True):
observation["frame"].shape)

if viz:
obs = np.array(observation["frame"]).astype(np.float32)/255
obs = np.array(observation["frame"]).astype(np.float32) / 255
else:
if viz:
obs = np.array(observation).astype(np.float32)/255
obs = np.array(observation).astype(np.float32) / 255

if viz:
cv2.imshow("Frame", obs[:, :, ::-1]) # rgb2bgr
Expand Down Expand Up @@ -205,7 +205,7 @@ def show_wrap_obs(observation, n_actions_stack, char_list, wait_key=1, viz=True)

if viz:
for idx in range(obs.shape[2]):
cv2.imshow("Frame-"+str(idx), obs[:, :, idx])
cv2.imshow("Frame-" + str(idx), obs[:, :, idx])

cv2.waitKey(wait_key)

Expand Down

0 comments on commit 5137480

Please sign in to comment.