def parse_trajectory_file_name(trajectory_file_name):
    """Parse out the trajectory file's groups and return to caller."""
    base_trajectory_file_name = os.path.basename(trajectory_file_name)
    trajectory_file_regexp = TRAJECTORY_FILE_FORMAT.format(
        epoch="(.*)",
        env_id="(.*)",
        temperature="(.*)",
        r="(.*)",
    )
    compiled_regexp = re.compile(trajectory_file_regexp)
    r = compiled_regexp.match(base_trajectory_file_name)
    if not r:
      return None
    g = r.groups()
    if len(g) is not compiled_regexp.groups:
      return None
    # epoch, env_id, temp, random string
    try:
      epoch = int(g[0])
      env_id = int(g[1])
      temperature = float(g[2])
      random_string = g[3]
    except ValueError:
      logging.error("Trajectory file name isn't parseable: %s",
                    base_trajectory_file_name)
      return None
    return epoch, env_id, temperature, random_string
Parse out the trajectory file's groups and return to caller.
tensor2tensor/envs/trajectory.py