EvoViewer
Provides tools to visualize any EvoSim
.
Quicklinks: EvoWorld, EvoSim, EvoViewer, WorldObject, envs.EvoGymBase, helper functions and metadata
Page Outline
class EvoViewer
Visualize an Evolution Gym simulation.
Args:
sim_to_view
(EvoSim): simulation to view.target_rps
(Optional[int]): target rendering speed in renders per second. IfNone
, renders as fast as possible. (default = 50)pos
(Tuple[float, float]): position of camera measured in voxels(x,y)
. (default = (12, 4))view_size
(Tuple[float, float]): size of viewbox – the number of voxels the camera can see(w, h)
. (default = (40, 20))resolution
(Tuple[int, int]): resolution of image generated in pixels(w, h)
. (default = (1200, 600))
method __init__
__init__(
sim_to_view: EvoSim,
target_rps: Optional[int] = 50,
pos: Tuple[float, float] = (12, 4),
view_size: Tuple[float, float] = (40, 20),
resolution: Tuple[int, int] = (1200, 600)
) → None
method hide_debug_window
hide_debug_window() → None
Make the debug window invisible.
method render
render(
mode: str = 'screen',
verbose: bool = False,
hide_background: bool = False,
hide_grid: bool = False,
hide_edges: bool = False,
hide_voxels: bool = False
) → Optional[ndarray]
Render the simulation.
Args:
mode
(str): values of ‘screen’ and ‘human’ will render to a debug window. If set to ‘img’ will return an image array.verbose
(bool): whether or not to print the rendering speed (rps) every second.hide_background
(bool): whether or not to render the cream-colored background. If shut off background will be white.hide_grid
(bool): whether or not to render the grid.hide_edges
(bool): whether or not to render edges around all objects.hide_voxels
(bool): whether or not to render voxels.
Returns:
Optional[np.ndarray]
: ifmode
is set toimg
, will return an image array.
method set_pos
set_pos(pos: Tuple[float, float]) → None
Set position of camera.
Args:
pos
(Tuple[float, float]): new position of camera measured in voxels(x,y)
.
method set_resolution
set_resolution(resolution: Tuple[int, int]) → None
Set resolution of image generated in pixels.
Args:
view_size
(Tuple[float, float]): new resolution(w, h)
.
method set_target_rps
set_target_rps(target_rps: Optional[int]) → None
Set the target render frequency, in renders per second.
Args:
target_rps
(Optional[int]): target rendering speed in renders per second. IfNone
, renders as fast as possible. (default = 50)
method set_tracking_settings
set_tracking_settings(**settings) → None
Adjust viewer object tracking settings.
Args:
padding
(Tuple[float, float]): padding, measured in voxels, to apply to the adjusted viewbox(padding-x, padding-y)
.scale
(Tuple[float, float]): scaling to apply to the adjusted viewbox(scale-x, scale-y)
.lock_x
(Union[bool, float]): locks the x-pos of the viewer to the given value, or unlocks if set toFalse
.lock_y
(Union[bool, float]): locks the y-pos of the viewer to the given value, or unlocks if set toFalse
.lock_width
(Union[bool, float]): locks the width of the viewer’s viewbox to the given value, or unlocks if set toFalse
.lock_height
(Union[bool, float]): locks the height of the viewer’s viewbox to the given value, or unlocks if set toFalse
.
method set_view_size
set_view_size(view_size: Tuple[float, float]) → None
Set size of viewbox – the number of voxels the camera can see.
Args:
view_size
(Tuple[float, float]): new size of viewbox(w, h)
.
method show_debug_window
show_debug_window() → None
Make the debug window visible.
method track_objects
track_objects(*objects: Tuple[str]) → None
Set objects for the viewer to automatically track. The viewer tracks objects by adjusting its pos
and view_size
automatically every time before rendering.
Args: Comma separated names of objects for the viewer to track.
This file was automatically generated via lazydocs.