def score_from_file(json_file):
 with open(json_file) as f:
  results = json.load(f)
 if (results is None):
  return None
 episode_lengths = results['episode_lengths']
 episode_rewards = results['episode_rewards']
 episode_types = results['episode_types']
 timestamps = results['timestamps']
 initial_reset_timestamp = results['initial_reset_timestamp']
 spec = gym.spec(results['env_id'])
 return score_from_merged(episode_lengths, episode_rewards, episode_types, timestamps, initial_reset_timestamp, spec.trials, spec.reward_threshold)

def score_from_file ( json_file ) : with open ( json_file ) as f : results = json . load ( f ) if ( results is None ) : return None episode_lengths = results [ 'episode_lengths' ] episode_rewards = results [ 'episode_rewards' ] episode_types = results [ 'episode_types' ] timestamps = results [ 'timestamps' ] initial_reset_timestamp = results [ 'initial_reset_timestamp' ] spec = gym . spec ( results [ 'env_id' ] ) return score_from_merged ( episode_lengths , episode_rewards , episode_types , timestamps , initial_reset_timestamp , spec . trials , spec . reward_threshold )
calculate score from an episode_batch .