Add Final values
This commit is contained in:
56
main.py
56
main.py
@@ -2,6 +2,7 @@
|
|||||||
# Cal Wing 2023
|
# Cal Wing 2023
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from tqdm import tqdm
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from makeGraph import makeGraph, UQ_COLOURS as UQC
|
from makeGraph import makeGraph, UQ_COLOURS as UQC
|
||||||
@@ -12,7 +13,6 @@ actualGraphData = pd.read_excel(DATA_FILE_PATH, sheet_name="Actual Data Graphs")
|
|||||||
calibrationData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data")
|
calibrationData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data")
|
||||||
calibrationGraphData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data Graphs")
|
calibrationGraphData = pd.read_excel(DATA_FILE_PATH, sheet_name="Calibration Data Graphs")
|
||||||
|
|
||||||
|
|
||||||
def makeActualDataGraph(testRun):
|
def makeActualDataGraph(testRun):
|
||||||
cols = [f"Unnamed: {3 + testRun*5}", f"Unnamed: {4+ testRun*5}"]
|
cols = [f"Unnamed: {3 + testRun*5}", f"Unnamed: {4+ testRun*5}"]
|
||||||
data = actualData[cols].rename(columns = {cols[0]:'Time', cols[1]:'Strain'})
|
data = actualData[cols].rename(columns = {cols[0]:'Time', cols[1]:'Strain'})
|
||||||
@@ -34,10 +34,12 @@ def makeCalibrationDataGraph(testRun):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if not os.path.isdir("./images"):
|
if not os.path.isdir("./images"): os.mkdir("./images")
|
||||||
os.mkdir("./images")
|
if not os.path.isdir("./images/actual"): os.mkdir("./images/actual")
|
||||||
|
if not os.path.isdir("./images/calibration"): os.mkdir("./images/calibration")
|
||||||
|
|
||||||
# Actual Data
|
# Actual Data
|
||||||
|
pbar = tqdm(total=100)
|
||||||
for i in [0,1]:
|
for i in [0,1]:
|
||||||
graphData = {
|
graphData = {
|
||||||
"figTitle": f"Strain over Time (Runs {i+1} to {i+4})",
|
"figTitle": f"Strain over Time (Runs {i+1} to {i+4})",
|
||||||
@@ -52,7 +54,7 @@ if __name__ == "__main__":
|
|||||||
newPlot = {
|
newPlot = {
|
||||||
"title": f"Run {ii+1}",
|
"title": f"Run {ii+1}",
|
||||||
"xLabel": "Time (ms) - Δt = 10ms",
|
"xLabel": "Time (ms) - Δt = 10ms",
|
||||||
"yLabel": "Strain (ε)" if ii % 2 == 0 else "",
|
"yLabel": "Strain (ε)",
|
||||||
"plots": [
|
"plots": [
|
||||||
#{"type": "text", "text": "Δt = 10ms", "x":0.99, "y":0.03, "align":("bottom", "right")},
|
#{"type": "text", "text": "Δt = 10ms", "x":0.99, "y":0.03, "align":("bottom", "right")},
|
||||||
{"type":"scatter", "x": data1["Time"], "y": data1["Strain"], "args":{"s":10, "zorder":2}, "label":"Upper", "colour": UQC["purple"]},
|
{"type":"scatter", "x": data1["Time"], "y": data1["Strain"], "args":{"s":10, "zorder":2}, "label":"Upper", "colour": UQC["purple"]},
|
||||||
@@ -61,8 +63,17 @@ if __name__ == "__main__":
|
|||||||
{"type":"plot", "x": data2["Time"], "y": data2["Strain"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["dark_grey"]},
|
{"type":"plot", "x": data2["Time"], "y": data2["Strain"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["dark_grey"]},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
fig, _ = makeGraph(graphData, showPlot=False)
|
||||||
|
fig.savefig(f"./images/actual/Run_{ii+1}.png")
|
||||||
|
plt.close(fig)
|
||||||
|
|
||||||
|
newPlot["yLabel"] = "Strain (ε)" if ii % 2 == 0 else ""
|
||||||
graphData["subPlots"].append(newPlot)
|
graphData["subPlots"].append(newPlot)
|
||||||
|
|
||||||
|
pbar.update(100/8)
|
||||||
|
pbar.close()
|
||||||
|
|
||||||
|
|
||||||
#fig, _ = makeGraph(graphData, showPlot=False)
|
#fig, _ = makeGraph(graphData, showPlot=False)
|
||||||
#fig.savefig(f"./images/actualData_Runs_{i+1}-_{i+4}.png")
|
#fig.savefig(f"./images/actualData_Runs_{i+1}-_{i+4}.png")
|
||||||
|
|
||||||
@@ -82,6 +93,25 @@ if __name__ == "__main__":
|
|||||||
#fig, _ = makeGraph(graphData)
|
#fig, _ = makeGraph(graphData)
|
||||||
#fig.savefig("./images/initTestData.png")
|
#fig.savefig("./images/initTestData.png")
|
||||||
|
|
||||||
|
|
||||||
|
#Force vs Pressure Graph
|
||||||
|
cols = [f"Unnamed: 24", f"Unnamed: 25"]
|
||||||
|
data = actualGraphData[cols].rename(columns = {cols[0]:'Force (Thrust)', cols[1]:'Pressure'})
|
||||||
|
data = data[1:10].astype({"Force":"float", "Pressure":"float"})
|
||||||
|
avgStrainGraphData = {
|
||||||
|
"title": f"Force vs Absolute Pressure",
|
||||||
|
"xLabel": "Absolute Pressure (kPa)",
|
||||||
|
"yLabel": "Thrust (N)",
|
||||||
|
"plots":[
|
||||||
|
{"type":"scatter", "x": data["Pressure"], "y": data["Force"], "args":{"s":10, "zorder":2}, "label":"Average Strain", "colour": UQC["purple"]},
|
||||||
|
{"type":"plot", "x": data["Pressure"], "y": data["Force"], "args":{"zorder":0, "alpha":0.25}, "colour": UQC["purple"]},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
fig, _ = makeGraph(avgStrainGraphData)
|
||||||
|
fig.savefig("./images/ForceVsAbsPressure.png")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Calibration Data
|
# Calibration Data
|
||||||
# Average Data
|
# Average Data
|
||||||
cols = [f"force stuff", f"Unnamed: 25"]
|
cols = [f"force stuff", f"Unnamed: 25"]
|
||||||
@@ -89,8 +119,8 @@ if __name__ == "__main__":
|
|||||||
data = data[2:8].astype({"Strain":"float", "Force":"float"})
|
data = data[2:8].astype({"Strain":"float", "Force":"float"})
|
||||||
avgStrainGraphData = {
|
avgStrainGraphData = {
|
||||||
"title": f"Force vs Average Strain",
|
"title": f"Force vs Average Strain",
|
||||||
"xLabel": "Average Strain (ε)",
|
"xLabel": "Average Strain (με)",
|
||||||
"yLabel": "Weight (N)",
|
"yLabel": "Force (N)",
|
||||||
"plots":[
|
"plots":[
|
||||||
{"type":"scatter", "x": data["Strain"], "y": data["Force"], "args":{"s":10, "zorder":2}, "label":"Average Strain", "colour": UQC["purple"]},
|
{"type":"scatter", "x": data["Strain"], "y": data["Force"], "args":{"s":10, "zorder":2}, "label":"Average Strain", "colour": UQC["purple"]},
|
||||||
{"type":"plot", "label": "Approximation: y(x) = 0.196722x", "x": data["Strain"], "y": data["Strain"]*0.196722, "args":{"zorder":0, "alpha":0.5}, "colour": UQC["dark_grey"]}
|
{"type":"plot", "label": "Approximation: y(x) = 0.196722x", "x": data["Strain"], "y": data["Strain"]*0.196722, "args":{"zorder":0, "alpha":0.5}, "colour": UQC["dark_grey"]}
|
||||||
@@ -101,6 +131,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
|
|
||||||
# Actual Data
|
# Actual Data
|
||||||
|
pbar = tqdm(total=100)
|
||||||
for i in [0,1]:
|
for i in [0,1]:
|
||||||
graphData = {
|
graphData = {
|
||||||
"figTitle": f"Calibration Data\nStrain over Time (Runs {i+1} to {i+4})",
|
"figTitle": f"Calibration Data\nStrain over Time (Runs {i+1} to {i+4})",
|
||||||
@@ -115,16 +146,23 @@ if __name__ == "__main__":
|
|||||||
newPlot = {
|
newPlot = {
|
||||||
"title": f"Run {ii+1} - {(ii+1)*50}g",
|
"title": f"Run {ii+1} - {(ii+1)*50}g",
|
||||||
"xLabel": "Time (ms) - Δt = 10ms",
|
"xLabel": "Time (ms) - Δt = 10ms",
|
||||||
"yLabel": "Strain (ε)" if ii % 2 == 0 else "",
|
"yLabel": "Strain (ε)",
|
||||||
"plots": [
|
"plots": [
|
||||||
{"type":"scatter", "x": data["Time"], "y": data["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"]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
fig, _ = makeGraph(newPlot, showPlot=False)
|
||||||
|
fig.savefig(f"./images/calibration/Run_{ii+1}.png")
|
||||||
|
plt.close(fig)
|
||||||
|
|
||||||
|
newPlot["yLabel"] = "Strain (ε)" if ii % 2 == 0 else ""
|
||||||
graphData["subPlots"].append(newPlot)
|
graphData["subPlots"].append(newPlot)
|
||||||
|
pbar.update(100/7)
|
||||||
|
|
||||||
if bool(i): graphData["subPlots"].append(avgStrainGraphData)
|
if bool(i): graphData["subPlots"].append(avgStrainGraphData)
|
||||||
fig, _ = makeGraph(graphData, showPlot=False)
|
#fig, _ = makeGraph(graphData, showPlot=False)
|
||||||
fig.savefig(f"./images/calibData_Runs_{i+1}-_{i+(4 if i != 0 else 3)}.png")
|
#fig.savefig(f"./images/calibData_Runs_{i+1}-_{i+(4 if i != 0 else 3)}.png")
|
||||||
|
pbar.close()
|
||||||
|
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
colorama==0.4.6
|
||||||
contourpy==1.0.7
|
contourpy==1.0.7
|
||||||
cycler==0.11.0
|
cycler==0.11.0
|
||||||
fonttools==4.39.3
|
fonttools==4.39.3
|
||||||
@@ -11,4 +12,5 @@ pyparsing==3.0.9
|
|||||||
python-dateutil==2.8.2
|
python-dateutil==2.8.2
|
||||||
pytz==2023.3
|
pytz==2023.3
|
||||||
six==1.16.0
|
six==1.16.0
|
||||||
|
tqdm==4.65.0
|
||||||
xlrd==2.0.1
|
xlrd==2.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user