plot progress per run

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-03-27 23:16:05 +02:00
parent 73e02a132d
commit 8867f54a22
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
2 changed files with 16 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import networkx as nx import networkx as nx
import logging, random import logging, random
import pandas as pd import pandas as pd
import matplotlib
from functools import partial, partialmethod from functools import partial, partialmethod
from datetime import datetime from datetime import datetime
from DAS.tools import * from DAS.tools import *
@ -25,6 +26,7 @@ class Simulator:
self.logLevel = config.logLevel self.logLevel = config.logLevel
self.proposerID = 0 self.proposerID = 0
self.glob = [] self.glob = []
self.execID = execID
# In GossipSub the initiator might push messages without participating in the mesh. # In GossipSub the initiator might push messages without participating in the mesh.
# proposerPublishOnly regulates this behavior. If set to true, the proposer is not # proposerPublishOnly regulates this behavior. If set to true, the proposer is not
@ -244,6 +246,16 @@ class Simulator:
progress = pd.DataFrame(progressVector) progress = pd.DataFrame(progressVector)
if self.config.saveProgress: if self.config.saveProgress:
self.result.addMetric("progress", progress.to_dict(orient='list')) self.result.addMetric("progress", progress.to_dict(orient='list'))
if self.config.plotProgress:
progress.plot.line(subplots = [[cnS, cnN, cnV], [cnT0], [cnT1, cnR1, cnD1], [cnT2, cnR2, cnD2]],
title = str(self.shape))
if not os.path.exists("results"):
os.makedirs("results")
if not os.path.exists("results/"+self.execID):
os.makedirs("results/"+self.execID)
filePath = "results/"+self.execID+"/"+str(self.shape)+".png"
matplotlib.pyplot.savefig(filePath)
self.result.populate(self.shape, self.config, missingVector) self.result.populate(self.shape, self.config, missingVector)
return self.result return self.result

View File

@ -22,6 +22,10 @@ dumpXML = 1
# save progress vectors to XML # save progress vectors to XML
saveProgress = 1 saveProgress = 1
# plot progress for each run to PNG
plotProgress = 1
visualization = 1 visualization = 1
logLevel = logging.INFO logLevel = logging.INFO