class_docstr: Code to visualize an agent's behaviour.
class_docstr_tok: ["Code","to","visualize","an","agent","'s","behaviour","."]
docstr: Constructor for the AgentVisualizer class.
  
  This class generates a series of images built by a set of Plotters. These
  images are then saved to disk.
  
  It can optionally generate a video by concatenating all the images with
  ffmpeg.
  
  Args:
    record_path: str, path where to save files.
    plotters: list of `Plotter` objects to draw.
    screen_width: int, width of generated images.
    screen_height: int, height of generated images.
    render_rate: int, frame frequency at which to generate files.
    file_types: list of str, specifies the file types to generate.
    filename_format: str, format to use for saving files.
docstr_tok: ["Constructor","for","the","AgentVisualizer","class",".","This","class","generates","a","series","of","images","built","by","a","set","of","Plotters",".","These","images","are","then","saved","to","disk",".","It","can","optionally","generate","a","video","by","concatenating","all","the","images","with","ffmpeg",".","Args",":","record_path",":","str",",","path","where","to","save","files",".","plotters",":","list","of","`","Plotter","`","objects","to","draw",".","screen_width",":","int",",","width","of","generated","images",".","screen_height",":","int",",","height","of","generated","images",".","render_rate",":","int",",","frame","frequency","at","which","to","generate","files",".","file_types",":","list","of","str",",","specifies","the","file","types","to","generate",".","filename_format",":","str",",","format","to","use","for","saving","files","."]
code: def __init__(
      self,
      record_path,
      plotters,
      screen_width=160,
      screen_height=210,
      render_rate=1,
      file_types=("png", ""),
      filename_format="frame_{:06d}",
  ):
      """Constructor for the AgentVisualizer class.
  
      This class generates a series of images built by a set of Plotters. These
      images are then saved to disk.
  
      It can optionally generate a video by concatenating all the images with
      ffmpeg.
  
      Args:
        record_path: str, path where to save files.
        plotters: list of `Plotter` objects to draw.
        screen_width: int, width of generated images.
        screen_height: int, height of generated images.
        render_rate: int, frame frequency at which to generate files.
        file_types: list of str, specifies the file types to generate.
        filename_format: str, format to use for saving files.
      """
      self.record_path = record_path
      self.plotters = plotters
      self.screen_width = screen_width
      self.screen_height = screen_height
      self.render_rate = render_rate
      self.file_types = file_types
      self.filename_format = filename_format
      self.step = 0
      self.record_frame = np.zeros(
          (self.screen_height, self.screen_width, 3), dtype=np.uint8
      )
      # This is necessary to avoid a `pygame.error: No available video device`
      # error.
      os.environ["SDL_VIDEODRIVER"] = "dummy"
      pygame.init()
      self.screen = pygame.display.set_mode(
          (self.screen_width, self.screen_height), 0, 32
      )
  
file_path: dopamine/dopamine/utils/agent_visualizer.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import subprocess
  import gin
  import numpy
  from PIL import Image
  import pygame
label_desc: Use image node_id 1 to create a new AgentVisualizer object from inherited base classes: object with example: obj = AgentVisualizer(record_path, plotters, screen_width, screen_height, render_rate, file_types, filename_format)