Inial plotting
This commit is contained in:
parent
23b1831c96
commit
8cd2fe414b
1
.gitignore
vendored
1
.gitignore
vendored
@ -166,3 +166,4 @@ images
|
||||
# Temp Folder
|
||||
tmp
|
||||
|
||||
~$*
|
||||
|
83
main.py
83
main.py
@ -1,15 +1,15 @@
|
||||
# Mech3410-P1-Graphs
|
||||
# Cal
|
||||
# Cal Wing - Aug 2024
|
||||
#
|
||||
|
||||
import os, time
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC # Custom Graphing Lib
|
||||
|
||||
|
||||
# Override Sin & Cos to use & return degrees
|
||||
#def sin(angle): return np.sin(np.deg2rad(angle))
|
||||
#def cos(angle): return np.cos(np.deg2rad(angle))
|
||||
@ -20,31 +20,64 @@ folders = ["./images"]
|
||||
for folder in folders:
|
||||
if not os.path.isdir(folder): os.mkdir(folder)
|
||||
|
||||
if __name__ == '__main__':
|
||||
#This is an example of drawing 4 plots by generating them
|
||||
graphData = {
|
||||
"figTitle": "Simple Plot",
|
||||
"figTitleFontSize": 16,
|
||||
"figSize": (8,8), #Yay America, this is in inches :/ # Note: cm = 1/2.54
|
||||
|
||||
INCH_TO_M = 0.0254
|
||||
GRAVITY = 9.81 #m/s^2
|
||||
|
||||
PITOT_PLACEMENT = ( # mm from base
|
||||
0,
|
||||
4,
|
||||
8,
|
||||
16,
|
||||
25,
|
||||
34,
|
||||
43,
|
||||
53,
|
||||
61,
|
||||
70,
|
||||
5,
|
||||
9,
|
||||
17,
|
||||
25,
|
||||
34,
|
||||
43,
|
||||
53,
|
||||
61,
|
||||
70,
|
||||
)
|
||||
|
||||
print("Loading Data")
|
||||
data = pd.read_excel('.\\data\\508 RPM Results.xlsx', sheet_name=None, header=None)
|
||||
print("Loaded Data")
|
||||
|
||||
sheet1 = data['0 AoA']
|
||||
#print(sheet1)
|
||||
|
||||
air_speed = 10 # m/s
|
||||
water_density = sheet1.iloc[0, 2] # kg/m^3
|
||||
air_density = sheet1.iloc[1, 2] # kg/m^3
|
||||
atm_presure_inch = sheet1.iloc[24, 12] # inch
|
||||
|
||||
pitot_height_inch = sheet1.iloc[4:23, 11]
|
||||
pitot_height_m = (pitot_height_inch - atm_presure_inch)*INCH_TO_M
|
||||
|
||||
pressure = water_density * GRAVITY * pitot_height_m
|
||||
|
||||
#print(pressure)
|
||||
#print(pressure.min(), pressure.max())
|
||||
|
||||
|
||||
makeGraph({
|
||||
"title": "Simple Plot",
|
||||
"xLabel": "x label",
|
||||
"yLabel": "y label",
|
||||
"plotDim": (2,2),
|
||||
"subPlots":[]
|
||||
}
|
||||
|
||||
#Create 4 identical plots with different names
|
||||
for i in range(4):
|
||||
newPlot = {
|
||||
"title": f"Graph {i+1}",
|
||||
"plots": [
|
||||
{"x":[0,1,2,3,4], "y":[0,1,2,3,4], "label":"Linear"},
|
||||
{"x":[0,1,2,3,4], "y":[5,5,5,5,5]},
|
||||
{"x":[4,3,2,1,0], "y":[4,3,2,1,0], "label":"Linear2"},
|
||||
{"x":0, "type":"axvLine", "label":"Red Vertical Line", "color":"red"},
|
||||
{"y":6, "type":"axhLine", "label":"Dashed Horizontal Line", "args":{"linestyle":"--"}},
|
||||
{"type":"scatter", "x":4, "y":4, "label":"A Random Point", "colour":"purple", "args":{"zorder":2}}
|
||||
{"x":PITOT_PLACEMENT, "y":pressure, "label":"Linear", "type":"scatter"},
|
||||
]
|
||||
}
|
||||
graphData["subPlots"].append(newPlot)
|
||||
})
|
||||
|
||||
makeGraph(graphData, figSavePath="./images/example.png")
|
||||
def main():
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
Reference in New Issue
Block a user