Update on Overleaf.
This commit is contained in:
53
figs/analyse_hash.py
Normal file
53
figs/analyse_hash.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import csv
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
targets = []
|
||||
hashvalues = []
|
||||
diff = []
|
||||
distrib=[]
|
||||
ratio=[]
|
||||
|
||||
with open("headers.csv", "r") as f:
|
||||
reader = csv.reader(f, delimiter=";")
|
||||
for row in reader:
|
||||
if row[0][0] != '#':
|
||||
targets.append(int(row[3]))
|
||||
hashvalues.append(int(row[5]))
|
||||
diff.append(int(row[3]) - int(row[5]))
|
||||
ratio.append(int(row[5])/int(row[3]))
|
||||
|
||||
plt.plot(hashvalues, '+', label="hash")
|
||||
plt.plot(targets, 'o', label="target")
|
||||
plt.legend(loc="upper right")
|
||||
plt.savefig("target_hash.pdf")
|
||||
|
||||
plt.clf()
|
||||
plt.plot(diff, '+', label="difference")
|
||||
plt.legend()
|
||||
plt.savefig("diff.pdf")
|
||||
|
||||
sorted_diff = np.sort(diff)
|
||||
p = 1. * np.arange(len(sorted_diff)) / (len(sorted_diff) - 1)
|
||||
|
||||
|
||||
plt.plot(sorted_diff, p, label="proba de dépassement de k 0")
|
||||
plt.legend()
|
||||
plt.xlabel("k")
|
||||
plt.savefig("distribution.pdf")
|
||||
|
||||
ratio=[]
|
||||
for v in range(len(targets)):
|
||||
ratio.append(hashvalues[v]/targets[v])
|
||||
|
||||
plt.clf()
|
||||
plt.plot(ratio)
|
||||
|
||||
sorted_ratio = np.sort(ratio)
|
||||
p = 1. * np.arange(len(sorted_ratio))/(len(sorted_ratio) -1)
|
||||
plt.clf()
|
||||
plt.plot(range(len(p)), p, label="$\mathfrak{diff}(b)/\mathfrak{target}(b)$")
|
||||
plt.legend(loc="lower right")
|
||||
plt.savefig("distribution_ratio.pdf")
|
||||
BIN
figs/distribution_ratio.pdf
Normal file
BIN
figs/distribution_ratio.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user