def test_output_shape_as_expected_with_gfootball_env_reset(self):
        obs = self._gfootball_env.reset()
        # Act
        raw_obs = RawObs.convert_observation(obs)

        # Assert
        self.assertEqual(RawObs().shape, raw_obs.shape)
    def test_output_shape_as_expected_with_kaggle_env_reset(self):
        # Arrange
        obs = self._kaggle_env.reset()

        # Act
        raw_obs = RawObs.convert_observation(obs)

        # Assert
        self.assertEqual(RawObs().shape, raw_obs.shape)
Beispiel #3
0
    def process_obs(obs: Union[Dict[str, Any], List[Any]]) -> np.ndarray:

        if isinstance(obs, dict):
            # From kaggle env
            obs_for_s115 = obs['players_raw']
            obs_for_raw = obs['players_raw']

        elif isinstance(obs, list):
            # From gfootball Env
            obs_for_s115 = obs
            obs_for_raw = obs[0]

        else:
            raise ValueError("Something unexpected about obs")

        simple_obs = Simple115StateWrapper.convert_observation(
            obs_for_s115, fixed_positions=False).reshape(-1)
        raw_obs = RawObs.convert_observation(obs_for_raw)

        return np.concatenate([simple_obs, raw_obs.squeeze()])