plangym.utils

Generic utilities for working with environments.

Module Contents

Functions

remove_time_limit_from_spec(spec)

Remove the maximum time limit of an environment spec.

remove_time_limit(gym_env)

Remove the maximum time limit of the provided environment.

process_frame(frame, width = None, height = None, mode = 'RGB')

Use PIL to resize an RGB frame to a specified height and width or changing it to a different mode.

plangym.utils.remove_time_limit_from_spec(spec)[source]

Remove the maximum time limit of an environment spec.

plangym.utils.remove_time_limit(gym_env)[source]

Remove the maximum time limit of the provided environment.

Parameters

gym_env (gym.Env) –

Return type

gym.Env

plangym.utils.process_frame(frame, width=None, height=None, mode='RGB')[source]

Use PIL to resize an RGB frame to a specified height and width or changing it to a different mode.

Parameters
  • frame (numpy.ndarray) – Target numpy array representing the image that will be resized.

  • width (int) – Width of the resized image.

  • height (int) – Height of the resized image.

  • mode (str) – Passed to Image.convert.

Returns

The resized frame that matches the provided width and height.

Return type

numpy.ndarray