Exemple #1
0
def generate_series():
    test_id = CONF.command.test_id
    session = api.get_session()
    run_times = api.get_test_run_time_series(test_id, session)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    mean = pd.rolling_mean(ts, 20)
    rolling_std = pd.rolling_std(ts, 20)
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel("Time (sec.)")
    plt.plot(ts.index, ts, "k", label="Run Time")
    plt.plot(mean.index, mean, "b", label="Avg. Run Time")
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index, upper_std_dev, lower_std_dev, color="b", alpha=0.2, label="std dev")
    plt.legend()
    plt.savefig(CONF.output, dpi=900)
    return ts
def generate_series(test_id):
    session = api.get_session()
    run_times = api.get_test_run_time_series(test_id, session)
    session.close()
    ts = pd.Series(run_times)

#    ts = ts.truncate(after='11/26/2014')
#    print len(ts)
#    plot1 = pd.rolling_median(test, 100).plot()
    plot = pd.rolling_mean(ts, 50).plot()
    plot = ts.plot()
    fig = plot.get_figure()
    fig.savefig('/tmp/test.eps')
    return ts
Exemple #3
0
def generate_series():
    session = api.get_session()
    test_id = api.get_id_from_test_id(CONF.command.test_id, session)
    if not test_id:
        print("The test_id %s was not found in the database" %
              CONF.command.test_id)
        exit(2)
    run_times = api.get_test_run_time_series(test_id, session)
    if not run_times:
        print("There was no data found in the database")
        exit(3)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    if ts.count() == 0:
        print("No data available. Check your query and try again.")
        exit(-1)
    mean = pd.rolling_mean(ts, 20)
    rolling_std = pd.rolling_std(ts, 20)
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel('Time (sec.)')

    # format x-axis with dates
    fig, ax = plt.subplots(1)
    fig.autofmt_xdate()
    xfmt = dates.DateFormatter("%b %d %Y")
    ax.xaxis_date()
    ax.xaxis.set_major_formatter(xfmt)

    plt.plot(ts.index, ts, 'k', label='Run Time')
    plt.plot(mean.index, mean, 'b', label='Avg. Run Time')
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index,
                     upper_std_dev,
                     lower_std_dev,
                     color='b',
                     alpha=0.2,
                     label='std dev')
    plt.legend()
    plt.savefig(CONF.output, dpi=900)
    return ts
def generate_series():
    session = api.get_session()
    test_id = api.get_id_from_test_id(CONF.command.test_id, session)
    if not test_id:
        print("The test_id %s was not found in the database" %
              CONF.command.test_id)
        exit(2)
    run_times = api.get_test_run_time_series(test_id, session)
    if not run_times:
        print("There was no data found in the database")
        exit(3)
    if not CONF.title:
        test = api.get_test_by_id(test_id, session)
    session.close()
    ts = pd.Series(run_times)
    ts = utils.filter_dates(ts)
    if ts.count() == 0:
        print("No data available. Check your query and try again.")
        exit(-1)
    roll = ts.rolling(window=20, center=False)
    mean = roll.mean()
    rolling_std = roll.std()
    plt.figure()
    if not CONF.title:
        plt.title(test.test_id)
    else:
        plt.title(CONF.title)
    plt.ylabel('Time (sec.)')

    # format x-axis with dates
    fig, ax = plt.subplots(1)
    fig.autofmt_xdate()
    xfmt = dates.DateFormatter("%b %d %Y")
    ax.xaxis_date()
    ax.xaxis.set_major_formatter(xfmt)

    plt.plot(ts.index, ts, 'ko', label='Run Time', markersize=0.45)
    plt.plot(mean.index, mean, 'b', label='Avg. Run Time', linewidth=0.45)
    upper_std_dev = mean + 2 * rolling_std
    lower_std_dev = mean - 2 * rolling_std
    # Set negative numbers to 0
    lower_std_dev[lower_std_dev < 0] = 0
    plt.fill_between(rolling_std.index, upper_std_dev,
                     lower_std_dev, color='b', alpha=0.2,
                     label='std dev')
    plt.legend()
    plt.savefig(CONF.output, dpi=CONF.dpi)
    return ts