From 0656789c125a30ac2e2a327f0f0d504123df68ab Mon Sep 17 00:00:00 2001 From: Sudipta Basak Date: Thu, 28 Mar 2024 04:47:12 +0000 Subject: [PATCH] Added grid lines in plot --- ConnectivityTest/MaliciousNodesVsNetDegree/prog.py | 5 +++-- ConnectivityTest/MaliciousNodesVsNumberOfNodes/prog.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ConnectivityTest/MaliciousNodesVsNetDegree/prog.py b/ConnectivityTest/MaliciousNodesVsNetDegree/prog.py index b85787c..e7359b1 100644 --- a/ConnectivityTest/MaliciousNodesVsNetDegree/prog.py +++ b/ConnectivityTest/MaliciousNodesVsNetDegree/prog.py @@ -14,6 +14,7 @@ def plotData(conf): plt.ylabel(conf['ylabel']) plt.title(conf['title']) plt.legend() + plt.grid(True) plt.savefig(conf['plotPath']) plt.clf() @@ -37,7 +38,7 @@ def getValidatorCountPerColumn(numberOfCols, numOfValidators, chiC): return validatorCountPerColumn -def runOnce(run_i, runs, deg, validatorCountPerCol, malNodesPercentage): +def runOnce(deg, validatorCountPerCol, malNodesPercentage): isParted = False partCount = 0 isPartedCount = 0 @@ -63,7 +64,7 @@ def study(): for mal in mals: isPartedCount = partCount = 0 validatorCountPerColumn = getValidatorCountPerColumn(numberOfColumns, numberOfValidators, custody) - results = Parallel(-1)(delayed(runOnce)(_run, runs, deg, validatorCountPerColumn, mal) for _run in range(runs)) + results = Parallel(-1)(delayed(runOnce)(deg, validatorCountPerColumn, mal) for _run in range(runs)) isPartedCount = sum([res[0] for res in results]) partCount = sum([res[1] for res in results]) partPercentages.append(isPartedCount * 100 / runs) diff --git a/ConnectivityTest/MaliciousNodesVsNumberOfNodes/prog.py b/ConnectivityTest/MaliciousNodesVsNumberOfNodes/prog.py index 3a875f4..54b3520 100644 --- a/ConnectivityTest/MaliciousNodesVsNumberOfNodes/prog.py +++ b/ConnectivityTest/MaliciousNodesVsNumberOfNodes/prog.py @@ -15,6 +15,7 @@ def plotData(conf): plt.ylabel(conf['ylabel']) plt.title(conf['title']) plt.legend() + plt.grid(True) plt.savefig(conf['plotPath']) plt.clf() @@ -38,7 +39,7 @@ def getValidatorCountPerColumn(numberOfCols, numOfValidators, chiC): return validatorCountPerColumn -def runOnce(run_i, runs, deg, validatorCountPerCol, malNodesPercentage): +def runOnce(deg, validatorCountPerCol, malNodesPercentage): isParted = False partCount = 0 isPartedCount = 0 @@ -64,7 +65,7 @@ def study(): for mal in mals: isPartedCount = partCount = 0 validatorCountPerColumn = getValidatorCountPerColumn(numberOfColumns, nv, custody) - results = Parallel(-1)(delayed(runOnce)(_run, runs, deg, validatorCountPerColumn, mal) for _run in range(runs)) + results = Parallel(-1)(delayed(runOnce)(deg, validatorCountPerColumn, mal) for _run in range(runs)) isPartedCount = sum([res[0] for res in results]) partCount = sum([res[1] for res in results]) partPercentages.append(isPartedCount * 100 / runs)