docstr: Runs a replay to get the replay data.
docstr_tok: ["Runs","a","replay","to","get","the","replay","data","."]
code: def _get_replay_data(self, controller, config):
      """Runs a replay to get the replay data."""
      f = features.features_from_game_info(
          game_info=controller.game_info()
      )
  
      observations = {}
      last_actions = []
      for _ in range(config.num_observations):
          raw_obs = controller.observe()
          o = raw_obs.observation
          obs = f.transform_obs(raw_obs)
  
          if raw_obs.action_errors:
              print("action errors:", raw_obs.action_errors)
  
          if o.game_loop == 2:
              # Center camera is initiated automatically by the game and reported
              # at frame 2.
              last_actions = [actions.FUNCTIONS.move_camera.id]
  
          self.assertEqual(last_actions, list(obs.last_actions))
  
          unit_type = obs.feature_screen.unit_type
          observations[o.game_loop] = unit_type
  
          if o.game_loop in config.actions:
              func = config.actions[o.game_loop](obs)
  
              print(renderer_ascii.screen(obs))
              scv_y, scv_x = (units.Terran.SCV == unit_type).nonzero()
              print("scv locations: ", sorted(list(zip(scv_x, scv_y))))
              print(
                  "available actions: ",
                  list(sorted(obs.available_actions)),
              )
              print("Making action: %s" % (func,))
  
              # Ensure action is available.
              # If a build action is available, we have managed to target an SCV.
              self.assertIn(func.function, obs.available_actions)
  
              if func.function in (
                  actions.FUNCTIONS.Build_SupplyDepot_screen.id,
                  actions.FUNCTIONS.Build_Barracks_screen.id,
              ):
                  # Ensure we can build on that position.
                  x, y = func.arguments[1]
                  self.assertEqual(_EMPTY, unit_type[y, x])
  
              action = f.transform_action(o, func)
              last_actions = [func.function]
              controller.act(action)
          else:
              last_actions = []
  
          controller.step()
  
      replay_data = controller.save_replay()
      return replay_data, observations
  
imports: from absl.testing import absltest
  from pysc2 import maps
  from pysc2 import run_configs
  from pysc2.lib import actions
  from pysc2.lib import features
  from pysc2.lib import point
  from pysc2.lib import renderer_ascii
  from pysc2.lib import units
  from pysc2.tests import utils
  from s2clientprotocol import common_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 for calling the ReplayObsTest obj's underlying member method code with example usage: obj._get_replay_data(controller, config) and returns: replay_data,  observations