Browse Source

update for more accurate computational complexity for HbC

Stan Gurtler 2 years ago
parent
commit
5447d4e677
1 changed files with 10 additions and 1 deletions
  1. 10 1
      prsona/scripts/make_graphs.py

+ 10 - 1
prsona/scripts/make_graphs.py

@@ -168,6 +168,9 @@ def genericCube(x, a, b, c, d):
 def onlyCube(x, a):
     return a * (x * x * x)
 
+def onlySquare(x, a):
+    return a * (x * x)
+
 def readData(dataDirectory):
     serverData = {}
     clientData = {}
@@ -497,12 +500,18 @@ def plotComparison(data, dataParts, xVariable, lineVariable, whichGraph, **kwarg
                 popt, pcov = curve_fit(genericCube, xs, ys)
                 beyondXs = np.linspace(xs[-1], 100, 50)
                 ax.plot(beyondXs, genericCube(beyondXs, *popt), linestyle='--', color=color)
-            if loglog and not loglogLineFit:
+            if loglog and not loglogLineFit and dataParts[3] != '0':
                 popt, pcov = curve_fit(onlyCube, xs, ys)
                 moreXs = np.linspace(5, 50, 45)
                 labelString = "Line of best fit with slope = 3"
                 ax.plot(moreXs, onlyCube(moreXs, *popt), label=labelString, color="black")
                 loglogLineFit = True
+            if loglog and not loglogLineFit and dataParts[3] == '0':
+                popt, pcov = curve_fit(onlySquare, xs, ys)
+                moreXs = np.linspace(5, 50, 45)
+                labelString = "Line of best fit with slope = 2"
+                ax.plot(moreXs, onlySquare(moreXs, *popt), label=labelString, color="black")
+                loglogLineFit = True
         
     ax.set_title(title, fontsize='x-large')
     ax.set_xlabel(xLabel, fontsize='large')