Content
@ -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]:
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 43 KiB |