diff --git a/main.py b/main.py index 6cda3f3..b283c75 100644 --- a/main.py +++ b/main.py @@ -21,19 +21,13 @@ def makeActualDataGraph(testRun): return data1, data2 - makeGraph({ - "title": f"Strain over Time\nRun: {testRun+1}", - "xLabel": "Time (ms) - Δt = 10ms", - "yLabel": "Strain (ε)", - "plots":[ - {"type":"scatter", "x": data1["Time"], "y": data1["Strain"], "args":{"s":10, "zorder":2}, "label":"Upper", "colour": UQC["purple"]}, - {"type":"scatter", "x": data2["Time"], "y": data2["Strain"], "args":{"s":10, "zorder":1}, "label":"Lower", "colour": UQC["dark_grey"]}, - {"type":"plot", "x": data1["Time"], "y": data1["Strain"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["purple"]}, - {"type":"plot", "x": data2["Time"], "y": data2["Strain"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["dark_grey"]}, - - ] - }) +def makeCalibrationDataGraph(testRun): + cols = [f"Unnamed: {3 + testRun*5}", f"Unnamed: {2 + testRun*5}"] + data = calibrationData[cols].rename(columns = {cols[0]:'Time', cols[1]:'Strain'}) + data = data[5:505].astype({"Time":"int", "Strain":"float"}) + + return data if __name__ == "__main__": if not os.path.isdir("./images"): @@ -53,7 +47,7 @@ if __name__ == "__main__": data1, data2 = makeActualDataGraph(ii) newPlot = { "title": f"Run {ii+1}", - "xLabel": "Time (ms)", + "xLabel": "Time (ms) - Δt = 10ms", "yLabel": "Strain (ε)" if ii % 2 == 0 else "", "plots": [ #{"type": "text", "text": "Δt = 10ms", "x":0.99, "y":0.03, "align":("bottom", "right")}, @@ -89,7 +83,34 @@ if __name__ == "__main__": fig.savefig("./images/initTestData.png") # Calibration Data + # Actual Data + for i in [0,1]: + graphData = { + "figTitle": f"Calibration Data\nStrain over Time (Runs {i+1} to {i+4})", + "figTitleFontSize": 16, + "figSize": (8,8), #Yay America, this is in inches :/ # Note: cm = 1/2.54 + "plotDim": (2,2), + "subPlots":[] + } + for ii in range(i*4, 4 + i*3): + data1, data2 = makeCalibrationDataGraph(ii) + newPlot = { + "title": f"Run {ii+1} - {(ii+1)*50}g", + "xLabel": "Time (ms) - Δt = 10ms", + "yLabel": "Strain (ε)" if ii % 2 == 0 else "", + "plots": [ + {"type":"scatter", "x": data1["Time"], "y": data1["Strain"], "args":{"s":10, "zorder":2}, "colour": UQC["light_purple"]} + ] + } + graphData["subPlots"].append(newPlot) + + fig, _ = makeGraph(graphData, showPlot=False) + #fig.figlegend([ax[0], ax[0]], ['Upper','Lower'], loc=(0.85, 0.65)) + # Subplots adjusted to make room + # Note bbox_extra_artists includes both the title and the legend so that neither are cut off + #fig.subplots_adjust(top=0.8, right=0.8) + fig.savefig(f"./images/calibData_Runs_{i+1}-_{i+4}.png") plt.show() \ No newline at end of file