Skip to content

Commit 13cb2f4

Browse files
committed
display the experienced errors
1 parent a6c4dbf commit 13cb2f4

File tree

1 file changed

+86
-1
lines changed

1 file changed

+86
-1
lines changed

src/analyzer/armiarma-analyzer.py

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def plotStackBarsFromArrays(xarray, yarray, pdf, opts):
9292
bottom[i] = bottom[i] + subarray[i]
9393

9494
# labels
95-
if opts['ylabel'] is not None:
95+
if opts['ylabel'] is not None:
9696
plt.ylabel(opts['ylabel'], fontsize=opts['labelSize'])
9797
if opts['xlabel'] is not None:
9898
plt.xlabel(opts['xlabel'], fontsize=opts['labelSize'])
@@ -163,6 +163,53 @@ def plotBarsFromArrays(xarray, yarray, pdf, opts):
163163
if opts['show'] is True:
164164
plt.show()
165165

166+
# CortzePlot extension to plot bar-charts
167+
def plotHorizontalBarsFromArrays(xarray, yarray, pdf, opts):
168+
print("Bar Graph from Arrays")
169+
170+
outputFile = str(opts['outputPath']) + '/' + opts['figTitle']
171+
print('printing image', opts['figTitle'], 'on', outputFile)
172+
173+
fig = plt.figure(figsize = opts['figSize'])
174+
175+
barh = plt.barh(range(len(xarray)), yarray, log=opts['logy'], align=opts['align'], color=opts['barColor'], label=xarray)
176+
177+
178+
# labels
179+
if opts['ylabel'] is not None:
180+
plt.ylabel(opts['ylabel'], fontsize=opts['labelSize'])
181+
if opts['xlabel'] is not None:
182+
plt.xlabel(opts['xlabel'], fontsize=opts['labelSize'])
183+
184+
# Ticks LABELS
185+
if opts['yticks'] is not None:
186+
plt.yticks(range(len(xarray)), opts['yticks'], rotation=opts['tickRotation'], fontsize=opts['yticksSize'])
187+
else:
188+
plt.yticks(range(len(xarray)), {},)
189+
#plt.xticks(range(len(xarray)))
190+
191+
plt.margins(x=0)
192+
plt.yticks(fontsize=opts['yticksSize'])
193+
plt.ylim(opts['yLowLimit'], opts['yUpperLimit'])
194+
195+
# Set/No the grids if specified
196+
if opts['vGrids'] != False:
197+
plt.grid(which='major', axis='x', linestyle='--')
198+
199+
# loc='upper center'
200+
201+
plt.legend(barh, xarray, loc='upper center', ncol=len(xarray), fancybox=True, title=opts['legendTitle'], title_fontsize=opts['legendSize'] )
202+
#plt.legend(handles=legends, bbox_to_anchor=(0.5, -0.05), fancybox=True, shadow=True, ncol=len(xarray))
203+
204+
# Title
205+
plt.title(opts['title'], fontsize = opts['titleSize'])
206+
plt.tight_layout()
207+
plt.savefig(outputFile)
208+
pdf.savefig(plt.gcf())
209+
if opts['show'] is True:
210+
plt.show()
211+
212+
166213
# Sort xarray and y array By Values from Max to Min
167214
def sortArrayMaxtoMin(xarray, yarray):
168215
iterations = len(xarray)
@@ -631,6 +678,7 @@ def main():
631678
nonAttempted = 0
632679
succeed = 0
633680
failed = 0
681+
634682
print("extra metrics len:", len(extraPeerData))
635683
for index, row in extraPeerData.iterrows():
636684
if row['Attempted'] == False:
@@ -685,6 +733,43 @@ def main():
685733
'tickRotation': 0,
686734
'show': False})
687735

736+
## Classify the non connected peers by error
737+
738+
errorList = getItemsFromColumn(extraPeerData, 'Error')
739+
errorList.remove('None')
740+
auxxarray, auxyarray = getDataFromPanda(extraPeerData, None, "Error", errorList, 'counter')
741+
xarray, yarray = sortArrayMaxtoMin(auxxarray, auxyarray)
742+
# Get Color Grid
743+
barColor = GetColorGridFromArray(yarray)
744+
745+
746+
plotHorizontalBarsFromArrays(xarray, yarray, pdf, opts={
747+
'figSize': (12,7),
748+
'figTitle': 'DetectedErrorDistribution.png',
749+
'pdf': pdfFile,
750+
'outputPath': outputFigsFolder,
751+
'align': 'center',
752+
'barValues': False,
753+
'logy': False,
754+
'barColor': barColor,
755+
'textSize': textSize+2,
756+
'yLowLimit': None,
757+
'yUpperLimit': None,
758+
'title': "Distribution of the detected errors",
759+
'xlabel': 'Number of peers',
760+
'ylabel': None,
761+
'yticks': None,
762+
'vGrids': True,
763+
'titleSize': titleSize+2,
764+
'labelSize': labelSize+2,
765+
'legendPosition': 1,
766+
'legendTitle': 'Experienced errors',
767+
'legendSize': labelSize-4,
768+
'xticksSize': ticksSize,
769+
'yticksSize': ticksSize+2,
770+
'tickRotation': 0,
771+
'show': False})
772+
688773
clientCounter = []
689774
types = []
690775
typesCounter = []

0 commit comments

Comments
 (0)