Esempio n. 1
0
def Over(over_1, over_2, over_3):
    mplot.plotPrepareLogLog()

    o3 = mplot.plotMMA(
        over_3, 'round_wall', color3_light, 0,
        dict(label='32 Machines',
             linestyle='-',
             marker='s',
             color=color3_dark,
             zorder=3))

    o2 = mplot.plotMMA(
        over_2, 'round_wall', color2_light, 0,
        dict(label='16 Machines',
             linestyle='-',
             marker='^',
             color=color2_dark,
             zorder=3))

    o1 = mplot.plotMMA(
        over_1, 'round_wall', color1_light, 0,
        dict(label='8 Machines',
             linestyle='-',
             marker='o',
             color=color1_dark,
             zorder=3))

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(o1, o2, o3)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')

    plt.legend(loc=u'lower right')
    mplot.plotEnd()
Esempio n. 2
0
def plotAvgMM(co, jvss, naive, nt):
    mplot.plotPrepareLogLog()

    nt = mplot.plotMMA(ntree, 'round_wall', color4_light, 0,
                      dict(label='Ntree', linestyle='-', marker='v', color=color4_dark, zorder=3))
    # mplot.arrow("{:.1f} sec      ".format(mplot.avg[-2]), x[-2], 4, color3_dark)
    # mplot.arrow("      {:.0f} sec".format(mplot.avg[-1]), x[-1], 4, color3_dark)

    j = mplot.plotMMA(jvss, 'round_wall', color2_light, 0,
                      dict(label='JVSS', linestyle='-', marker='^', color=color2_dark, zorder=3))
    #j_p = jvss.get_values('round_wall')
    #plt.plot(j_p.x, j_p.avg, label="JVSS", color=color2_dark, marker='^')
    #mplot.arrow("{:.1f} sec      ".format(j_p.avg[-2]), j_p.x[-2], 4, color2_dark)
    #mplot.arrow("      {:.0f} sec".format(j_p.avg[-1]), j_p.x[-1], 8, color2_dark)

    na = mplot.plotMMA(naive, 'round_wall', color3_light, 0,
                       dict(label='Naive', linestyle='-', marker='s', color=color3_dark, zorder=3))
    na_p = naive.get_values('round_wall')
    #mplot.arrow("{:.1f} sec      ".format(na_p.avg[8]), na_p.x[8], 4, color3_dark)
    mplot.arrow("      {:.0f} sec".format(na_p.avg[9]), na_p.x[9], 8, color3_dark)

    co = mplot.plotMMA(cothority, 'round_wall', color1_light, 4,
                       dict(label='Cothority', linestyle='-', marker='o', color=color1_dark, zorder=5))

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(na, co)
    plt.ylim(ymin, 8)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')

    plt.legend(loc=u'lower right')
    mplot.plotEnd()
Esempio n. 3
0
def PlotMultiBF(*values_bf):
    mplot.plotPrepareLogLog(2, 0)
    plotbf = []
    pparams = [[color1_light, color1_dark, 'o'],
               [color2_light, color2_dark, 's'],
               [color3_light, color3_dark, '^'],
               [color4_light, color4_dark, '.']]

    for i, value in enumerate(values_bf):
        label = str(int(value.columns['Peers'][0])) + " Peers"
        c1, c2, m = pparams[i]
        plotbf.append(
            mplot.plotMMA(
                value, 'round_wall', c1, 0,
                dict(label=label, linestyle='-', marker=m, color=c2,
                     zorder=3)))

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*plotbf)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')
    plt.xlabel('Branching factor')

    plt.legend(loc=u'upper right')
    mplot.plotEnd()
Esempio n. 4
0
def plotAvg(co, jvss, naive, nt):
    mplot.plotPrepareLogLog()

    j_p = jvss.get_values('round_wall')
    plt.plot(j_p.x, j_p.avg, label="JVSS", color=color2_dark, marker='^')

    na_p = naive.get_values('round_wall')
    plt.plot(na_p.x, na_p.avg, label="Naive", color=color3_dark, marker='s')
    #mplot.arrow("      {:.0f} sec".format(na_p.avg[9]), na_p.x[9], 8, 1, color3_dark)

    nt_p = nt.get_values('round_wall')
    plt.plot(nt_p.x, nt_p.avg, label="Ntree", color=color4_dark, marker='v')

    co_p = cothority.get_values('round_wall')
    plt.plot(co_p.x,
             co_p.avg,
             label="Cothority",
             color=color1_dark,
             marker='o')

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(j_p, na_p, nt_p, co_p)
    plt.ylim(ymin, 8)
    plt.xlim(xmin, 1024 * 1.2)
    plt.ylabel('Seconds per round')

    plt.legend(loc=u'lower right')
    mplot.plotEnd()
Esempio n. 5
0
def plotData(data,
             name,
             xlabel="Number of witnesses",
             ylabel="Signing round latency in seconds",
             xticks=[],
             loglog=[2, 2],
             xname="hosts",
             legend_pos="lower right",
             yminu=0,
             ymaxu=0,
             xminu=0,
             xmaxu=0,
             title="",
             read_plots=True):
    mplot.plotPrepareLogLog(loglog[0], loglog[1])
    if read_plots:
        plots = read_csvs_xname(xname, *data[0])
    else:
        plots = data[0]

    ranges = []
    data_label = []
    plot_show(name)

    for index, label in enumerate(data[1]):
        data_label.append([plots[index], label])
        ranges.append(
            mplot.plotMMA(
                plots[index], 'round_wall', colors[index][0], 4,
                dict(label=label,
                     linestyle='-',
                     marker='o',
                     color=colors[index][1],
                     zorder=5)))

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    if yminu != 0:
        ymin = yminu
    if ymaxu != 0:
        ymax = ymaxu
    if xminu != 0:
        xmin = xminu
    if xmaxu != 0:
        xmax = xmaxu
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)

    plt.legend(loc=legend_pos)
    plt.axes().xaxis.grid(color='gray', linestyle='dashed', zorder=0)
    if len(xticks) > 0:
        ax = plt.axes()
        ax.set_xticks(xticks)
    if title != "":
        plt.title(title)
    mplot.plotEnd()
    return data_label
Esempio n. 6
0
def plotData(data, name,
             xlabel="Time since last update", ylabel="Bandwidth",
             xticks=[], loglog=[0, 0], xname="time",
             legend_pos="lower right",
             yname="bandwidth",
             yminu=0, ymaxu=0,
             xminu=0, xmaxu=0,
             title="", read_plots=True,
             restart_x=False):
    mplot.plotPrepareLogLog(loglog[0], loglog[1])
    if read_plots:
        plots = read_csvs_xname(xname, *data[0])
    else:
        plots = data[0]

    ranges = []
    data_label = []
    plot_show(name)
    subx = 0
    if restart_x:
        subx = plots[0].columns[xname][0]

    for index, label in enumerate(data[1]):
        data_label.append([plots[index], label])
        # plots[index].print_short()
        if restart_x:
            print subx
            plots[index].column_add(xname, -subx)
            plots[index].get_values("time")

        ranges.append(
            mplot.plotMMA(plots[index], yname, colors[index][0], 4,
                          dict(label=label, linestyle='-', marker='.',
                               color=colors[index][1], zorder=5)))

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    if yminu != 0:
        ymin = yminu
    if ymaxu != 0:
        ymax = ymaxu
    if xminu != 0:
        xmin = xminu
    if xmaxu != 0:
        xmax = xmaxu
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)

    plt.legend(loc=legend_pos)
    plt.axes().xaxis.grid(color='gray', linestyle='dashed', zorder=0)
    if len(xticks) > 0:
        ax = plt.axes()
        ax.set_xticks(xticks)
    if title != "":
        plt.title(title)
    mplot.plotEnd()
    return data_label
Esempio n. 7
0
def PlotStamp(stamp):
    mplot.plotPrepareLogLog(10, 0)

    plotbf = mplot.plotMMA(stamp, 'round_wall', color1_light, 0,
                           dict(label='4096 Peers', linestyle='-', marker='o', color=color2_dark, zorder=3))

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(plotbf)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')
    plt.xlabel('Stamping rate [1/s]')

    plt.legend(loc=u'upper right')
    mplot.plotEnd()
Esempio n. 8
0
def PlotBF(values_bf):
    mplot.plotPrepareLogLog(2, 0)

    plotbf = mplot.plotMMA(values_bf, 'round_wall', color1_light, 0,
                           dict(label='4096 Peers', linestyle='-', marker='o', color=color2_dark, zorder=3))

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(plotbf)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')
    plt.xlabel('Branching factor')

    plt.legend(loc=u'upper right')
    mplot.plotEnd()
Esempio n. 9
0
def Over(over_1, over_2, over_3):
    mplot.plotPrepareLogLog()

    o3 = mplot.plotMMA(over_3, 'round_wall', color3_light, 0,
                       dict(label='32 Machines', linestyle='-', marker='s', color=color3_dark, zorder=3))

    o2 = mplot.plotMMA(over_2, 'round_wall', color2_light, 0,
                       dict(label='16 Machines', linestyle='-', marker='^', color=color2_dark, zorder=3))

    o1 = mplot.plotMMA(over_1, 'round_wall', color1_light, 0,
                       dict(label='8 Machines', linestyle='-', marker='o', color=color1_dark, zorder=3))

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(o1, o2, o3)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')

    plt.legend(loc=u'lower right')
    mplot.plotEnd()
Esempio n. 10
0
def plotScatter():
    mplot.plotPrepareLogLog(0, 0)
    plot_show('scatter')
    plt.ylabel('Bandwidth [bytes]')
    plt.xlabel('Time since start [s]')
    data = read_csvs_xname("time", *sc_scatter)
    styles = ["^"] * 4 + ["s"] * 4
    ranges = []
    for index, label in enumerate(sc_titles):
        if index == 0:
            continue
        plot = data[index]
        y = plot.get_values("bandwidth")
        ranges.append(y)
        plt.scatter(plot.x, y.y, label=label,
                    color=colors[index][1], marker=styles[index])
    plt.legend(loc="upper left")
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    plt.xlim(0, xmax)
    plt.ylim(0, ymax)
    mplot.plotEnd()
Esempio n. 11
0
def PlotMultiBF(*values_bf):
    mplot.plotPrepareLogLog(2, 0)
    plotbf = []
    pparams = [[color1_light, color1_dark, 'o'],
               [color2_light, color2_dark, 's'],
               [color3_light, color3_dark, '^'],
               [color4_light, color4_dark, '.']]

    for i, value in enumerate(values_bf):
        label = str(int(value.columns['Peers'][0])) + " Peers"
        c1, c2, m = pparams[i]
        plotbf.append( mplot.plotMMA(value, 'round_wall', c1, 0,
                           dict(label=label, linestyle='-', marker=m, color=c2, zorder=3)) )

    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*plotbf)
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax * 1.2)
    plt.ylabel('Seconds per round')
    plt.xlabel('Branching factor')

    plt.legend(loc=u'upper right')
    mplot.plotEnd()
Esempio n. 12
0
def plotAvg(co, jvss, naive, nt):
    mplot.plotPrepareLogLog()

    j_p = jvss.get_values('round_wall')
    plt.plot(j_p.x, j_p.avg, label="JVSS", color=color2_dark, marker='^')

    na_p = naive.get_values('round_wall')
    plt.plot(na_p.x, na_p.avg, label="Naive", color=color3_dark, marker='s')
    #mplot.arrow("      {:.0f} sec".format(na_p.avg[9]), na_p.x[9], 8, color3_dark)

    nt_p = nt.get_values('round_wall')
    plt.plot(nt_p.x, nt_p.avg, label="Ntree", color=color4_dark, marker='v')

    co_p = cothority.get_values('round_wall')
    plt.plot(co_p.x, co_p.avg, label="Cothority", color=color1_dark, marker='o')

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(j_p, na_p, nt_p, co_p)
    plt.ylim(ymin, 8)
    plt.xlim(xmin, 1024 * 1.2)
    plt.ylabel('Seconds per round')

    plt.legend(loc=u'lower right')
    mplot.plotEnd()
Esempio n. 13
0
def plotScatter():
    mplot.plotPrepareLogLog(0, 0)
    plot_show('scatter')
    plt.ylabel('Bandwidth [bytes]')
    plt.xlabel('Time since start [s]')
    data = read_csvs_xname("time", *sc_scatter)
    styles = ["^"] * 4 + ["s"] * 4
    ranges = []
    for index, label in enumerate(sc_titles):
        if index == 0:
            continue
        plot = data[index]
        y = plot.get_values("bandwidth")
        ranges.append(y)
        plt.scatter(plot.x,
                    y.y,
                    label=label,
                    color=colors[index][1],
                    marker=styles[index])
    plt.legend(loc="upper left")
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    plt.xlim(0, xmax)
    plt.ylim(0, ymax)
    mplot.plotEnd()
Esempio n. 14
0
def plotData(
    data,
    name,
    xlabel="Number of witnesses",
    ylabel="Signing round latency in seconds",
    xticks=[],
    loglog=[2, 2],
    xname="hosts",
    legend_pos="lower right",
    yminu=0,
    ymaxu=0,
    xminu=0,
    xmaxu=0,
    title="",
    read_plots=True,
):
    mplot.plotPrepareLogLog(loglog[0], loglog[1])
    if read_plots:
        plots = read_csvs_xname(xname, *data[0])
    else:
        plots = data[0]

    ranges = []
    data_label = []
    plot_show(name)

    for index, label in enumerate(data[1]):
        data_label.append([plots[index], label])
        ranges.append(
            mplot.plotMMA(
                plots[index],
                "round_wall",
                colors[index][0],
                4,
                dict(label=label, linestyle="-", marker="o", color=colors[index][1], zorder=5),
            )
        )

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    if yminu != 0:
        ymin = yminu
    if ymaxu != 0:
        ymax = ymaxu
    if xminu != 0:
        xmin = xminu
    if xmaxu != 0:
        xmax = xmaxu
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)

    plt.legend(loc=legend_pos)
    plt.axes().xaxis.grid(color="gray", linestyle="dashed", zorder=0)
    if len(xticks) > 0:
        ax = plt.axes()
        ax.set_xticks(xticks)
    if title != "":
        plt.title(title)
    mplot.plotEnd()
    return data_label
Esempio n. 15
0
def plotData(data,
             name,
             xlabel="Time since last update",
             ylabel="Bandwidth",
             xticks=[],
             loglog=[0, 0],
             xname="time",
             legend_pos="lower right",
             yname="bandwidth",
             yminu=0,
             ymaxu=0,
             xminu=0,
             xmaxu=0,
             title="",
             read_plots=True,
             restart_x=False):
    mplot.plotPrepareLogLog(loglog[0], loglog[1])
    if read_plots:
        plots = read_csvs_xname(xname, *data[0])
    else:
        plots = data[0]

    ranges = []
    data_label = []
    plot_show(name)
    subx = 0
    if restart_x:
        subx = plots[0].columns[xname][0]

    for index, label in enumerate(data[1]):
        data_label.append([plots[index], label])
        # plots[index].print_short()
        if restart_x:
            print subx
            plots[index].column_add(xname, -subx)
            plots[index].get_values("time")

        ranges.append(
            mplot.plotMMA(
                plots[index], yname, colors[index][0], 4,
                dict(label=label,
                     linestyle='-',
                     marker='.',
                     color=colors[index][1],
                     zorder=5)))

    # Make horizontal lines and add arrows for JVSS
    xmin, xmax, ymin, ymax = CSVStats.get_min_max(*ranges)
    if yminu != 0:
        ymin = yminu
    if ymaxu != 0:
        ymax = ymaxu
    if xminu != 0:
        xmin = xminu
    if xmaxu != 0:
        xmax = xmaxu
    plt.ylim(ymin, ymax)
    plt.xlim(xmin, xmax)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)

    plt.legend(loc=legend_pos)
    plt.axes().xaxis.grid(color='gray', linestyle='dashed', zorder=0)
    if len(xticks) > 0:
        ax = plt.axes()
        ax.set_xticks(xticks)
    if title != "":
        plt.title(title)
    mplot.plotEnd()
    return data_label