コード例 #1
0
def plot_most_recent_ts_in_repo(conf):
    timeserie_repo = io_util.parse_from_gz_file(conf.timeserie_repo,
                                                timeserie_pb2.TimeserieRepo())
    lastest_entry = max((e for e in timeserie_repo.entries),
                        key=lambda e: e.start_secs)
    ts, _ = io_util.read_df_from_timeserie_gz(lastest_entry.filepath)
    axes = plot_ts(conf, ts)
    plt.show()
    return axes
コード例 #2
0
def list_replay_in_repo(conf):
    is_short_listing = False
    if len(conf.subcommand) > 1:
        is_short_listing = 'short' == conf.subcommand[1]
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())

    if not is_short_listing:
        logging.info("Replay repo:\n%s", replay_repo)
    else:
        lines = [
            short_listing_format(conf, i, r)
            for i, r in enumerate(replay_repo.replays)
        ]
        logging.info("Replay repo:\n%s", "\n".join(lines))
コード例 #3
0
def plot_replay(conf, replay):
    if not replay.timeserie:
        raise Exception("No timeserie for replay %s" % replay)
    ts, metadata = io_util.read_df_from_timeserie_gz_between(
        replay.timeserie, io_util.secs_to_dt(replay.start_secs),
        io_util.secs_to_dt(replay.end_secs))
    axes = plot_ts(conf, ts)
    if replay.details:
        game_details = io_util.parse_from_gz_file(replay.details,
                                                  replay_pb2.GameDetails())
        age_millis = util.get_tech_age_research_times(game_details,
                                                      conf.player)
        for offset in age_millis.values():
            real_offset = util.replay_to_timeserie_millis_offset(
                replay, metadata, offset)
            line = matplotlib.lines.Line2D([offset, offset], [0, 1000],
                                           lw=2,
                                           color='black',
                                           axes=axes)
            axes.add_artist(line)
    plt.show()
    return axes
コード例 #4
0
def plot_last_replay_in_repo(conf):
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())
    lastest_replay = max((r for r in replay_repo.replays),
                         key=lambda r: r.start_secs)
    plot_replay(conf, lastest_replay)
コード例 #5
0
def plot_replay_by_idx(conf):
    if len(conf.subcommand) < 2:
        raise Exception("plot_ts needs index")
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())
    plot_replay(conf, replay_repo.replays[int(conf.subcommand[1])])