check_blockages.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import sys
  2. import pandas as pd
  3. import matplotlib
  4. import matplotlib.pyplot as plt
  5. from matplotlib.lines import Line2D
  6. def main():
  7. fig, axs = plt.subplots(1, 3, figsize=(24, 7))
  8. columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  9. "ReTstdev", "ResponseHT", "RHTstdev"]
  10. df = pd.read_csv("standard_check"+".csv", usecols=columns)
  11. df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True)
  12. bridges = df.Bridges*2*3
  13. fig.supxlabel('Blocked Bridges (%)', size=30)
  14. axs[0].set_ylabel('Response Time (ms)', size=25)
  15. axs[0].tick_params(axis='x', labelsize=15)
  16. axs[0].tick_params(axis='y', labelsize=15)
  17. # axs[0].set_xticklabels('Blocked Bridges (%)',fontsize=10)
  18. axs[0].plot(df.Percent, df.ResponseT, color='#CC4F1B',
  19. label='Response Time for Percentage of Bridges Blocked')
  20. axs[0].fill_between(df.Percent, df.ResponseT-df.ReTstdev,
  21. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B',
  22. facecolor='#FF9848')
  23. axs[1].set_ylabel('Response Size (bytes)', size=25)
  24. axs[1].tick_params(axis='x', labelsize=15)
  25. axs[1].tick_params(axis='y', labelsize=15)
  26. axs[1].plot(df.Percent, df.ResponseS, color='#CC4F1B',
  27. label='Response Size for Percentage of Bridges Blocked')
  28. axs[2].set_ylabel('Response Handling Time (ms)', size=25)
  29. axs[2].tick_params(axis='x', labelsize=15)
  30. axs[2].tick_params(axis='y', labelsize=15)
  31. axs[2].plot(df.Percent, df.ResponseHT, color='#CC4F1B',
  32. label='Response Handling Time for Percentage of Bridges Blocked')
  33. axs[2].fill_between(df.Percent, df.ResponseHT-df.RHTstdev,
  34. df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#CC4F1B',
  35. facecolor='#FF9848')
  36. fig. tight_layout(pad=1)
  37. fig.savefig("StandardCheck.pdf")
  38. plt.close('all')
  39. for n in range(5,105,5):
  40. fig, axs = plt.subplots(1, 3, figsize=(24, 7))
  41. columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  42. "ReTstdev", "ResponseHT", "RHTstdev"]
  43. df = pd.read_csv("checkblockage"+str(n)+".csv", usecols=columns)
  44. bridges = df.Bridges*2*3
  45. fig.supxlabel('Total Size of Bridge Pool ('+str(n)+'% Bridges Blocked)',size=30)
  46. axs[0].set_ylabel('Response Time (ms)', size=25)
  47. axs[0].tick_params(axis='x', labelsize=15)
  48. axs[0].tick_params(axis='y', labelsize=15)
  49. axs[0].plot(bridges, df.ResponseT, color='#740202',
  50. label='Response Time for Percentage of Bridges Blocked')
  51. axs[0].fill_between(bridges, df.ResponseT-df.ReTstdev,
  52. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#740202',
  53. facecolor='#E75252')
  54. axs[1].set_ylabel('Response Size (bytes)', size=25)
  55. axs[1].tick_params(axis='x', labelsize=15)
  56. axs[1].tick_params(axis='y', labelsize=15)
  57. axs[1].plot(bridges, df.ResponseS, color='#740202',
  58. label='Response Size for Percentage of Bridges Blocked')
  59. axs[2].set_ylabel('Response Handling Time (ms)', size=25)
  60. axs[2].tick_params(axis='x', labelsize=15)
  61. axs[2].tick_params(axis='y', labelsize=15)
  62. axs[2].plot(bridges, df.ResponseHT, color='#740202',
  63. label='Response Handling Time for Percentage of Bridges Blocked')
  64. axs[2].fill_between(bridges, df.ResponseHT-df.RHTstdev,
  65. df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#740202',
  66. facecolor='#E75252')
  67. fig. tight_layout(pad=1)
  68. fig.savefig("PerformanceVaried"+str(n)+".pdf")
  69. print("\nDone PerformanceVaried"+str(n)+" Plot.\nOutput to: PerformanceVaried"+str(n)+".pdf")
  70. plt.close('all')
  71. def set_plot_options():
  72. options = {
  73. 'font.size': 12,
  74. 'figure.figsize': (4,2),
  75. 'figure.dpi': 100.0,
  76. 'figure.subplot.left': 0.20,
  77. 'figure.subplot.right': 0.97,
  78. 'figure.subplot.bottom': 0.20,
  79. 'figure.subplot.top': 0.90,
  80. 'grid.color': '0.1',
  81. 'grid.linestyle': ':',
  82. #'grid.linewidth': 0.5,
  83. 'axes.grid' : True,
  84. #'axes.grid.axis' : 'y',
  85. #'axes.axisbelow': True,
  86. 'axes.titlesize' : 25,
  87. 'axes.labelsize' : 25,
  88. 'axes.formatter.limits': (-4,4),
  89. 'xtick.labelsize' : 30,#get_tick_font_size_10(),
  90. 'ytick.labelsize' : 30,#get_tick_font_size_10(),
  91. 'lines.linewidth' : 2.0,
  92. 'lines.markeredgewidth' : 0.5,
  93. 'lines.markersize' : 15,
  94. }
  95. for option_key in options:
  96. matplotlib.rcParams[option_key] = options[option_key]
  97. if 'figure.max_num_figures' in matplotlib.rcParams:
  98. matplotlib.rcParams['figure.max_num_figures'] = 100
  99. if 'figure.max_open_warning' in matplotlib.rcParams:
  100. matplotlib.rcParams['figure.max_open_warning'] = 100
  101. if __name__ == "__main__":
  102. sys.exit(main())