This commit is contained in:
Valentin Brandl
2022-04-24 23:23:22 +02:00
parent 78fd60fc12
commit 8e03043f8b
14 changed files with 41 additions and 30 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import numpy as np
import statistics
from collections import defaultdict
from typing import Dict
@ -26,7 +27,8 @@ def plot_devi(data: Dict[datetime, str]):
# c = 0
per_diff = defaultdict(list)
for prev, next in zip(sor, sor[1:]):
diff = abs(2.5 - (next[0].timestamp() - prev[0].timestamp()))
# diff = abs(2.5 - (next[0].timestamp() - prev[0].timestamp()))
diff = ((next[0].timestamp() - prev[0].timestamp()) - 2.5)
diffs.append(diff)
per_crawler[prev[1]].append(prev[0])
per_diff[prev[1]].append(diff)
@ -72,16 +74,20 @@ def plot_devi(data: Dict[datetime, str]):
t = per_crawler[c]
devi = []
for pre, nex in zip(t, t[1:]):
devi.append(abs(10 - (nex.timestamp() - pre.timestamp())))
x = [10 * x for x in range(len(devi))]
# devi.append(abs(10 - (nex.timestamp() - pre.timestamp())))
devi.append(((nex.timestamp() - pre.timestamp()) - 10))
x = np.array([10 * x for x in range(len(devi))])
devi = np.array(devi)
fig, ax = plt.subplots()
ax.scatter(x, devi, s=10)
m, b = np.polyfit(x, devi, 1)
plt.plot(x, m*x+b, color='red')
ax.set_title(f'Timedeviation for {c}')
ax.set_xlabel('Time passed in seconds')
ax.set_ylabel('Deviation in seconds')
plt.savefig(f'./time_devi_{c}.png')
plt.close()
print(f'{c}: {statistics.mean(devi)}')
print(f'{c} & \\num{{{statistics.mean(devi)}}} \\\\')
# for ts in per_crawler[c]:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB