From 8cd2fe414b04bc5cdeb8b394eb2145e0f30c918d Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:15:12 +1000 Subject: [PATCH] Inial plotting --- .gitignore | 1 + main.py | 87 ++++++++++++++++++++++++++++++++--------------- requirements.txt | Bin 84 -> 104 bytes 3 files changed, 61 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index f6a4150..bb786a5 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,4 @@ images # Temp Folder tmp +~$* diff --git a/main.py b/main.py index 0fd2efe..e8738a6 100644 --- a/main.py +++ b/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 - "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}", +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", "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") \ No newline at end of file + }) + +def main(): + pass + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f378c6e897f808acbedebe8bb3e6f7dba419bca4..a7806f9cb66541105066053f7a25959a49d1e7e3 100644 GIT binary patch delta 27 gcmWH^m=Gk!%fQ8u&rraS%8&;nD;X*nau^gC08@(vYXATM delta 7 Ocmc}@nGnRJzyJUVH37i@