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