From 28eab5f155fed37cfbac5e726d6ecafdc88d8717 Mon Sep 17 00:00:00 2001 From: Cal W <20716204+calw20@users.noreply.github.com> Date: Sun, 2 Apr 2023 22:08:34 +1000 Subject: [PATCH] Finalise Calibration Runs --- main.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index b283c75..3660e80 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ from makeGraph import makeGraph, UQ_COLOURS as UQC DATA_FILE_PATH = ".\\data\\AERO4450-Group-10-Data-Analysis-v2.xls" actualData = pd.read_excel(DATA_FILE_PATH, sheet_name="Actual Data") -calibrationData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data Graphs") +calibrationData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data") def makeActualDataGraph(testRun): @@ -21,11 +21,14 @@ def makeActualDataGraph(testRun): return data1, data2 + 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"}) + + #Blah not all test runs start at the same point + blah = 1 if testRun in [0, 4] else 0 + data = (data[5:505])[blah::2].astype({"Time":"int", "Strain":"float"}) return data @@ -59,12 +62,8 @@ if __name__ == "__main__": } 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/actualData_Runs_{i+1}-_{i+4}.png") + #fig, _ = makeGraph(graphData, showPlot=False) + #fig.savefig(f"./images/actualData_Runs_{i+1}-_{i+4}.png") # Initial test Data data1, data2 = makeActualDataGraph(8) @@ -79,8 +78,8 @@ if __name__ == "__main__": {"type":"plot", "x": data2["Time"], "y": data2["Strain"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["dark_grey"]}, ] } - fig, _ = makeGraph(graphData) - fig.savefig("./images/initTestData.png") + #fig, _ = makeGraph(graphData) + #fig.savefig("./images/initTestData.png") # Calibration Data # Actual Data @@ -94,13 +93,13 @@ if __name__ == "__main__": } for ii in range(i*4, 4 + i*3): - data1, data2 = makeCalibrationDataGraph(ii) + data = 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"]} + {"type":"scatter", "x": data["Time"], "y": data["Strain"], "args":{"s":10, "zorder":2}, "colour": UQC["light_purple"]} ] } graphData["subPlots"].append(newPlot)