Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. from scipy.stats import dirichlet
  2. from scipy.stats import beta
  3. import time
  4. a = 1
  5. b = 1
  6. c = 1
  7. n = 3
  8. A = []
  9. B = []
  10. C = []
  11. A.append(a / n)
  12. B.append(b / n)
  13. C.append(c / n)
  14. tmp = []
  15. tmp.append(n)
  16. #hostname = 'www.google.com'
  17. treshold1 = 10.2
  18. treshold2 = 14
  19.  
  20. fig = plt.figure(23)
  21. ax = fig.add_subplot(111)
  22. fig.show()
  23. fig.canvas.draw()
  24.  
  25. for i in range(100):
  26. X = ping(hostname)
  27. n += 1
  28. time.sleep(.01)
  29. if X <= treshold1:
  30. a += 1
  31. elif X <= treshold2:
  32. b += 1
  33. else:
  34. c += 1
  35. A.append(a / n)
  36. B.append(b / n)
  37. C.append(c / n)
  38. tmp.append(n)
  39. ax.stackplot(tmp, A, B, C, labels=[a,b,c], colors=['G', 'B', 'R'])
  40.  
  41. plt.title(f'X = {X}')
  42.  
  43. fig.canvas.draw()
  44. time.sleep(.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement