-
Notifications
You must be signed in to change notification settings - Fork 0
/
weibull-test.py
executable file
·50 lines (41 loc) · 1.34 KB
/
weibull-test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python
"""Testing Weibull distribution"""
import numpy as np
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
# k values are drawn from Tiwari et al., DSN 2014
k = 0.64
y = np.random.weibull(k, size=100000)
v = abs(np.diff(y)) # Difference between two consecutive elements
print("k=%.2f" % (k))
print("max: %.2f" % (max(v)))
print("min: %.2f" % (min(v)))
print("avg: %.2f" % (np.mean(v)))
n, bins, patches = plt.hist(v, histtype='step', fill=False, label=r"$\kappa=%.2f$" %(k))
plt.xlim([min(v), max(v)])
plt.plot(bins)
k = 0.82
y = np.random.weibull(k, size=100000)
v = abs(np.diff(y)) # Difference between two consecutive elements
print("k=%.2f" % (k))
print("max: %.2f" % (max(v)))
print("min: %.2f" % (min(v)))
print("avg: %.2f" % (np.mean(v)))
n, bins, patches = plt.hist(v, histtype='step', fill=False, label=r"$\kappa=%.2f$" %(k))
#plt.xlim([min(v), max(v)])
plt.plot(bins)
k = 0.96
y = np.random.weibull(k, size=100000)
v = abs(np.diff(y)) # Difference between two consecutive elements
print("k=%.2f" % (k))
print("max: %.2f" % (max(v)))
print("min: %.2f" % (min(v)))
print("avg: %.2f" % (np.mean(v)))
n, bins, patches = plt.hist(v, histtype='step', fill=False, label=r"$\kappa=%.2f$" %(k))
#plt.xlim([min(v), max(v)])
plt.plot(bins)
plt.xlabel("Inter-arrival time")
plt.ylabel("Frequency")
plt.legend()
plt.show()