Esempio n. 1
0
def plot6a4():
    colors = misc.palette(4)
    fig, ax = plt.subplots(1, figsize=(9, 4), sharey=True)
    plt.subplots_adjust(top=0.9, bottom=0.18, left=0.1, right=0.93)
    allpercs = []
    for j, prefix in enumerate(['a', 'b', 'c', 'd', 'e']):
        for i in range(5):
            ztots = misc.extract_file(
                "res/test6/{}/fc{}/zeros/zt".format(prefix, i+1))
            ztots = [sum(x) for x in ztots]
            sizes = misc.extract_file(
                "res/test6/{}/fc{}/lz4".format(prefix, i+1))
            sizes = [x[-1] for x in sizes]
            zpercs = np.true_divide(ztots, sizes)
            for z in zpercs:
                allpercs.append(z)
    ax.hist(allpercs, weights=np.zeros_like(allpercs) +
            1. / len(allpercs), color=colors[1], bins=[0.05*x for x in range(3, 16)])
    print("6a - 4")
    print("std: {}".format(round(np.std(allpercs), 3)))
    print("av: {}".format(round(np.mean(allpercs), 3)))
    ax.set_ylabel("Relative Frequency")
    ax.set_xlabel("Zero Percentage")
    plt.suptitle(
        "Figure 4: Zero Percentage Frequency Distribution (Report 5)".format(prefix, j + 1))
    misc.savefig("rep/rep6a/fig4", plt)
Esempio n. 2
0
def plot6a3():
    colors = misc.palette(7)
    fig, axs = plt.subplots(5, figsize=(9, 8), sharey=True, sharex=True)
    plt.subplots_adjust(top=0.9, bottom=0.08, left=0.1,
                        right=0.93, hspace=0.4)
    for j, prefix in enumerate(['a', 'b', 'c', 'd', 'e']):
        for i in range(5):
            ztots = misc.extract_file(
                "res/test6/{}/fc{}/zeros/zt".format(prefix, i+1))
            ztots = [sum(x) for x in ztots]
            sizes = misc.extract_file(
                "res/test6/{}/fc{}/lz4".format(prefix, i+1))
            sizes = [x[-1] for x in sizes]
            zpercs = np.true_divide(ztots, sizes)
            axs[j].plot(range(len(zpercs)), zpercs, '-', color=colors[i])
        axs[j].set_title("Part {}".format(j + 1))
    plt.suptitle(
        "Figure 3: Zero Percentage vs Field Size (Report 5)".format(prefix, j + 1))
    axs[2].set_ylabel("Zero Percentage")
    axs[-1].set_xlabel("Field Size")
    leg = axs[0].legend(["fields per rec: {}".format(x + 1)
                         for x in range(5)], loc='upper right')
    for line in leg.get_lines():
        line.set_linewidth(3.0)
    misc.savefig("rep/rep6a/fig3", plt)
    plt.close()
Esempio n. 3
0
def hist6b67(zpercs):
    fig, ax = plt.subplots(1, figsize=(9, 4))
    plt.subplots_adjust(top=0.87, bottom=0.12, left=0.1, right=0.93)
    colors = misc.palette(4)
    ax.hist(zpercs, weights=np.zeros_like(zpercs) +
            1. / len(zpercs), color=colors[1], bins=[0.025*x for x in range(11, 41)])
    print("std: {}".format(round(np.std(zpercs), 3)))
    print("av: {}".format(round(np.mean(zpercs), 3)))
    ax.set_ylabel("Relative Frequency")
    ax.set_xlabel("Zero Percentage")
Esempio n. 4
0
def plot6b1():
    fig, ax = plt.subplots(1, figsize=(9, 2.8), sharey=True)
    plt.subplots_adjust(top=0.87, bottom=0.16, left=0.1, right=0.93)
    sizes = extract_sizes()
    ax.plot(range(len(sizes)), sizes, '-', color=misc.palette(3)[0])
    ax.set_xlabel("Record Count (x1000)")
    ax.set_ylabel("Total Memory Consumption (Bytes)")
    ax.set_title("Figure 1: Memory Consumption vs Record Count")
    misc.savefig("rep/rep6b/fig1", plt)
    plt.close()
Esempio n. 5
0
def bar1234(data, binned_data):
    fig, ax = plt.subplots(1, figsize=(9, 4), sharey=True)
    plt.subplots_adjust(top=0.86, bottom=0.12, left=0.1, right=0.93)
    colors = misc.palette(5)

    ax.bar([x*5 for x in range(len(binned_data))], binned_data,
           color=colors[3], align='edge', width=5)
    ax.bar([x for x in range(len(data))],
           data, color=colors[1], align='edge')
    ax.set_ylabel("% of Zero Bytes")
    ax.set_xlabel("Zero Sequence Length")
    ax.set_ylim(top=.6)
    ax.xaxis.set_minor_locator(mpl.ticker.MultipleLocator(10))
    ax.xaxis.set_major_locator(mpl.ticker.MultipleLocator(50))
    return ax
Esempio n. 6
0
def plot6c1():
    print("6c - 1")
    zpercs = extract_zpercs(low=10, subtest=8)[:500]
    fig, ax = plt.subplots(1, figsize=(9, 4))
    plt.subplots_adjust(top=0.87, bottom=0.12, left=0.1, right=0.93)
    colors = misc.palette(4)
    ax.hist(zpercs, weights=np.zeros_like(zpercs) +
            1. / len(zpercs), color=colors[1], bins=[0.01*x for x in range(12, 31)])
    print("std: {}".format(round(np.std(zpercs), 3)))
    print("av: {}".format(round(np.mean(zpercs), 3)))
    ax.set_ylabel("Relative Frequency")
    ax.set_xlabel("Zero Percentage")
    plt.suptitle(
        "Figure 1: Zero Percentage Frequency Distribution")
    misc.savefig("rep/rep6c/fig1", plt)
    plt.close()
Esempio n. 7
0
def plot6b3():
    fig, ax = plt.subplots(1, figsize=(9, 4))
    plt.subplots_adjust(top=0.87, bottom=0.12, left=0.1, right=0.93)
    colors = misc.palette(4)
    zpercs0 = extract_zpercs(low=10)
    zpercs1 = extract_zpercs(low=10, high=-1)
    zpercs2 = extract_zpercs(low=-1)
    ax.plot(range(len(zpercs0)), zpercs0, '-', color=colors[0])
    ax.plot(range(len(zpercs1)), zpercs1, '-', color=colors[1])
    ax.plot(range(len(zpercs2)), zpercs2, '-', color=colors[2])
    leg = ax.legend(["sequence length: 10+",
                     "sequence length: 10 - 249",
                     "sequence length: 250+"])
    ax.set_xlabel("Record Count (x1000)")
    ax.set_ylabel("Fraction of Total Bytes")
    ax.set_title("Figure 3: Zero Percentage vs Record Count")
    misc.savefig("rep/rep6b/fig3", plt)
    plt.close()
Esempio n. 8
0
def plot6b2():
    fig, ax = plt.subplots(1, figsize=(9, 4))
    plt.subplots_adjust(top=0.87, bottom=0.12, left=0.1, right=0.93)
    colors = misc.palette(4)
    ztots0 = extract_ztotals(low=10)
    ztots1 = extract_ztotals(low=10, high=-1)
    ztots2 = extract_ztotals(low=-1)
    ax.plot(range(len(ztots0)), ztots0, '-', color=colors[0])
    ax.plot(range(len(ztots1)), ztots1, '-', color=colors[1])
    ax.plot(range(len(ztots2)), ztots2, '-', color=colors[2])
    ax.set_xlabel("Record Count (x1000)")
    ax.set_ylabel("# of Zero Bytes")
    ax.set_title("Figure 2: Zero Bytes vs Record Count")
    leg = ax.legend(["sequence length: 10+",
                     "sequence length: 10 - 249",
                     "sequence length: 250+"])
    for line in leg.get_lines():
        line.set_linewidth(3.0)
    misc.savefig("rep/rep6b/fig2", plt)
    plt.close()