From 6fe0fab6d083f2478b89beb58e83a3a7315afb98 Mon Sep 17 00:00:00 2001 From: Leonardo Bautista-Gomez Date: Fri, 21 Apr 2023 17:14:55 +0200 Subject: [PATCH] Inverse heatmap --- DAS/visualizer.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/DAS/visualizer.py b/DAS/visualizer.py index b28016a..5d2f341 100644 --- a/DAS/visualizer.py +++ b/DAS/visualizer.py @@ -16,12 +16,13 @@ class Visualizer: self.folderPath = "results/"+self.execID self.parameters = ['run', 'blockSize', 'failureRate', 'numberNodes', 'netDegree', 'chi', 'vpn1', 'vpn2', 'class1ratio', 'bwUplinkProd', 'bwUplink1', 'bwUplink2'] self.minimumDataPoints = 2 - self.maxTTA = 999 + self.maxTTA = 99 def plottingData(self): """Store data with a unique key for each params combination""" data = {} bw = [] + print("Getting data from the folder...") """Loop over the xml files in the folder""" for filename in os.listdir(self.folderPath): """Loop over the xmls and store the data in variables""" @@ -41,9 +42,8 @@ class Visualizer: bwUplink1 = int(root.find('bwUplink1').text) bwUplink2 = int(root.find('bwUplink2').text) tta = int(root.find('tta').text) - - # if tta == -1: - # tta = self.maxTTA + if tta == -1: + tta = self.maxTTA """Store BW""" bw.append(bwUplinkProd) @@ -80,7 +80,6 @@ class Visualizer: else: data[key][otherParams[1]] = [selectedValues[otherIndices[1]]] data[key]['ttas'].append(tta) - print("Getting data from the folder...") return data def averageRuns(self, data, runs): @@ -116,7 +115,6 @@ class Visualizer: else: averages[subkey] = data[key][subkey] newData[newKey] = averages - self.maxTTA = max(allTta) + 10 return newData def similarKeys(self, data): @@ -171,7 +169,7 @@ class Visualizer: hist, xedges, yedges = np.histogram2d(data[key][labels[0]], data[key][labels[1]], bins=(len(xlabels), len(ylabels)), weights=data[key]['ttas'], normed=False) hist = hist.T fig, ax = plt.subplots(figsize=(10, 6)) - sns.heatmap(hist, xticklabels=xlabels, yticklabels=ylabels, cmap='Purples', cbar_kws={'label': 'Time to block availability'}, linecolor='black', linewidths=0.3, annot=True, fmt=".2f", ax=ax, vmin=vmin, vmax=vmax) + sns.heatmap(hist, xticklabels=xlabels, yticklabels=ylabels, cmap='hot_r', cbar_kws={'label': 'Time to block availability'}, linecolor='black', linewidths=0.3, annot=True, fmt=".2f", ax=ax, vmin=vmin, vmax=vmax) plt.xlabel(self.formatLabel(labels[0])) plt.ylabel(self.formatLabel(labels[1])) filename = "" @@ -242,4 +240,4 @@ class Visualizer: plt.ylabel('Price') #Test - plt.show() \ No newline at end of file + plt.show()