Beispiel #1
0
                       convert_to_gb, stacked_bar_plot, stacked_bar_plot_mult)

PLOT_ALL = True
output_dir = OUTPUT_DIR + 'psi_comm/'
os.makedirs(output_dir, exist_ok=True)
input_dir = INPUT_DIR + 'psi/'
to_server = 11
from_server = 13

# Setsize ---------------------------------------------------------------------
if False or PLOT_ALL:
    name = "butthead_psi_setsize"
    input_file = input_dir + f"setsize/{name}2.csv"
    d_to = read_data(input_file, 2, to_server)
    d_from = read_data(input_file, 2, from_server)
    convert_to_gb(d_to)
    convert_to_gb(d_from)
    minor_xlabels = [
        f"{int(i / 10 ** 6)} Mio" for i in sorted(d_to.keys())
        if i % 10**6 == 0
    ]
    for i in [3, 5, 7, 9, 11, 13, 15, 17, 19]:
        minor_xlabels[i] = ''
    xticks = [
        i for i, x in enumerate(sorted((d_to.keys())))
        if x != 0 and x % 10**6 != 0
    ]
    minor_xticks = [
        i for i, _ in enumerate(sorted((d_to.keys()))) if i not in xticks
    ]
    xlabels = [fr"$2^{{ {i} }}$" for i in range(20, 26, 1)]

def comp_bloom_bits(n, p):
    m = np.ceil(-n * ln(p) / (ln(2)**2))
    return m


def bit_to_gb(b):
    return b / 8 / 1000 / 1000 / 1000


# Size
if False or PLOT_ALL:
    with plot_settings(half_width=True):
        d = read_data(input_dir + f"{name}.csv", 1, 5)
        d = convert_to_gb(d)
        theo = {}
        for x in d:
            theo[x] = [bit_to_gb(comp_bloom_bits(x, 10**-20))] * 2
        error_plot_mult(
            [d, theo],
            output_dir + f'size{EXTENSION}',
            100000000,
            0,
            20,
            4,
            "Capacity [#]",
            "Size [GB]",
            r"Bloom Filter Size (FP Rate: $1^{{-20}}$, Stored: To Cap., "
            r"10 Reps)",
            legend=Legend(['Measured', 'Theoretic'], location="upper left"),