Fix runs bug
This commit is contained in:
parent
89368d5fbe
commit
b36a94e269
|
@ -6,12 +6,12 @@ import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import seaborn as sns
|
import seaborn as sns
|
||||||
from itertools import combinations
|
from itertools import combinations
|
||||||
from config_example import runs
|
|
||||||
|
|
||||||
class Visualizer:
|
class Visualizer:
|
||||||
|
|
||||||
def __init__(self, execID):
|
def __init__(self, execID, config):
|
||||||
self.execID = execID
|
self.execID = execID
|
||||||
|
self.config = config
|
||||||
self.folderPath = "results/"+self.execID
|
self.folderPath = "results/"+self.execID
|
||||||
self.parameters = ['run', 'blockSize', 'failureRate', 'numberNodes', 'netDegree', 'chi', 'vpn1', 'vpn2', 'class1ratio', 'bwUplinkProd', 'bwUplink1', 'bwUplink2']
|
self.parameters = ['run', 'blockSize', 'failureRate', 'numberNodes', 'netDegree', 'chi', 'vpn1', 'vpn2', 'class1ratio', 'bwUplinkProd', 'bwUplink1', 'bwUplink2']
|
||||||
self.minimumDataPoints = 2
|
self.minimumDataPoints = 2
|
||||||
|
@ -81,7 +81,7 @@ class Visualizer:
|
||||||
data[key]['ttas'].append(tta)
|
data[key]['ttas'].append(tta)
|
||||||
print("Getting data from the folder...")
|
print("Getting data from the folder...")
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def averageRuns(self, data, runs):
|
def averageRuns(self, data, runs):
|
||||||
"""Get the average of run 0 and run 1 for each key"""
|
"""Get the average of run 0 and run 1 for each key"""
|
||||||
newData = {}
|
newData = {}
|
||||||
|
@ -146,12 +146,12 @@ class Visualizer:
|
||||||
"""Plot and store the 2D heatmaps in subfolders"""
|
"""Plot and store the 2D heatmaps in subfolders"""
|
||||||
data= self.plottingData()
|
data= self.plottingData()
|
||||||
"""Average the runs if needed"""
|
"""Average the runs if needed"""
|
||||||
if(len(runs) > 1):
|
if(len(self.config.runs) > 1):
|
||||||
data = self.averageRuns(data, len(runs))
|
data = self.averageRuns(data, len(self.config.runs))
|
||||||
filteredKeys = self.similarKeys(data)
|
filteredKeys = self.similarKeys(data)
|
||||||
vmin, vmax = 0, self.maxTTA
|
vmin, vmax = 0, self.maxTTA
|
||||||
print("Plotting heatmaps...")
|
print("Plotting heatmaps...")
|
||||||
|
|
||||||
"""Create the directory if it doesn't exist already"""
|
"""Create the directory if it doesn't exist already"""
|
||||||
heatmapsFolder = self.folderPath + '/heatmaps'
|
heatmapsFolder = self.folderPath + '/heatmaps'
|
||||||
if not os.path.exists(heatmapsFolder):
|
if not os.path.exists(heatmapsFolder):
|
||||||
|
@ -189,7 +189,7 @@ class Visualizer:
|
||||||
plt.savefig(os.path.join(targetFolder, filename))
|
plt.savefig(os.path.join(targetFolder, filename))
|
||||||
plt.close()
|
plt.close()
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
|
||||||
def plotHist(self, bandwidth):
|
def plotHist(self, bandwidth):
|
||||||
"""Plot Bandwidth Frequency Histogram"""
|
"""Plot Bandwidth Frequency Histogram"""
|
||||||
plt.hist(bandwidth, bins=5)
|
plt.hist(bandwidth, bins=5)
|
||||||
|
@ -203,4 +203,4 @@ class Visualizer:
|
||||||
os.makedirs(histogramFolder)
|
os.makedirs(histogramFolder)
|
||||||
filename = os.path.join(histogramFolder, 'histogram.png')
|
filename = os.path.join(histogramFolder, 'histogram.png')
|
||||||
plt.savefig(filename)
|
plt.savefig(filename)
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
|
2
study.py
2
study.py
|
@ -60,7 +60,7 @@ def study():
|
||||||
sim.logger.info("Results dumped into results/%s/" % (execID), extra=sim.format)
|
sim.logger.info("Results dumped into results/%s/" % (execID), extra=sim.format)
|
||||||
|
|
||||||
if config.visualization:
|
if config.visualization:
|
||||||
vis = Visualizer(execID)
|
vis = Visualizer(execID, config)
|
||||||
vis.plotHeatmaps()
|
vis.plotHeatmaps()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue