Commit 7807a728 authored by Britta Heymann's avatar Britta Heymann
Browse files

Merge remote-tracking branch 'remotes/origin/master' into feature-#731-refactor-eval-scripts

# Conflicts:
#	toolkit/reportSummary/delayDistributionAnalysis.py
parents 877b35cc aa6422a8
Pipeline #17176 passed with stages
in 4 minutes and 42 seconds
......@@ -69,7 +69,7 @@ def parseDelayAnalysis(fileName, messageType, messagePrio):
def plotDelayDistribution(title, delayClasses, percentageDelivered):
"""Plots a delay distribution as a bar chart."""
plt.title(title)
plt.bar(delayClasses, percentageDelivered)
plt.bar(delayClasses, percentageDelivered, color='#003a80')
plt.ylabel('Percentage of messages')
plt.grid(True)
axes = plt.gca()
......@@ -77,7 +77,7 @@ def plotDelayDistribution(title, delayClasses, percentageDelivered):
def plotCumulativeDelay(delayClasses, cumulativePercentages):
"""Plots a cumulative delay chart."""
plt.plot(delayClasses, cumulativePercentages)
plt.plot(delayClasses, cumulativePercentages, color='#003a80')
plt.xlabel('Delay in minutes')
plt.ylabel('Cumulative percentage')
plt.grid(True)
......
......@@ -47,7 +47,9 @@ def createDeliveryPieChart(created, delivered, delivery_prob):
# Create pie chart.
fig1, ax1 = plt.subplots()
ax1.pie(values, labels=labels, shadow=True, explode=(0.1, 0), labeldistance=0.3)
_, texts = ax1.pie(values, labels=labels, shadow=True, explode=(0.1, 0), labeldistance=0.3)
for text in texts:
text.set_fontsize(12)
ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
#Add total sum
......
......@@ -42,61 +42,61 @@ perlNames = [["messageDelayAnalyzer.pl", "realisticScenario_ImmediateMessageDela
necessaryAnalyses = []
for (script, input, output) in perlNames:
necessaryAnalyses.append(["../"+script, reportDir+input+".txt", reportDir+output+".txt"])
necessaryAnalyses.append(["../"+script, os.path.join(reportDir, input+".txt"), os.path.join(reportDir, output+".txt")])
#Execute script with input and write to output
print("You are running", sys.platform)
for (script, input, output) in necessaryAnalyses:
with open(output, 'w', 1) as file:
process = subprocess.run("perl "+ script + " "+ input + " " + granularity, stdout=file)
process = subprocess.run("perl "+ script + ' "' + input + '" ' + granularity, stdout=file)
if (sys.platform == "linux"):
file.write(process.stdout)
print("Successfully created ", output)
# Create images/ directory in reports directory if it does not exist yet
imageDirectoryName = reportDir + 'images/'
imageDirectoryName = os.path.join(reportDir, 'images/')
if not os.path.exists(imageDirectoryName):
os.makedirs(imageDirectoryName)
print("Made sure directory exists: ", imageDirectoryName)
# Call all visualization scripts
trafficAnalysis.main(
analysisFileName=reportDir+"realisticScenario_TrafficReport.txt",
analysisFileName=os.path.join(reportDir, "realisticScenario_TrafficReport.txt"),
graphicFileName=readFileUtilities.getAbsoluteTrafficAnalysisPath(imageDirectoryName))
bufferOccupancy.main(
analysisFileName=reportDir+"realisticScenario_BufferOccupancyReport.txt",
analysisFileName=os.path.join(reportDir, "realisticScenario_BufferOccupancyReport.txt"),
graphicFileName=readFileUtilities.getAbsoluteBufferOccupancyAnalysisPath(imageDirectoryName))
privateMessageAnalysis.main(
analysisFileName=reportDir+"realisticScenario_DeliveryProbabilityReport.txt",
analysisFileName=os.path.join(reportDir, "realisticScenario_DeliveryProbabilityReport.txt"),
graphicFileName=readFileUtilities.getAbsoluteDeliveryRatePath(imageDirectoryName))
delayDistributionAnalysis.main(
analysisFileName=reportDir+"messageDelayAnalysis.txt",
analysisFileName=os.path.join(reportDir, "messageDelayAnalysis.txt"),
messageType="ONE_TO_ONE",
messagePrio=0,
graphicFileName=readFileUtilities.getAbsoluteOneToOneMessageDelayPath(imageDirectoryName))
broadcastAnalysis.main(
analysisFileName=reportDir+"broadcastMessageAnalysis.txt",
analysisFileName=os.path.join(reportDir, "broadcastMessageAnalysis.txt"),
graphicFileName=readFileUtilities.getAbsoluteBroadcastAnalysisPath(imageDirectoryName))
relevantPriorities = [2, 5, 9]
for prio in relevantPriorities:
delayDistributionAnalysis.main(
analysisFileName=reportDir+"messageDelayAnalysis.txt",
analysisFileName=os.path.join(reportDir, "messageDelayAnalysis.txt"),
messageType="BROADCAST",
messagePrio=prio,
graphicFileName=readFileUtilities.getAbsoluteBroadcastDelayPath(imageDirectoryName, prio))
multicastAnalysis.main(
analysisFileName=reportDir+"multicastMessageAnalysis.txt",
analysisFileName=os.path.join(reportDir, "multicastMessageAnalysis.txt"),
graphicFileName=readFileUtilities.getAbsoluteMulticastAnalysisPath(imageDirectoryName))
delayDistributionAnalysis.main(
analysisFileName=reportDir+"messageDelayAnalysis.txt",
analysisFileName=os.path.join(reportDir, "messageDelayAnalysis.txt"),
messageType="MULTICAST",
messagePrio=1,
graphicFileName=readFileUtilities.getAbsoluteMulticastDelayPath(imageDirectoryName))
dataSyncAnalysis.main(
analysisFileName=reportDir+"realisticScenario_DataSyncReport.txt",
analysisFileName=os.path.join(reportDir, "realisticScenario_DataSyncReport.txt"),
graphicFileName=readFileUtilities.getAbsoluteDataAnalysisPath(imageDirectoryName))
energyAnalysis.main(
analysisFileName=reportDir+"realisticScenario_EnergyLevelReport.txt",
analysisFileName=os.path.join(reportDir, "realisticScenario_EnergyLevelReport.txt"),
graphicFileName=readFileUtilities.getAbsoluteEnergyAnalysisPath(imageDirectoryName))
print("Successfully created all graphics. Creating pdf...")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment