Viewers

causal_world.viewers.task_viewer.get_world(task_generator_id, task_params, world_params, enable_visualization=False, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Returns a particular CausalWorld instance with optional wrappers

Parameters
  • task_generator_id – (str) id of the task of the environment

  • task_params – (dict) task params of the environment

  • world_params – (dict) world_params of the environment

  • enable_visualization – (bool) if GUI visualization is enabled

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns

(CausalWorld) a CausalWorld environment instance

causal_world.viewers.task_viewer.record_video(env, policy, file_name, number_of_resets=1, max_time_steps=None)[source]

Records a video of a policy for a specified environment :param env: (causal_world.CausalWorld) the environment to use for

recording.

Parameters
  • policy – the policy to be evaluated

  • file_name – (str) full path where the video is being stored.

  • number_of_resets – (int) the number of resets/episodes to be viewed

  • max_time_steps – (int) the maximum number of time steps per episode

Returns

causal_world.viewers.task_viewer.record_video_of_episode(episode, file_name, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Records a video of a logged episode for a specified environment

Parameters
  • episode – (Episode) the logged episode

  • file_name – (str) full path where the video is being stored.

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns

causal_world.viewers.task_viewer.record_video_of_policy(task, world_params, policy_fn, file_name, number_of_resets, max_time_steps=100, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Records a video of a policy for a specified environment

Parameters
  • task – (Task) the task of the environment

  • world_params – (dict) the world_params of the environment

  • policy_fn – the policy to be evaluated

  • file_name – (str) full path where the video is being stored.

  • number_of_resets – (int) the number of resets/episodes to be viewed

  • max_time_steps – (int) the maximum number of time steps per episode

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns

causal_world.viewers.task_viewer.record_video_of_random_policy(task, world_params, file_name, number_of_resets, max_time_steps=100, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Records a video of a random policy for a specified environment

Parameters
  • task – (Task) the task of the environment

  • world_params – (dict) the world_params of the environment

  • file_name – (str) full path where the video is being stored.

  • number_of_resets – (int) the number of resets/episodes to be viewed

  • max_time_steps – (int) the maximum number of time steps per episode

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns

causal_world.viewers.task_viewer.view_episode(episode, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Visualizes a logged episode in the GUI

Parameters
  • episode – (Episode) the logged episode

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns

causal_world.viewers.task_viewer.view_policy(task, world_params, policy_fn, max_time_steps, number_of_resets, env_wrappers=array([], dtype=float64), env_wrappers_args=array([], dtype=float64))[source]

Visualizes a policy for a specified environment in the GUI

Parameters
  • task – (Task) the task of the environment

  • world_params – (dict) the world_params of the environment

  • policy_fn – the policy to be evaluated

  • max_time_steps – (int) the maximum number of time steps per episode

  • number_of_resets – (int) the number of resets/episodes to be viewed

  • env_wrappers – (list) a list of gym wrappers

  • env_wrappers_args – (list) a list of kwargs for the gym wrappers

Returns